DrawVectorText()

Syntax

DrawVectorText(Text$)
Description
Draw the given text at the current location of the path cursor. The cursor will be moved horizontally to the end of the drawn text. The font to use can be set with VectorFont().

Parameters

Text$ The text to draw (single line).

Return value

None.

Remarks

This function draws single lines of text only. Multiple calls must be made to draw multiple lines. Use VectorTextWidth() and VectorTextHeight() to determine the dimensions of the text to draw in order to properly align the text with other content.

The DrawVectorParagraph() function can be used to draw a larger block of text with automatic layout such as line breaks. This function is more suited for drawing multiline text.

Example

  If OpenWindow(0, 0, 0, 400, 200, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    CanvasGadget(0, 0, 0, 400, 200)
    LoadFont(0, "Impact", 20, #PB_Font_Bold)
    
    If StartVectorDrawing(CanvasVectorOutput(0))
    
      VectorFont(FontID(0), 25)
      VectorSourceColor(RGBA(0, 0, 0, 80))
      Text$ = "The quick brown fox jumped over the lazy doc"
      
      For i = 1 To 6
        MovePathCursor(200 - VectorTextWidth(Text$)/2, 100 - VectorTextHeight(Text$)/2)
        DrawVectorText(Text$)
        RotateCoordinates(200, 100, 30)
      Next i

      StopVectorDrawing()
    EndIf
    
    Repeat
      Event = WaitWindowEvent()
    Until Event = #PB_Event_CloseWindow
  EndIf

See Also

VectorTextWidth(), VectorTextHeight(), DrawVectorParagraph(), AddPathText(), VectorFont()

Supported OS

All

<- DrawVectorParagraph() - VectorDrawing Index - EndVectorLayer() ->