PeachDrawing.Core
PeachDrawing.Core.Canvas
Canvas.MeasureString Method
| Overloads | |
|---|---|
| MeasureString(string, Font, double, int, double) | Measure the width of string under max width restriction calculating the number of characters that can fit and the width those characters take. Not relevant for platforms that don’t render HTML on UI element. |
| MeasureString(string, Font, Nullable<ShapeSettings>) | Measure the width and height of string str when drawn on device context HDC using the given font font. |
Canvas.MeasureString(string, Font, double, int, double) Method
Measure the width of string under max width restriction calculating the number of characters that can fit and the width those characters take.
Not relevant for platforms that don’t render HTML on UI element.
public abstract void MeasureString(string str, PeachDrawing.Core.Font font, double maxWidth, out int charFit, out double charFitWidth);
Parameters
str System.String
the string to measure
font Font
the font to measure string with
maxWidth System.Double
the max width to calculate fit characters
charFit System.Int32
the number of characters that will fit under maxWidth restriction
charFitWidth System.Double
the width that only the characters that fit into max width take
Canvas.MeasureString(string, Font, Nullable<ShapeSettings>) Method
Measure the width and height of string str when drawn on device context HDC using the given font font.
public abstract PeachDrawing.Core.Size MeasureString(string str, PeachDrawing.Core.Font font, System.Nullable<PeachDrawing.Text.Shaping.ShapeSettings> features=null);
Parameters
str System.String
the string to measure
font Font
the font to measure string with
features System.Nullable<ShapeSettings>
which GSUB features (see ShapeSettings) to apply when shaping str - must match what DrawString(string, Font, PaintColor, PaintPoint, Size, double, FontPalette, Nullable<ShapeSettings>) will use for the same text, so the measured width matches what’s actually drawn.
Returns
Size
the size of the string