#include <opennurbs_font.h>
◆ ON_FontMetrics() [1/2]
ON_FontMetrics::ON_FontMetrics |
( |
| ) |
|
|
default |
◆ ~ON_FontMetrics()
ON_FontMetrics::~ON_FontMetrics |
( |
| ) |
|
|
default |
◆ ON_FontMetrics() [2/2]
◆ Ascent()
int ON_FontMetrics::Ascent |
( |
| ) |
const |
- Returns
- Signed distance from the baseline to highest point on a glyph outline.
If every glyph outline in the font has (0,0) on the basline, then Ascent() is the maximum glyph bounding box Y.
◆ AscentOfI()
int ON_FontMetrics::AscentOfI |
( |
| ) |
const |
- Returns
- The signed distance from the baseline to the highest point on the 'I' glyph.
The primary uses of AscentOfI() are: 1) Calculate a scale factor to produce text with a user specified "text height". 2) To calculate insertion location for ON::TextVerticalAlignment::Middle and ON::TextVerticalAlignment::Top.
Since 2005, opennurbs has used (user specified text height)/AscentOfI() as the scale factor to render glyphs when user interface has provided a "text height" value. Users are more satisfied with this approach than when the scaling is base on line space or maximum font glyph ascent values. Experiments have ruled out the use of any other capital latin letter glyph except 'H' for this use. When a font does not contain an 'I' glyph, a suitable value is returned that can be used for text height scaling and vertical alignment.
◆ Descent()
int ON_FontMetrics::Descent |
( |
| ) |
const |
- Returns
- Signed distance from the baseline to lowest point on a glyph outline.
This value is typically negative because glyphs for letters like 'j' typically have a portion of their outline below the baseline. However, some fonts have positive descent. If every glyph outline in the font has (0,0) on the basline, then Ascent() is the maximum glyph bounding box Y.
◆ GlyphScale()
double ON_FontMetrics::GlyphScale |
( |
double |
text_height | ) |
const |
Get the scale to apply to normalized glyph boxes and outlines to render the 'I' in the glyph's font at a height of text_height.
- Parameters
-
text_height | [in] The desired height of typical capital latin letter glyphs. |
- Returns
- text_height / AscentOfI().
◆ HeightsAreValid()
bool ON_FontMetrics::HeightsAreValid |
( |
| ) |
const |
◆ LineSpace()
int ON_FontMetrics::LineSpace |
( |
| ) |
const |
- Returns
The postive distance to move a base line when moving to a new line of text.
For almost every font used to render text, LineSpace() > (Ascent() - Descent()).
This metric is sometimes called "height", but that term is often confused with (Ascent() - Descent()).
For fonts designed to render horizontal lines of text, LineSpace() is a vertical distance. For fonts desingned to render vertical lines of text, LineSpace() is a horizontal distance. Depending on the context, the direction to move can be up, down, left or right.
◆ operator=()
◆ Scale()
◆ SetAscentOfI()
void ON_FontMetrics::SetAscentOfI |
( |
int |
ascent_of_I | ) |
|
◆ SetHeights()
void ON_FontMetrics::SetHeights |
( |
int |
ascent, |
|
|
int |
descent, |
|
|
int |
UPM, |
|
|
int |
line_space |
|
) |
| |
◆ SetStrikeout()
void ON_FontMetrics::SetStrikeout |
( |
int |
strikeout_position, |
|
|
int |
strikeout_thickness |
|
) |
| |
◆ SetUnderscore()
void ON_FontMetrics::SetUnderscore |
( |
int |
underscore_position, |
|
|
int |
underscore_thickness |
|
) |
| |
◆ StrikeoutPosition()
int ON_FontMetrics::StrikeoutPosition |
( |
| ) |
const |
- Returns
- Signed distance from baseline to center of strikeout. A positive value indicates the strikeout is above the baseline (common).
The signed distance from the baseline to the bottom of the strikeout is StrikeoutPosition() - StrikeoutThickness()/2.
◆ StrikeoutThickness()
int ON_FontMetrics::StrikeoutThickness |
( |
| ) |
const |
◆ UnderscorePosition()
int ON_FontMetrics::UnderscorePosition |
( |
| ) |
const |
- Returns
- Signed distance from baseline to center of underscore. A negative value indicates the underscore is below the baseline (common).
The signed distance from the baseline to the bottom of the underscore is UnderscorePosition() - UnderscoreThickness()/2.
◆ UnderscoreThickness()
int ON_FontMetrics::UnderscoreThickness |
( |
| ) |
const |
◆ UPM()
int ON_FontMetrics::UPM |
( |
| ) |
const |
- Returns
- The "units per EM". This is the height and width of the square grid where the font glyphs are designed.
The width of the 'M' glyph in a font can be different from UPM. The height of the 'M' glyph in a font is typically less than UPM. In TrueType fonts, UPM is often a power of two and generally 1024 or 2048. In OpenType fonts, UPM is often 1000. In PostScript fonts, UPM is often 1000.
◆ DefaultLineFeedRatio
const double ON_FontMetrics::DefaultLineFeedRatio |
|
static |
◆ HeightOfCapitalCodePoint
const ON__UINT32 ON_FontMetrics::HeightOfCapitalCodePoint |
|
static |
◆ Unset