Deux possibilités (Windows)SPH a écrit :Vivement la lectures de fontes locales alors
Code : Tout sélectionner
;
; Load Font From DataSection
;
Import "User32.lib"
;Windows NT/2000/XP/Vista: Included in Windows 2000 And later.
;Windows 95/98/Me: Unsupported.
AddFontMemResourceEx(pFont,Size,Par,Count)
RemoveFontMemResourceEx(fHandle)
EndImport
Global fHandle.l,Fonts.l
If OpenWindow(0, #PB_Ignore,#PB_Ignore,640,480, "Mein Font", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
If CreateGadgetList(WindowID(0))
fHandle = AddFontMemResourceEx(?MyFont,?EndOfMyFont-?MyFont,0,@Fonts)
LoadFont(1,"Digiface",14)
ButtonGadget(0, 10,10,80,24,"12345")
SetGadgetFont(0,FontID(1))
EndIf
Repeat
EventID = WaitWindowEvent()
Select EventID
Case #PB_Event_Gadget
Select EventGadget()
Case 0:
RemoveFontMemResourceEx(fHandle)
SendMessage_(WindowID(0),#WM_CLOSE,0,0)
EndSelect
EndSelect
If EventID = #PB_Event_CloseWindow
Quit = 1
EndIf
Until Quit = 1
EndIf
End
DataSection
MyFont:
IncludeBinary "Digiface.ttf"
EndOfMyFont:
EndDataSection
Code : Tout sélectionner
;
; AddFontResource
;
EnableExplicit
Define Result.l
Define i.l
Result = AddFontResource_("DIMITRI_.TTF")
SendMessage_(#HWND_BROADCAST,#WM_FONTCHANGE,0,0)
If OpenWindow(0, 0, 0, 322, 150, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
EditorGadget(0, 8, 8, 306, 133)
For i = 0 To 5
AddGadgetItem(0,i,"Line "+Str(i))
Next
SetGadgetFont(0,LoadFont(0,"DIMITRI",10))
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
RemoveFontResource_("DIMITRI_.TTF")
SendMessage_(#HWND_BROADCAST,#WM_FONTCHANGE,0,0)