I don't get any information about a font being italic or bold nor the file name needed to load this font.
Using pjays code (see below) to show details for all fonts starting with "Century751" does produce the following output here:
1: Century751 BT: ANSI_CHARSET
2: Century751 BT: TURKISH_CHARSET
3: Century751 No2 BT: ANSI_CHARSET
4: Century751 No2 BT: TURKISH_CHARSET
5: Century751 SeBd BT: ANSI_CHARSET
6: Century751 SeBd BT: TURKISH_CHARSET
The windows font settings do show 2 types for the 'BT' and 'SeBD' families (Roman and Italic) and 4 types for the 'No2 BT' font (Roman, Italic, Bold, Bold Italic).
So what will happen when using LoadFont(1,"...",24) with font names like...
... "Century751 BT"
... "Century751 BT Regular"
... "Century751 BT Roman"
... "Century751 BT Normal"
... "Century751 BT Bold"
... "Century751 BT Italic"
... "Century751 No2 BT Italic Bold"
... "Century751 No2 BT Bold Italic"
Which one will load an existing font? How do I know that "Century751 SeBd" is just a semibold variant of "Century751 BT"?
Seems more complicated than I thought
I would like to create a font requester showing only the font families and all existing types for them to choose from. Next step would be a filter to show italic or mono spaced fonts only, etc. This would keep the list smaller, otherwise you have to scroll around a while to find the font you are searching for.
Code: Select all
Global NewMap tm_Charset.s()
tm_Charset("0") = "ANSI_CHARSET" : tm_Charset("1") = "DEFAULT_CHARSET" : tm_Charset("2") = "SYMBOL_CHARSET"
tm_Charset("77") = "MAC_CHARSET" : tm_Charset("128") = "SHIFTJIS_CHARSET" : tm_Charset("129") = "HANGEUL_CHARSET"
tm_Charset("130") = "JOHAB_CHARSET" : tm_Charset("134") = "GB2312_CHARSET" : tm_Charset("136") = "CHINESEBIG5_CHARSET"
tm_Charset("161") = "GREEK_CHARSET" : tm_Charset("162") = "TURKISH_CHARSET" : tm_Charset("163") = "VIETNAMESE_CHARSET" : tm_Charset("177") = "HEBREW_CHARSET"
tm_Charset("178") = "ARABIC_CHARSET" : tm_Charset("186") = "BALTIC_CHARSET" : tm_Charset("204") = "RUSSIAN_CHARSET"
tm_Charset("222") = "THAI_CHARSET" : tm_Charset("238") = "EASTEUROPE_CHARSET" : tm_Charset("255") = "OEM_CHARSET"
Global NewMap tm_flag.s()
tm_flag("01") = "Italic " : tm_flag("11") = "Underscore " : tm_flag("21") = "Negative "
tm_flag("31") = "Outline " : tm_flag("41") = "Strikeout " : tm_flag("51") = "Bold "
Macro GetBit(num,bit) : (num >> bit) & 1 : EndMacro
Procedure EnumFontInfo(*elfx.ENUMLOGFONTEX,*ntmx.NEWTEXTMETRICEX,FontType.i,lParam.i)
Protected name.s
name=PeekS(@*elfx\elfLogFont\lfFaceName[0])
If Left(name,10)="Century751"
Protected myLoop, txt.s, *tmCharSet_asc.ascii = @*ntmx\ntmTm\tmCharSet : Static entries : entries + 1
txt = Str(entries) + ": "+PeekS(@*elfx\elfLogFont\lfFaceName[0])+": " + tm_Charset(Str(*tmCharSet_asc\a)) + " "
For myloop = 0 To 5 : txt + tm_flag(Str(myLoop)+Str(GetBit(*ntmx\ntmTm\ntmFlags,myloop))) : Next
Debug txt
EndIf
ProcedureReturn #True
EndProcedure
Procedure EnumFontList(font.s)
Protected FontLog.LOGFONT
Protected FontHDC
Protected Fontname.s
FontHDC=GetDC_(WinID)
FillMemory(@FontLog,SizeOf(LOGFONT))
FontLog\lfCharSet=#DEFAULT_CHARSET
PokeS(@FontLog\lfFaceName,font)
If EnumFontFamiliesEx_(FontHDC,@FontLog,@EnumFontInfo(),0,0)
ProcedureReturn #True
Else
ProcedureReturn #False
EndIf
EndProcedure
;Debug EnumFontList("Courier New")
EnumFontList("")