Adolfo wrote:Must I create 10 different fonts according to the possible heights the may have.
DEFINE FONT oFont NAME "Courier New" SIZE 0,-10 BOLD of oPRINT
oFontB := TFont():New("Ms Sans Serif",,-6,.F.,.T. ,,,,.F. )
oFont8b := TFont():New( "Times New Roman", 0,-8, .F.,.T. , , , ,.F.,,,,,,, oPRINT, )
oFont10 := TFont():New( "Times New Roman", 0,-10,.F.,.F. , , , ,.F.,,,,,,, oPRINT, )
oFont10b := TFont():New( "Times New Roman", 0,-10,.F.,.T. , , , ,.F.,,,,,,, oPRINT, )
oFont12ib := TFont():New( "Times New Roman", 0,-12,.F.,.T. , , , ,.T.,,,,,,, oPRINT, )
oFont12b := TFont():New( "Times New Roman", 0,-12,.F.,.T. , , , ,.F.,,,,,,, oPRINT, )
oFont14b := TFont():New( "Times New Roman", 0,-14,.F.,.T. , , , ,.F.,,,,,,, oPRINT, )
oFont24b := TFont():New( "Times New Roman", 0,-24,.F.,.T. , , , ,.F.,,,,,,, oPRINT, )
DEFINE FONT oFont NAME "Courier New" SIZE 0,-10 BOLD of oPRINT
Pre-processes to:
oFontB := TFont():New("Ms Sans Serif",,-6,.F.,.T. ,,,,.F. )
Why -10 translates to 6 ?
FUNCTION FONT_ADJ()
LOCAL nPoints := 10 // start-size
LOCAL nLines := VAL( SUBSTR( cDrawStyle, 1, 2 ) ) // lines from combo
// 1pt = 1.3333 pixels
DO WHILE .T.
IF nPoints * 1.333 * nLines > nFWinH // defined window-height
EXIT
ENDIF
nPoints++
ENDDO
aFTYPE[3] := nPoints // new fontsize
// create NEW fontsize related to window-height and lines
DeleteObject(oFont3)
oFont3 := TFont():New( ALLTRIM( aFTYPE[1] ), + ;
aFTYPE[2], aFTYPE[3], .F., aFTYPE[4], aFTYPE[5],0,0, aFTYPE[6], aFTYPE[7] )
RETURN( NIL )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot], JoséQuintas, nageswaragunupudi and 32 guests