Platforms to show: All Mac Windows Linux Cross-Platform

Back to Graphics class.

Graphics.DrawRotatedTextMBS(Rotation as Double, text as string, x as Integer, y as Integer, Center as Boolean = false, alpha as Double = 1.0, NoSwapY as boolean = false, FontWidth as Integer = 0)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Graphics & Pictures MBS Util Plugin 11.2 ✅ Yes ✅ Yes ❌ No ❌ No Desktop only
Draws rotated text.
Example
Sub Paint(g As Graphics)

g.DrawRotatedTextMBS 45, "Hello World", 100, 100

End Sub

Rotation is the angle in degree.
Currently only supported for Mac OS X and Windows in GUI applications.

The plugin does not see the clipping offset for the graphics object. So for graphics objects from printer or canvas, you need to offset the position. Seems like with a Canvas the coordinates are relative to canvas in Cocoa, but relative to Windows in Carbon.

We have the optional parameter Center which tells the plugin to center the rotated text, so the rotation point is in the middle of the text.
The plugin queries Bold, Italic, Underline, ForeColor, TextUnit, TextSize or TextFont.

Alpha gives the alpha value for Mac OS X. Can be 1.0 (Full color) to 0.0 (no color).

On Mac targets the Y coordinate needs to be swapped internally from top down coordinates to bottom up coordinates. As this does not work 100% correct on printers (the plugin doesn't know page margins), you can provide correct Y coordinate yourself and pass NoSwapY = true. (added in plugin version 13.1)
On Windows the OS function used (ExtTextOut) does not support multiple lines.

FontWidth is only for Windows to define the width of the font. Default is 0 to use default width.
The average width, in logical units, of characters in the font. If FontWidth is zero, the aspect ratio of the device is matched against the digitization aspect ratio of the available fonts to find the

On Windows for drawing in a picture, make sure the font size and font name are set. Else it may not draw.
For Windows, we only use HDC for drawing, so if you have a graphics context not using a HDC, this function doesn't draw. The function is not updated for DirectDraw.

Some examples using this method:

Blog Entries

Xojo Developer Magazine

Videos

The items on this page are in the following plugins: MBS Util Plugin.


The biggest plugin in space...