Page 1 of 1

Font List and Current Font

Posted: Fri May 09, 2014 8:03 am
by hmgchang
Dear Sirs,

Is there any HMG functions to get all installed fonts ?
or How to get the current Font in effect ?

Thks n Rgds
Chang :D

Re: Font List and Current Font

Posted: Fri May 09, 2014 8:53 am
by Rathinagiri
Hi,

Please see here.

http://hmgforum.com/viewtopic.php?p=34197#p34197" onclick="window.open(this.href);return false;

Re: Font List and Current Font

Posted: Sat May 10, 2014 4:26 am
by hmgchang
Ok Sir and thanks,
BTW, how to entry the link in this post ?

Font List and Current Font

Posted: Sat May 10, 2014 5:29 am
by Pablo César
hmgchang wrote:Ok Sir and thanks,
BTW, how to entry the link in this post ?
Just put URL tag in your link

Re: Font List and Current Font with size

Posted: Mon May 12, 2014 5:13 am
by hmgchang
I wonder if we have functions to return an array of available fontsize ?

aFontsize := GetFontSize( "Arial")

or other font properties.

Thks n Rgds
Chang

Re: Font List and Current Font

Posted: Mon May 12, 2014 6:07 am
by mol
If you're using TTF font, you can use any size - this is vector font.
Bold, italic fonts are placed in different files (see windows\fonts).

Re: Font List and Current Font

Posted: Mon May 12, 2014 6:36 am
by hmgchang
Thks Mol for your quick info...
Is that mean that I can adjust to any fontsize to fit the paper width ?
And one more thing about font is the Pt( Point).
I read that fontsize eg. 10pt is the height of the font.
How about the width ? any way to measure the width of a word or sentence?

Thks n Rgds
Chang

Re: Font List and Current Font

Posted: Mon May 12, 2014 8:07 am
by mol
When you use proportional font, every character has different width.
you can use this function to calculate print length:

Code: Select all

function PrintLen( cString,nFontsize,cFontname)
return round(gettextwidth(Nil,cString,cFontname)*0.072/72*25.4*nFontsize,2)

Re: Font List and Current Font

Posted: Tue May 13, 2014 5:33 am
by hmgchang
Thks Mol,

Code:
function PrintLen( cString,nFontsize,cFontname)
return round(gettextwidth(Nil,cString,cFontname)*0.072/72*25.4*nFontsize,2)



Printlen is for fixed width fonts and
return round(gettextwidth(Nil,cString,cFontname)*0.072/72*25.4*nFontsize,2)
is for non-fixed width fonts !

and the 0.072 is the height ( fontsize) to width ratio ?

Re: Font List and Current Font

Posted: Tue May 13, 2014 8:37 am
by mol
0.072/72 *25.4 is from conversion from inches (72dpi) to milimetres.