It is currently Thu Nov 14, 2019 8:36 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: DrawText and single characters
PostPosted: Wed Feb 27, 2013 6:10 pm 
Offline
New User
New User

Joined: Sun Oct 23, 2005 1:43 pm
Posts: 8
Code:
;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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye