ChooseFont
Posted: Wed Dec 14, 2005 1:18 pm
Hi Fw's.
ChooseFont function can not set correctly the dimension of character passed in Array parameter and if I change the dimension is not the set value correctly.
For Ex. I set in the array -12, ChooseFont 9, select 12 and return -16!!!
Another problem is if I press "Cancel" button after any setting, the function return the data setting and not the previous value.
Many thanks for the help
For more info test this:
#define LF_HEIGHT 1
#define LF_WIDTH 2
#define LF_ESCAPEMENT 3
#define LF_ORIENTATION 4
#define LF_WEIGHT 5
#define LF_ITALIC 6
#define LF_UNDERLINE 7
#define LF_STRIKEOUT 8
#define LF_CHARSET 9
#define LF_OUTPRECISION 10
#define LF_CLIPPRECISION 11
#define LF_QUALITY 12
#define LF_PITCHANDFAMILY 13
#define LF_FACENAME 14
#define FW_NORMAL 400
#define FW_BOLD 700
//------------------------------------------------------------------------------
FUNCTION Main( )
LOCAL aFont[14], oIni, aOldFont, cFont
INI oIni FILE "prova.ini"
GET cFont SECTION "Stampanti" ENTRY "FontInStampa" OF oIni DEFAULT "Arial| 0| -12| 0| 0| 0| 0| 0"
ENDINI
MsgInfo( cFont )
aFont[LF_FACENAME] := ALLTRIM(StrToken(cFont,1,"|" ))
aFont[LF_WIDTH] := VAL( StrToken( cFont, 2, "|" ))
aFont[LF_HEIGHT] := VAL( StrToken( cFont, 3, "|" ))
aFont[LF_WEIGHT] := IF( VAL( StrToken( cFont, 4, "|" )) > 0, FW_BOLD, FW_NORMAL )
aFont[LF_ESCAPEMENT] := VAL( StrToken( cFont, 5, "|" ))
aFont[LF_ITALIC] := VAL( StrToken( cFont, 6, "|" )) > 1
aFont[LF_UNDERLINE] := VAL( StrToken( cFont, 7, "|" )) > 1
aOldFont := AClone( aFont )
aFont := ChooseFont( aFont )
cFont := aFont[LF_FACENAME] + "|" +;
cValToChar( aFont[LF_WIDTH] ) + "|" +;
cValToChar( aFont[LF_HEIGHT] ) + "|" +;
cValToChar( aFont[LF_WEIGHT] ) + "|" +;
cValToChar( aFont[LF_ESCAPEMENT] ) + "|" +;
cValToChar( aFont[LF_ITALIC] ) + "|" +;
cValToChar( aFont[LF_UNDERLINE] )
// Test in uscita
MsgInfo( cFont )
return If( ! Empty( aFont[ LF_FACENAME ] ), aFont, aOldFont )
//------------------------------------------------------------------------------
ChooseFont function can not set correctly the dimension of character passed in Array parameter and if I change the dimension is not the set value correctly.
For Ex. I set in the array -12, ChooseFont 9, select 12 and return -16!!!
Another problem is if I press "Cancel" button after any setting, the function return the data setting and not the previous value.
Many thanks for the help
For more info test this:
#define LF_HEIGHT 1
#define LF_WIDTH 2
#define LF_ESCAPEMENT 3
#define LF_ORIENTATION 4
#define LF_WEIGHT 5
#define LF_ITALIC 6
#define LF_UNDERLINE 7
#define LF_STRIKEOUT 8
#define LF_CHARSET 9
#define LF_OUTPRECISION 10
#define LF_CLIPPRECISION 11
#define LF_QUALITY 12
#define LF_PITCHANDFAMILY 13
#define LF_FACENAME 14
#define FW_NORMAL 400
#define FW_BOLD 700
//------------------------------------------------------------------------------
FUNCTION Main( )
LOCAL aFont[14], oIni, aOldFont, cFont
INI oIni FILE "prova.ini"
GET cFont SECTION "Stampanti" ENTRY "FontInStampa" OF oIni DEFAULT "Arial| 0| -12| 0| 0| 0| 0| 0"
ENDINI
MsgInfo( cFont )
aFont[LF_FACENAME] := ALLTRIM(StrToken(cFont,1,"|" ))
aFont[LF_WIDTH] := VAL( StrToken( cFont, 2, "|" ))
aFont[LF_HEIGHT] := VAL( StrToken( cFont, 3, "|" ))
aFont[LF_WEIGHT] := IF( VAL( StrToken( cFont, 4, "|" )) > 0, FW_BOLD, FW_NORMAL )
aFont[LF_ESCAPEMENT] := VAL( StrToken( cFont, 5, "|" ))
aFont[LF_ITALIC] := VAL( StrToken( cFont, 6, "|" )) > 1
aFont[LF_UNDERLINE] := VAL( StrToken( cFont, 7, "|" )) > 1
aOldFont := AClone( aFont )
aFont := ChooseFont( aFont )
cFont := aFont[LF_FACENAME] + "|" +;
cValToChar( aFont[LF_WIDTH] ) + "|" +;
cValToChar( aFont[LF_HEIGHT] ) + "|" +;
cValToChar( aFont[LF_WEIGHT] ) + "|" +;
cValToChar( aFont[LF_ESCAPEMENT] ) + "|" +;
cValToChar( aFont[LF_ITALIC] ) + "|" +;
cValToChar( aFont[LF_UNDERLINE] )
// Test in uscita
MsgInfo( cFont )
return If( ! Empty( aFont[ LF_FACENAME ] ), aFont, aOldFont )
//------------------------------------------------------------------------------