Hi folks,
here's my problem at the moment: I am adding a new, temporary, private TTF font with AddFontResourceEx (or with basic AddFontResource), but the GDIP functions I use don't see the font.
....
LOCAL s AS STRING, x as LONG
STATIC sTempFolder, szFontFile AS STRING
GetTempWorkFolder(BYREF sTempFolder)
s = LoadResourceAsString(0, "PB100", %RT_RCDATA)
x = FREEFILE
OPEN sTempfolder & "CoertSchrift_Romaans.ttf" FOR BINARY AS #x
PUT$ #x, s
CLOSE #x
szFontFile = sTempfolder & "CoertSchrift_Romaans.ttf" & $NUL
x = AddFontResourceEx(BYVAL STRPTR(szFontFile),%FR_PRIVATE,BYVAL 0)
.....
.....
LOCAL sfont AS STRING
LOCAL pBrush,pFontFamily,pFont,pFormat,rc AS DWORD
rc = GdipCreateSolidFill(&HFFC0C0C0, pBrush)
sfont = UCODE$("CoertSchrift Romaans" & $NUL)
rc = GdipCreateFontFamilyFromName(BYVAL sfont, BYVAL %NULL, pFontFamily)
rc = GdipCreateFont(pFontFamily, 48, %FontStyleBold, %UnitPixel, pFont)
......
If I use the basic AddFontResource (to make it "public"), I can see the font with WordPad, while my program is running. So I guess the adding part is partly working. But GdipCreateFontFamilyFromName() gives me error 14 (Font Family Not Found).
"SendMessage(%HWND_BROADCAST, %WM_FONTCHANGE, 0, 0)" didn't help either.
What can I do to make the GDIP to notice the added font too?
cheers.. C[_]
Try using sfont = UCODE$("CoertSchrift Romaans" & $NUL).
Thanks, I had forgot that, but that fix won't help.
I also forgot to mention that if I MANUALLY add the font to the system beforehand, the font is found and my tool is working. So I suspect I'm missing something important..? The test system under Vmware is mostly XP SP2 Pro ENG (because it is quite light, and available..), also tried W7 x64 which acted the same.
cheers.. aSa C[_]