Using different font style with DrawText()
Posted: Mon Jul 04, 2011 9:31 pm
Maybe it will be useful for someone
Code: Select all
CreateImage(0, 200, 200)
Procedure UnderL(Text$,XX,YY,ZZ)
StartDrawing(ImageOutput(0))
DrawingMode(#PB_2DDrawing_Transparent)
For i = 1 To Len(Text$)
If i = ZZ
DrawingFont(FontID(0))
Color = $0102FE
Else
DrawingFont(FontID(1))
Color = 0
EndIf
Result$ = Mid(Text$, i,1)
XX = DrawText(XX,YY, Result$, Color)
Next i
StopDrawing()
EndProcedure
LoadFont(0, "Broadway",12,#PB_Font_Underline)
LoadFont(1, "Arial",12)
If OpenWindow(0, 0, 0, 200, 200, "2DDrawing Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
StartDrawing(ImageOutput(0))
Box(0, 0, 200, 200, $FFFFFF)
StopDrawing()
UnderL("Hello World!",10,10,7)
UnderL("How about that",10,30,11)
UnderL("OK",10,50,1)
ImageGadget(0, 0, 0, 200, 200, ImageID(0))
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow