DrawText and single characters

Post bugreports for the Windows version here
tycoon
New User
New User
Posts: 8
Joined: Sun Oct 23, 2005 1:43 pm

DrawText and single characters

Post by tycoon »

Code: Select all

;DrawText and single characters

;Some characters are clipped off with DrawText and DrawRotatedText
;it works on WindowOutput but not on ImageOutput and CanvasOutput
;there is also a difference between DrawText and DrawRotatedText
;(same on Linux but with no difference in DrawText and DrawRotatedText)


Procedure Draw(txt$,output)
  StartDrawing(output)
  
  Box(0,0,300,300,0)
  DrawingMode(#PB_2DDrawing_Transparent)

  DrawingFont(FontID(0))
 
  For i = 1 To Len(txt$)
    Char$ = Mid(txt$, i, 1)
    width = TextWidth(Char$)
    DrawText(pos, 10, Char$, $FF)
    DrawRotatedText(pos, 100, Char$, 0, $FF)
    pos + width
  Next
  ;DrawText(0, 190, txt$, $FF00)
  
  StopDrawing()
EndProcedure


 OpenWindow(0, 20, 20, 900, 300, "drawtext", #PB_Window_SystemMenu)
  ImageGadget(0,300,0,300,300,0)
  CanvasGadget(1,600,0,300,300)
  
  CreateImage(0,300,300,24)
  LoadFont(0, "Arial",50,#PB_Font_Bold|#PB_Font_Italic)
  
  txt$ = "VfgHello"
  
  Draw(txt$,WindowOutput(0))
  Draw(txt$,ImageOutput(0))
  Draw(txt$,CanvasOutput(1))
  SetGadgetState(0,ImageID(0))
  
  FreeFont(0)
  
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow