AppleStringDrawingContext - UBogun/Xojo-iosLib GitHub Wiki

Inherits from AppleObject
Memory leak check: not yet done.
Status: completed.

This is an implementation of NSStringDrawingContext, a class you can use to test your attributed string settings before real drawing.

General information

To use this class, allocate and initialize a new instance, set the minimum values, and pass your object to one of the corresponding NSAttributedString methods that take the context object as a parameter. Upon completion of drawing, you can use the actual drawing values to make adjustments or record where the string was actually drawn.

Xojo integration

No special wrapper. Use the features described below.

Constructor

Constructor (): Creates a new StringDrawingContext

Properties

ActualScaleFactor As Double (read-only): The actual scale factor that was applied to the font during drawing.

MinimumScaleFactor As Double: The scale factor that determines the smallest font size to use during drawing. A value of 0.0 corresponds to a scale factor of 1.0. Any value greater than 0.0 is multiplied by the font point size to get the smallest font size that is permissible to use. For example, 0.5 indicates a font that is half the size of the actual font, 0.75 is three-quarters of the font size, and so on. Typically, you specify a value between 0.0 and 1.0 to indicate how much the font can be shrunk during drawing.

TotalBounds As FoundationFramework.NSRect (read-only): The bounding rectangle that was last used when drawing the string.