Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Font Family retrieve
Message
From
15/10/2002 04:09:40
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00711163
Message ID:
00711234
Views:
21
>is ther any way to get the font type of a given font name?, I mean, what I need to know is if th Font I specify is True Type, MonoType, etc etc

This info is retrieved from the FONTMETRIC(16) function:
FontInfo("Times New Roman",12)
FontInfo("Arial",12)
FontInfo("Roman",12)
FontInfo("Courier New",12)
FontInfo("Script",12)

FUNCTION FontInfo
LPARAMETERS tcFontName, tnFontSize
LOCAL lnPitchFamily, lnFF, lnFP && font's pitch and family

m.lnPitchFamily = FONTMETRIC(16,m.tcFontName,m.tnFontSize)

?
? "Font="+m.tcFontName,TRANSFORM(m.tnFontSize)

m.lnFF = BITAND(BITRSHIFT(m.lnPitchFamily,4),0x07)
? "Family="
DO CASE
CASE m.lnFF = 1
	?? "Roman"
CASE m.lnFF = 2
	?? "Swiss"
CASE m.lnFF = 3
	?? "Modern"
CASE m.lnFF = 4
	?? "Script"
CASE m.lnFF = 5
	?? "Decorative"
OTHERWISE
	?? "Don't know"
ENDCASE

m.lnFP = BITAND(m.lnPitchFamily,0x0F)
? "Pitch="
IF BITAND(m.lnFP,0x01)!=0
	?? "Proportional"
ELSE
	?? "Fixed size"
ENDIF
IF BITAND(m.lnFP,0x02)!=0
	?? ",Vector"
ENDIF
IF BITAND(m.lnFP,0x04)!=0
	?? ",True type"
ENDIF
IF BITAND(m.lnFP,0x08)!=0
	?? ",Device font"
ENDIF

ENDFUNC
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform