Demivec wrote:
Any insight would be appreciated.
Code:
Define sizeX = 110, sizeY = 40, px = 2, py = 2
If Not LoadFont(0,"Courier New",10,#PB_Font_Bold): End: EndIf
If OpenWindow(0, 0, 0, sizeX, sizeY, "2DDrawing Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If CreateImage(0, sizeX, sizeY) And StartDrawing(ImageOutput(0))
Box(0, 0, sizeX, sizeY, RGB(255, 255, 255))
DrawingFont(FontID(0)) ;use TrueType font
Define text.s="X>>> O >>>X"
Define tx = TextWidth(text)
Define ty = TextHeight(text)
;draw standard text
DrawText(px,py,text)
;outline text with box to highlight dimensions (again)
DrawingMode(#PB_2DDrawing_Outlined)
Box(px, py, tx, ty, $FFFF00)
;draw rotated text with no rotation
DrawRotatedText(px, py + ty, text, 0, #Black)
;draw rotated text using a very small angle
DrawRotatedText(px, py + ty, text, -0.2, #Magenta) ; <== text has become skinnier?
StopDrawing()
ImageGadget(0, 0, 0, sizeX, sizeY, ImageID(0))
EndIf
Define event
Repeat
event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
EndIf
You are right, it happens with flag #PB_Font_Bold. Other flags like Italic and Strikeout work correctly.
Works with gDrawing (GDI+):
Code:
XIncludeFile "gDrawing.pbi"
Define sizeX = 510, sizeY = 140, px = 2, py = 2
;If Not LoadFont(0,"Courier New",10,#PB_Font_Bold): End: EndIf
;If Not LoadFont(0,"Consolas",10,#PB_Font_Bold): End: EndIf
;If Not LoadFont(0,"Consolas",10,#PB_Font_HighQuality): End: EndIf
gInit()
If OpenWindow(0, 0, 0, sizeX, sizeY, "2DDrawing Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If CreateImage(0, sizeX, sizeY) And gStartDrawing(ImageOutput(0))
gBox(0, 0, sizeX, sizeY, RGBA(255, 255, 255,255))
gSetFont("Courier New",40,#PB_Font_Bold) ;use TrueType font
Define text.s="X>>> O >>>X"
Define tx = gTextWidth(text)
Define ty = gTextHeight(text)
;draw standard text
gDrawText(px,py,text,RGBA(0,0,0,255))
;outline text with box to highlight dimensions (again)
gDrawingMode(#PB_2DDrawing_Outlined)
gBox(px, py, tx, ty, $FFFFFF00)
gDrawingMode(#PB_2DDrawing_Default)
;draw rotated text with no rotation
gDrawRotatedText(px, py + ty, text, 0, #Black|$FF000000)
;draw rotated text using a very small angle
gDrawRotatedText(px, py + ty, text, 0.5, #Magenta|$FF000000) ; <== text has become skinnier?
gStopDrawing()
ImageGadget(0, 0, 0, sizeX, sizeY, ImageID(0))
EndIf
Define event
Repeat
event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
EndIf