The real Hight-Information of a selected Font ?

The real Hight-Information of a selected Font ?

Postby ukoenig » Sat Feb 23, 2008 5:50 pm

Hello from Germany

I'm still struggling with the INI-Handling for Fonts.
I got it working like :

[Main]
DATESET=5
WRITESET=1
[Paint]
HEADPIC=1
COLTEXT=2
LOGO1=LOGO1
BRUSH1=9
COLOR1=16711680
LOGO2=LGO2
BRUSH2=9
COLOR2=16711680
POSTOP=10
POSLEFT=70
[SysFonts]
FONT1=Arial 10 .F. .F.
FONT2=Arial 12 .F. .F.
FONT3=Arial 14 .F. .F.
[BarFonts]
FONT4=Arial 21 .F. .F.
FONT5=Arial 27 .F. .F.
FONT6=Arial 29 .F. .F.


REDEFINE BUTTON oBtn11 ID 835 OF oDlg5 ;
ACTION ( oFont0 := ChooseFont(), ;
oFont13 := BUILDFONT(oFont0), ;
// oFont13 created with TFont():New(oFont0)
aTYPE4[1] := oFont13:cFacename, ;
aTYPE4[2] := oFont13:nHeight, ;
aTYPE4[3] := oFont13:lBold, ;
aTYPE4[4] := oFont13:lItalic, ;
oSay4:SetFont( oFont13 ), oSAY4:Refresh() )

REDEFINE SAY oSAY4 VAR e_FTYPE4 ID 830 FONT oFont13 OF oDlg5

the values aTYPE4[1] ..... aTYPE4[4], I write as a string to the INI-File

Reading from the INI-File, I saved the parts of the font-string
back to the values : aType4[1] ........ aType4[4]

With the Var's I create the Font :

oFont13 := TFont():New( aTYPE4[1], , aTYPE4[2], ;
.f.,aTYPE4[3], , , ,aTYPE4[4] )
I used :

TFont():New( aFont[ LF_FACENAME ],;
,;
aFont[ LF_HEIGHT ],; // Returns Values like 2312111115
.f.,;
!( aFont[ LF_WEIGHT ] == 400) ,;
aFont[ LF_ESCAPEMENT ],;
aFont[ LF_ORIENTATION ],;
aFont[ LF_WEIGHT ],;
aFont[ LF_ITALIC ],;
aFont[ LF_UNDERLINE ],;
aFont[ LF_STRIKEOUT ],;
aFont[ LF_CHARSET ],;
aFont[ LF_OUTPRECISION ],;
aFont[ LF_CLIPPRECISION ],;
aFont[ LF_QUALITY ],;
,;
aFont[ LF_PITCHANDFAMILY ] )

LF_HEIGHT returns Values, i cannot use
so i used oFont13:nHeight

It works, but the values are wrong.
I looked at the class tFont.
It seems, nHeight is calculated.

As a sample :
I select Font-Heigh = 12 I get value 10

The result-value is always smaler, as selected

Is there another way to get the real Hight-Value of a Font ?
The values for Face, Bold, Italic are OK.

Regards
Uwe
Last edited by ukoenig on Sat Feb 23, 2008 6:05 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: The real Hight-Information of a selected Font ?

Postby Richard Chidiak » Sat Feb 23, 2008 6:02 pm

Uwe

Try

INT(aFONT[LF_HEIGHT] * 10 / 13 * -1)

HTH

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Real Font-Hight

Postby ukoenig » Sat Feb 23, 2008 7:21 pm

Richard, Thank you very much

With the calculation, i getting the real font-height.
For a working sample, see Infofar Version 8.2 d => 24.02.

Regards
Uwe
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 6 guests