Edit :Just checked your snippet with latest versions of windows 10 and PB and it works fine (I think)
Vector Drawing Lib can not use any font unless it is installed into windows
To use any embedded font
Code: Select all
Text$ = "This is a TEST"
If CreateFile(0, GetTemporaryDirectory()+"LCD-BOLD.ttf")
WriteData(0, ?Font,?fontend-?font)
CloseFile(0)
Else
Debug "can not create the file!"
EndIf
fontname$ = GetTemporaryDirectory()+"LCD-BOLD.ttf"
AddFontResource_(@fontname$)
SendMessage_(#HWND_BROADCAST, #WM_FONTCHANGE, 0, 0)
LoadFont(0,"LCD",14)
OpenWindow(0,0,0,400,300,"Test",#PB_Window_SystemMenu| #PB_Window_ScreenCentered| #PB_Window_MaximizeGadget)
TextGadget(0,10,10,300,40,Text$,#SS_CENTERIMAGE | #SS_CENTER| #WS_BORDER)
CanvasGadget(1,10,60,300,40)
SetGadgetFont(0, FontID(0))
SetGadgetColor(0,#PB_Gadget_FrontColor,#Red)
SetGadgetColor(0,#PB_Gadget_BackColor,#Yellow)
If StartVectorDrawing(CanvasVectorOutput(1))
VectorSourceColor(RGBA(247, 249, 13, 255))
FillVectorOutput()
VectorFont(FontID(0) , 32)
VectorSourceColor(RGBA(255, 0, 0, 255))
MovePathCursor(30,5)
DrawVectorText(Text$)
StopVectorDrawing()
EndIf
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
RemoveFontResource_(@fontname$)
SendMessage_(#HWND_BROADCAST, #WM_FONTCHANGE, 0, 0)
RunProgram(GetEnvironmentVariable("comspec"),"/c del "+Chr(34)+fontname$+Chr(34),"",2)
Quit = 1
EndSelect
Until Quit = 1
RemoveFontResource_(@fontname$)
SendMessage_(#HWND_BROADCAST, #WM_FONTCHANGE, 0, 0)
RunProgram(GetEnvironmentVariable("comspec"),"/c del "+Chr(34)+fontname$+Chr(34),"",2)
End
DataSection
Font:
IncludeBinary "LCD-BOLD.ttf"
fontend:
EndDataSection