Font List and Current Font

Moderator: Rathinagiri

Post Reply
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Font List and Current Font

Post 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
Just Hmg It !
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Font List and Current Font

Post by Rathinagiri »

Hi,

Please see here.

http://hmgforum.com/viewtopic.php?p=34197#p34197" onclick="window.open(this.href);return false;
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Re: Font List and Current Font

Post by hmgchang »

Ok Sir and thanks,
BTW, how to entry the link in this post ?
Attachments
links.JPG
links.JPG (10.67 KiB) Viewed 5521 times
Just Hmg It !
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Font List and Current Font

Post 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
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Re: Font List and Current Font with size

Post 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
Just Hmg It !
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Font List and Current Font

Post 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).
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Re: Font List and Current Font

Post 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
Just Hmg It !
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Font List and Current Font

Post 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)
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Re: Font List and Current Font

Post 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 ?
Just Hmg It !
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Font List and Current Font

Post by mol »

0.072/72 *25.4 is from conversion from inches (72dpi) to milimetres.
Post Reply