Function Font.measureText
Measure text
string, return accumulated widths
[] (distance to end of n-th character), returns number of measured chars.
Supports Tab character processing and processing of menu item labels like '&File'.
Prototype
int measureText(
const(dchar[]) text,
ref int[] widths,
int maxWidth = 2147483647,
int tabSize = 4,
int tabOffset = 0,
uint textFlags = 0u
);
Parameters
Name | Description |
---|---|
text | text string to measure |
widths | output buffer to put measured widths (widths [i] will be set to cumulative widths text [0..i]) |
maxWidth | maximum width to measure - measure is stopping if max width is reached (pass MAX_WIDTH_UNSPECIFIED to measure all characters) |
tabSize | tabulation size , in number of spaces |
tabOffset | when string is drawn not from left position, use to move tab stops left/right |
textFlags | TextFlag bit set - to control underline, hotkey label processing, etc... |
Returns
number of characters measured (may be less than text.length if maxWidth
is reached)
Authors
Vadim Lopatin, coolreader.org@gmail.com
Copyright
Vadim Lopatin, 2014
License
Boost License 1.0