An ON_Font is a face in a font family. It corresponds to a Windows LOGFONT, a .NET System.Drawing.Font or a FreeType FT_Face. More...
#include <opennurbs_font.h>
Public Member Functions | |
ON_Font () | |
ON_Font (const ON_Font &src) | |
~ON_Font ()=default | |
const ON_wString & | AppleFontName () const |
const wchar_t * | AppleFontNameAsPointer () const |
double | AppleFontWeightTrait () const |
int | AppleWeightOfFont () const |
const class ON_FontGlyph * | CodePointGlyph (ON__UINT32 unicode_code_point) const |
Returns the glpyh informationh for used to render a specific code point More... | |
ON__UINT32 | CRC32 (bool bIgnoreFaceNameOrdinalCase) const |
Returns a 32-bit crc of the font weight, style, stretch, underline, strikethrough, and facename characteristics. More... | |
void | Dump (ON_TextLog &) const |
void | DumpFreeType (ON_TextLog &text_log) const |
unsigned int | FontCharacteristicsAsUnsigned () const |
The font properties weight, style, stretch, underlined, and strikethrough are encoded in the returned value. More... | |
const class ON_SHA1_Hash & | FontCharacteristicsHash () const |
const ON_wString & | FontDescription () const |
Get a text description of the font. More... | |
const wchar_t * | FontDescriptionAsPointer () const |
Get a text description of the font. More... | |
const wchar_t * | FontFaceName () const |
const ON_FontMetrics & | FontMetrics () const |
ON_Font::Stretch | FontStretch () const |
ON_Font::Style | FontStyle () const |
const ON_FontMetrics & | FontUnitFontMetrics () const |
This function is for expert users doing something complicated. More... | |
double | FontUnitToNormalizedScale () const |
ON_Font::Weight | FontWeight () const |
bool | IsBold () const |
User interfaces that want to behave as if there are 3 font weights, light < normal < < bold, can use the functions ON_Font.IsLight(), ON_Font.IsNormalWeight(), ON_Font.IsBold(), to query font weight ranges. More... | |
bool | IsItalic () const |
bool | IsLight () const |
User interfaces that want to behave as if there are 3 font weights, light < normal < < bold, can use the functions ON_Font.IsLight(), ON_Font.IsNormalWeight(), ON_Font.IsBold(), to query font weight ranges. More... | |
bool | IsManagedFont () const |
bool | IsNormalWeight () const |
User interfaces that want to behave as if there are 3 font weights, light < normal < < bold, can use the functions ON_Font.IsLight(), ON_Font.IsNormalWeight(), ON_Font.IsBold(), to query font weight ranges. More... | |
bool | IsOblique () |
bool | IsStrikethrough () const |
bool | IsUnderlined () const |
bool | IsUpright () const |
bool | IsValid (ON_TextLog *text_log=nullptr) const |
Tests an object to see if its data members are correctly initialized. More... | |
double | LinefeedRatio () const |
unsigned char | LogfontCharSet () const |
const ON_Font * | ManagedFont () const |
unsigned int | ManagedFontSerialNumber () const |
Two ON_Font classes reference the same platform font and create identical glyphs if and only if the have the same ManagedFontSerialNumber(). More... | |
double | NormalizedToFontUnitScale () const |
ON_DEPRECATED_MSG ("Use FontMetrics().AscentOfI()") int HeightOfI() const | |
ON_DEPRECATED_MSG ("Use FontMetrics().LineSpace()") int HeightOfLinefeed() const | |
ON_DEPRECATED_MSG ("Use FontMetrics().GlyphScale()") double HeightScale(double text_height) const | |
ON_DEPRECATED_MSG ("Use FontMetrics().StrikeoutThickness()") int GetStrikeoutSize() const | |
ON_DEPRECATED_MSG ("Use FontMetrics().StrikeoutPosition()") int GetStrikeoutPosition() const | |
ON_DEPRECATED_MSG ("Use FontMetrics().UnderscoreThickness()") int GetUnderscoreSize() const | |
ON_DEPRECATED_MSG ("Use FontMetrics().UnderscorePosition()") int GetUnderscorePosition() const | |
ON_Font & | operator= (const ON_Font &src) |
double | PointSize () const |
bool | Read (ON_BinaryArchive &) |
restore definition from binary archive More... | |
bool | ReadV5 (ON_BinaryArchive &, int *V5_font_index, ON_UUID *V5_font_id) |
V6 separated the V5 ON_Font into ON_TextStyle and ON_Font. More... | |
unsigned int | RuntimeSerialNumber () const |
bool | SetAppleFontWeightTrait (double apple_font_weight_trait) |
bool | SetAppleWeightOfFont (int apple_weight_of_font) |
bool | SetFontCharacteristics (const wchar_t *face_name, bool bBold, bool bItalic, bool bUnderlined, bool bStrikethrough) |
Create a font with a specified facename and properties. More... | |
bool | SetFontCharacteristics (double point_size, const wchar_t *face_name, bool bBold, bool bItalic, bool bUnderlined, bool bStrikethrough) |
Create a font with a specified facename and properties. More... | |
bool | SetFontCharacteristics (const wchar_t *face_name, ON_Font::Weight font_weight, ON_Font::Style font_style, ON_Font::Stretch font_stretch, bool bUnderlined, bool bStrikethrough) |
Set the font's face name and characteristics. More... | |
bool | SetFontCharacteristics (double point_size, const wchar_t *face_name, ON_Font::Weight font_weight, ON_Font::Style font_style, ON_Font::Stretch font_stretch, bool bUnderlined, bool bStrikethrough) |
bool | SetFontCharacteristics (const wchar_t *face_name, ON_Font::Weight font_weight, ON_Font::Style font_style, ON_Font::Stretch font_stretch, bool bUnderlined, bool bStrikethrough, double linefeed_ratio, unsigned int logfont_charset) |
bool | SetFontCharacteristics (double point_size, const wchar_t *face_name, ON_Font::Weight font_weight, ON_Font::Style font_style, ON_Font::Stretch font_stretch, bool bUnderlined, bool bStrikethrough, double linefeed_ratio, unsigned int logfont_charset) |
bool | SetFontFaceName (const wchar_t *face_name) |
bool | SetFontStretch (ON_Font::Stretch font_stretch) |
bool | SetFontStyle (ON_Font::Style font_style) |
bool | SetFontWeight (ON_Font::Weight font_weight) |
bool | SetFromAppleFontName (const wchar_t *apple_font_name) |
bool | SetFromFontDescription (const wchar_t *font_description) |
bool | SetFromFontDescription (const wchar_t *font_description, const wchar_t *apple_font_name) |
bool | SetLogfontCharSet (unsigned char logfont_charset) |
bool | SetPointSize (double point_size) |
bool | SetStrikethrough (bool bStrikethrough) |
bool | SetUnderlined (bool bUnderlined) |
bool | SetWindowsLogfontWeight (int windows_logfont_weight) |
int | WindowsLogfontWeight () const |
bool | Write (ON_BinaryArchive &) const |
serialize definition to binary archive More... | |
bool | WriteV5 (int V5_font_index, ON_UUID V5_font_id, ON_BinaryArchive &) const |
V6 separated the V5 ON_Font into ON_TextStyle and ON_Font. More... | |
Static Public Member Functions | |
static double | AppleFontWeightTraitFromWeight (ON_Font::Weight font_weight) |
The correspondence between Apple "font weight trait" values and ON_Font::Weight enum values is ON_Font::Weight::Thin = -0.4 Apple font weight trait ON_Font::Weight::Ultralight = -0.2667 Apple font weight trait ON_Font::Weight::Light = -0.1333 Apple font weight trait ON_Font::Weight::Normal = 0.0 Apple font weight trait ON_Font::Weight::Medium = 0.1333 Apple font weight trait ON_Font::Weight::Semibold = 0.2667 Apple font weight trait ON_Font::Weight::Bold = 0.4 Apple font weight trait ON_Font::Weight::Ultrabold = 0.5333 Apple font weight trait ON_Font::Weight::Heavy = 0.6667 Apple font weight trait More... | |
static int | AppleWeightOfFontFromWeight (ON_Font::Weight font_weight) |
The correspondence between Apple "weight of font" values and ON_Font::Weight enum values is ON_Font::Weight::Thin = 1 ON_Font::Weight::Ultralight = 2 ON_Font::Weight::Light = 3 ON_Font::Weight::Normal = 4 ON_Font::Weight::Medium = 5 ON_Font::Weight::Semibold = 6 ON_Font::Weight::Bold = 7 ON_Font::Weight::Ultrabold = 8 ON_Font::Weight::Heavy = 9 More... | |
static int | CompareFontCharacteristics (const ON_Font &a, const ON_Font &b) |
Compares the font weight, style, stretch, underline, strikethrough, linefeed_ratio and facename characteristics. More... | |
static int | CompareWeight (ON_Font::Weight weight_a, ON_Font::Weight weight_b) |
static void | DumpFreeTypeFace (ON__UINT_PTR free_type_face_ptr, ON_TextLog &text_log) |
static bool | EqualFontCharacteristics (const ON_Font &a, const ON_Font &b) |
Compares the font weight, style, stretch, underline, strikethrough, linefeed_ratio and facename characteristics. More... | |
static ON_Font::Stretch | FontStretchFromUnsigned (unsigned int unsigned_font_stretch) |
In the rare cases when an ON_Font::Stretch value must be passed as an unsigned int, use ON_Font::FontStretchFromUnsigned() to convert the unsigned value to an ON_Font::Stretch value. More... | |
static ON_Font::Style | FontStyleFromUnsigned (unsigned int unsigned_font_style) |
In the rare cases when an ON_Font::Style value must be passed as an unsigned int, use ON_Font::FontStyleFromUnsigned() to convert the unsigned value to an ON_Font::Style value. More... | |
static ON_Font::Weight | FontWeightFromUnsigned (unsigned int unsigned_font_weight) |
In the rare cases when an ON_Font::Weight value must be passed as an unsigned int, use ON_Font::FontWeightFromUnsigned() to convert the unsigned value to an ON_Font::Weight value. More... | |
static ON__UINT_PTR | FreeTypeFace (const ON_Font *font) |
If opennurbs is built with FreeType support then FT_Face freetype_face = (FT_Face)ON_Font::FreeTypeFace(font) will return a FreeType face that can be used to render the font. More... | |
static const ON_Font * | GetManagedFont (const wchar_t *face_name) |
Get a font managed by the application from the font characteristics. Never delete a font returned by GetManagedFont(). More... | |
static const ON_Font * | GetManagedFont (double point_size, const wchar_t *face_name) |
static const ON_Font * | GetManagedFont (const wchar_t *face_name, bool bBold) |
static const ON_Font * | GetManagedFont (double point_size, const wchar_t *face_name, bool bBold) |
static const ON_Font * | GetManagedFont (const wchar_t *face_name, bool bBold, bool bItalic) |
static const ON_Font * | GetManagedFont (double point_size, const wchar_t *face_name, bool bBold, bool bItalic) |
static const ON_Font * | GetManagedFont (const wchar_t *face_name, ON_Font::Weight font_weight, ON_Font::Style font_style) |
static const ON_Font * | GetManagedFont (double point_size, const wchar_t *face_name, ON_Font::Weight font_weight, ON_Font::Style font_style) |
static const ON_Font * | GetManagedFont (const wchar_t *face_name, ON_Font::Weight font_weight, ON_Font::Style font_style, ON_Font::Stretch font_stretch, bool bUnderlined, bool bStrikethrough, double linefeed_ratio, unsigned int logfont_charset) |
static const ON_Font * | GetManagedFont (double point_size, const wchar_t *face_name, ON_Font::Weight font_weight, ON_Font::Style font_style, ON_Font::Stretch font_stretch, bool bUnderlined, bool bStrikethrough, double linefeed_ratio, unsigned int logfont_charset) |
static const ON_Font * | GetManagedFont (const ON_Font &font_characteristics, bool bCreateIfNotFound) |
static const ON_Font * | GetManagedFontFromAppleFontName (const wchar_t *apple_font_name) |
static const ON_Font * | GetManagedFontFromFontDescription (const wchar_t *font_description) |
static const ON_Font * | GetManagedFontFromSerialNumber (unsigned int managed_font_runtime_serial_number) |
static unsigned int | GetManagedFontList (ON_SimpleArray< const ON_Font * > &managed_fonts) |
static void | GetRunBounds (const ON_Font &font, const wchar_t *text, double fontSizePixels, ON::TextHorizontalAlignment horizontalAlignment, ON::TextVerticalAlignment verticalAlignment, ON_2dPoint &boundsMin, ON_2dPoint &boundsMax, int &lineCount) |
static bool | IsNotAppleFontName (const wchar_t *font_description) |
When reading version 5 3dm achives, the font description can be a generic font description or an Apple font name. This function rejects certain descriptions like "Default" and "Arial" for use as Apple font names. More... | |
static bool | IsValidFaceName (const wchar_t *face_name) |
static void | SetCustomMeasurementFunctions (ON_GetGlyphMetricsFuncType measureGlyphFunc, ON_GetFontMetricsFuncType metricsFunction) |
static const wchar_t * | StyleToWideString (ON_Font::Style font_style) |
static ON_Font::Weight | WeightFromAppleFontWeightTrait (double apple_font_weight_trait) |
static ON_Font::Weight | WeightFromAppleWeightOfFont (int apple_weight_of_font) |
The correspondence between Apple "weight of font" values and ON_Font::Weight enum values is ON_Font::Weight::Thin = 1 ON_Font::Weight::Ultralight = 2 ON_Font::Weight::Light = 3 ON_Font::Weight::Normal = 4 ON_Font::Weight::Medium = 5 ON_Font::Weight::Semibold = 6 ON_Font::Weight::Bold = 7 ON_Font::Weight::Ultrabold = 8 ON_Font::Weight::Heavy = 9 More... | |
static ON_Font::Weight | WeightFromWindowsLogfontWeight (int windows_logfont_weight) |
The correspondence between Windows LOGFONT lfWeight values and ON_Font::Weight enum values is More... | |
static const wchar_t * | WeightToWideString (ON_Font::Weight font_weight) |
static unsigned char | WindowsLogfontCharSetFromFaceName (const wchar_t *face_name) |
static int | WindowsLogfontWeightFromWeight (ON_Font::Weight font_weight) |
The correspondence between Windows LOGFONT lfWeight values and ON_Font::Weight enum values is ON_Font::Weight::Thin = 100 LOGFONT lfWeight ON_Font::Weight::Ultralight = 200 LOGFONT lfWeight ON_Font::Weight::Light = 300 LOGFONT lfWeight ON_Font::Weight::Normal = 400 LOGFONT lfWeight ON_Font::Weight::Medium = 500 LOGFONT lfWeight ON_Font::Weight::Semibold = 600 LOGFONT lfWeight ON_Font::Weight::Bold = 700 LOGFONT lfWeight ON_Font::Weight::Ultrabold = 800 LOGFONT lfWeight ON_Font::Weight::Heavy = 900 LOGFONT lfWeight More... | |
Static Public Attributes | |
static const ON_Font | Default |
Friends | |
class | ON_FontGlyph |
class | ON_ManagedFonts |
An ON_Font is a face in a font family. It corresponds to a Windows LOGFONT, a .NET System.Drawing.Font or a FreeType FT_Face.
typedef void(* ON_Font::ON_GetFontMetricsFuncType) (const ON_Font *font, ON_FontMetrics &font_unit_font_metrics) |
typedef ON__UINT_PTR(* ON_Font::ON_GetGlyphMetricsFuncType) (const class ON_Font *font, ON__UINT32 unicode_code_point, class ON_TextBox &font_unit_glyph_box) |
enum ON_Font::Constants : int |
|
strong |
|
strong |
|
strong |
Weight enum values Avoid casting these values to int. Use ON_Font::WindowsLogfontWeightFromWeight() or ON_Font::AppleWeightOfFontFromWeight() or add another converter.
enum ON_Font::WindowsConstants : unsigned char |
ON_Font::ON_Font | ( | ) |
|
default |
ON_Font::ON_Font | ( | const ON_Font & | src | ) |
const ON_wString& ON_Font::AppleFontName | ( | ) | const |
const wchar_t* ON_Font::AppleFontNameAsPointer | ( | ) | const |
double ON_Font::AppleFontWeightTrait | ( | ) | const |
|
static |
The correspondence between Apple "font weight trait" values and ON_Font::Weight enum values is ON_Font::Weight::Thin = -0.4 Apple font weight trait ON_Font::Weight::Ultralight = -0.2667 Apple font weight trait ON_Font::Weight::Light = -0.1333 Apple font weight trait ON_Font::Weight::Normal = 0.0 Apple font weight trait ON_Font::Weight::Medium = 0.1333 Apple font weight trait ON_Font::Weight::Semibold = 0.2667 Apple font weight trait ON_Font::Weight::Bold = 0.4 Apple font weight trait ON_Font::Weight::Ultrabold = 0.5333 Apple font weight trait ON_Font::Weight::Heavy = 0.6667 Apple font weight trait
int ON_Font::AppleWeightOfFont | ( | ) | const |
|
static |
The correspondence between Apple "weight of font" values and ON_Font::Weight enum values is ON_Font::Weight::Thin = 1 ON_Font::Weight::Ultralight = 2 ON_Font::Weight::Light = 3 ON_Font::Weight::Normal = 4 ON_Font::Weight::Medium = 5 ON_Font::Weight::Semibold = 6 ON_Font::Weight::Bold = 7 ON_Font::Weight::Ultrabold = 8 ON_Font::Weight::Heavy = 9
const class ON_FontGlyph* ON_Font::CodePointGlyph | ( | ON__UINT32 | unicode_code_point | ) | const |
Returns the glpyh informationh for used to render a specific code point
TODODOC: unicode_code_point TODODOC: UNICODE code point value
Glyph rendering information.
Typically the returned glpyh uses is a single glpyh in this->ManagedFont(). In this case, glyph->SubstitueCount() is 0.
In some cases one or more glyphs from one or more substitute fonts are required to render the code point. In this case, glyph->SubstitueCount() is 0.
Compares the font weight, style, stretch, underline, strikethrough, linefeed_ratio and facename characteristics.
This is a legacy function and to preserve past behavior, some platform specific characteristics are not checked. Use FontCharacteristicsHash() when every characteristic needs to be compared.
|
static |
ON__UINT32 ON_Font::CRC32 | ( | bool | bIgnoreFaceNameOrdinalCase | ) | const |
Returns a 32-bit crc of the font weight, style, stretch, underline, strikethrough, and facename characteristics.
bIgnoreFaceNameOrdinalCase | [in] If true, ON_wString::MapStringOrdinal() is applied to the face name and the returned CRC is ordinal case independent. |
void ON_Font::Dump | ( | ON_TextLog & | ) | const |
void ON_Font::DumpFreeType | ( | ON_TextLog & | text_log | ) | const |
|
static |
Compares the font weight, style, stretch, underline, strikethrough, linefeed_ratio and facename characteristics.
This is a legacy function and to preserve past behavior, some platform specific characteristics are not checked. Use FontCharacteristicsHash() when every characteristic needs to be compared.
unsigned int ON_Font::FontCharacteristicsAsUnsigned | ( | ) | const |
The font properties weight, style, stretch, underlined, and strikethrough are encoded in the returned value.
This is a legacy value used in 3dm archive reading/writing and some sorting operations.
const class ON_SHA1_Hash& ON_Font::FontCharacteristicsHash | ( | ) | const |
A SHA-1 hash of all font characteristics, including platform specific settings. Two fonts have identical font characteristics, if and only if they have identical FontCharacteristicsHash() values.
const ON_wString& ON_Font::FontDescription | ( | ) | const |
Get a text description of the font.
font_description | [out] |
const wchar_t* ON_Font::FontDescriptionAsPointer | ( | ) | const |
Get a text description of the font.
font_description | [out] |
const wchar_t* ON_Font::FontFaceName | ( | ) | const |
const ON_FontMetrics& ON_Font::FontMetrics | ( | ) | const |
Normalized font metrics.
Font metric "normalized" units are comparable between different fonts. Normalized font metrics exist so that code that positions glyphs from multiple fonts does not have to take the unit system and resolution used in the design of each font. In opennurbs, much of this code that positions glyphs is located in ON_Annotation, ON_TextContent, and ON_TextRun member functions and is used when rendering annotation objects.
Fonts can be designed and defined at different resolutions and relative scaling is necessary when text contains glyphs from fonts desinged at different grid resolutions. For example, TrueType font grid with and height is often 1024x1024 or 2048x2014, OpenType grids are often 1000x1000, and PostScript grids are often 1000x1000. Opennurbs "font units" are the units the font was designed in.
Long ago, opennurbs and Rhino used only Windows TrueType fonts and ran only in Microsoft Windows. During this era, the "normalized units" were for a Windows LOGFONT created with lfHeight = ON_Font::Constants::AnnotationFontCellHeight.
Currently opennurbs and Rhino work on Microsoft Windows and Apple platforms and use FreeType to access font information. When a font is not "tricky", the "font design" units are the the units FreeType uses when a font is loaded with FT_LOAD_NO_SCALE.
When working with fonts and glyhphs in opennurbs and Rhino, SDK users almost always want to use normalized font and glyph metrics.
ON_Font::Stretch ON_Font::FontStretch | ( | ) | const |
|
static |
In the rare cases when an ON_Font::Stretch value must be passed as an unsigned int, use ON_Font::FontStretchFromUnsigned() to convert the unsigned value to an ON_Font::Stretch value.
unsigned_font_stretch | [in] |
ON_Font::Style ON_Font::FontStyle | ( | ) | const |
|
static |
In the rare cases when an ON_Font::Style value must be passed as an unsigned int, use ON_Font::FontStyleFromUnsigned() to convert the unsigned value to an ON_Font::Style value.
unsigned_font_style | [in] |
const ON_FontMetrics& ON_Font::FontUnitFontMetrics | ( | ) | const |
This function is for expert users doing something complicated.
See ON_Font.FontMetrics() documentation for important information about the differnce bewteen normalized and font unit metrics.
double ON_Font::FontUnitToNormalizedScale | ( | ) | const |
ON_Font::Weight ON_Font::FontWeight | ( | ) | const |
|
static |
In the rare cases when an ON_Font::Weight value must be passed as an unsigned int, use ON_Font::FontWeightFromUnsigned() to convert the unsigned value to an ON_Font::Weight value.
unsigned_font_weight | [in] |
|
static |
If opennurbs is built with FreeType support then FT_Face freetype_face = (FT_Face)ON_Font::FreeTypeFace(font) will return a FreeType face that can be used to render the font.
font | [in] |
Many fonts do not have a glyph for a every UNICODE codepoint and font substitution is required. If you want to get the freetype face used for a specfic UNICODE codepoint, call ON_Font::CodepointFreeTypeFace().
|
static |
Get a font managed by the application from the font characteristics. Never delete a font returned by GetManagedFont().
face_name | [in] |
font_weight | [in] default = ON_Font::Default.FontWeight() |
font_style | [in] default = ON_Font::Default.FontStyle() |
font_stretch | [in] default = ON_Font::Default.FontStretch() |
bUnderlined | [in] default = ON_Font::Default.Underlined() = false |
bStrikethrough | [in] default = ON_Font::Default.Strikethrough() = false |
linefeed_ratio | [in] default = ON_Font::Default.LinefeedRatio() |
windows_charset | [in] default = ON_Font::WindowsCharSet::DefaultCharSet |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
bool ON_Font::IsBold | ( | ) | const |
User interfaces that want to behave as if there are 3 font weights, light < normal < < bold, can use the functions ON_Font.IsLight(), ON_Font.IsNormalWeight(), ON_Font.IsBold(), to query font weight ranges.
bool ON_Font::IsItalic | ( | ) | const |
bool ON_Font::IsLight | ( | ) | const |
User interfaces that want to behave as if there are 3 font weights, light < normal < < bold, can use the functions ON_Font.IsLight(), ON_Font.IsNormalWeight(), ON_Font.IsBold(), to query font weight ranges.
bool ON_Font::IsManagedFont | ( | ) | const |
ON_Font::Default is managed.
bool ON_Font::IsNormalWeight | ( | ) | const |
User interfaces that want to behave as if there are 3 font weights, light < normal < < bold, can use the functions ON_Font.IsLight(), ON_Font.IsNormalWeight(), ON_Font.IsBold(), to query font weight ranges.
|
static |
When reading version 5 3dm achives, the font description can be a generic font description or an Apple font name. This function rejects certain descriptions like "Default" and "Arial" for use as Apple font names.
bool ON_Font::IsOblique | ( | ) |
bool ON_Font::IsStrikethrough | ( | ) | const |
bool ON_Font::IsUnderlined | ( | ) | const |
bool ON_Font::IsUpright | ( | ) | const |
bool ON_Font::IsValid | ( | ON_TextLog * | text_log = nullptr | ) | const |
Tests an object to see if its data members are correctly initialized.
text_log | [in] if the object is not valid and text_log is not nullptr, then a brief englis description of the reason the object is not valid is appened to the log. The information appended to text_log is suitable for |
low | level debugging purposes by programmers and is not intended to be useful as a high level user interface tool. |
|
static |
double ON_Font::LinefeedRatio | ( | ) | const |
unsigned char ON_Font::LogfontCharSet | ( | ) | const |
const ON_Font* ON_Font::ManagedFont | ( | ) | const |
If this->IsManagedFont() is true, then "this" is returned.
unsigned int ON_Font::ManagedFontSerialNumber | ( | ) | const |
Two ON_Font classes reference the same platform font and create identical glyphs if and only if the have the same ManagedFontSerialNumber().
double ON_Font::NormalizedToFontUnitScale | ( | ) | const |
ON_Font::ON_DEPRECATED_MSG | ( | "Use FontMetrics().AscentOfI()" | ) | const |
ON_Font::ON_DEPRECATED_MSG | ( | "Use FontMetrics().LineSpace()" | ) | const |
ON_Font::ON_DEPRECATED_MSG | ( | "Use FontMetrics().GlyphScale()" | ) | const |
ON_Font::ON_DEPRECATED_MSG | ( | "Use FontMetrics().StrikeoutThickness()" | ) | const |
ON_Font::ON_DEPRECATED_MSG | ( | "Use FontMetrics().StrikeoutPosition()" | ) | const |
ON_Font::ON_DEPRECATED_MSG | ( | "Use FontMetrics().UnderscoreThickness()" | ) | const |
ON_Font::ON_DEPRECATED_MSG | ( | "Use FontMetrics().UnderscorePosition()" | ) | const |
double ON_Font::PointSize | ( | ) | const |
Font character height in points (1 point = 1/72 inch).
See the remarks for a defintion of "character height".
A "point" is a length unit system. 1 point = 1/72 inch = 25.4/72 millimeters.
Typically, fonts are designed for maximum clarity when the rendered character height is close to PointSize().
font cell height = font ascent + font descent.
font character height = font cell height - font internal leading.
For fonts designed for languages that use latin letters, it is common for the character height to be equal to or a little larger than the distance from the bottom of a lower case g to the top of an upper case M. The character height is also called the "em hieght".
Font internal leading is the space above typical capital latin letters that is reseved for diacritical marks like the ring above the A in the UNICODE "LATIN LETTER A WITH RING" U+00C5 glyph (Angstrom symbol).
bool ON_Font::Read | ( | ON_BinaryArchive & | ) |
restore definition from binary archive
bool ON_Font::ReadV5 | ( | ON_BinaryArchive & | , |
int * | V5_font_index, | ||
ON_UUID * | V5_font_id | ||
) |
V6 separated the V5 ON_Font into ON_TextStyle and ON_Font.
unsigned int ON_Font::RuntimeSerialNumber | ( | ) | const |
bool ON_Font::SetAppleFontWeightTrait | ( | double | apple_font_weight_trait | ) |
bool ON_Font::SetAppleWeightOfFont | ( | int | apple_weight_of_font | ) |
|
static |
bool ON_Font::SetFontCharacteristics | ( | const wchar_t * | face_name, |
bool | bBold, | ||
bool | bItalic, | ||
bool | bUnderlined, | ||
bool | bStrikethrough | ||
) |
Create a font with a specified facename and properties.
face_name | [in] nullptr is treated as ON_Font::Default.FaceName(). |
bBold | [in] True for a bold version of the font. |
bItalic | [in] True for an italic version of the font. |
bool ON_Font::SetFontCharacteristics | ( | double | point_size, |
const wchar_t * | face_name, | ||
bool | bBold, | ||
bool | bItalic, | ||
bool | bUnderlined, | ||
bool | bStrikethrough | ||
) |
Create a font with a specified facename and properties.
point_size | [in] If point_size > 0.0, then it specifies which size of font definition should be used. Otherwise the font size used for annotation text is used. For high quality fonts it is generally the case that different point sizes of the same font face have subtle differences in glyph design and are not simply scaled versions of a base glyph. |
face_name | [in] nullptr is treated as ON_Font::Default.FaceName(). |
bBold | [in] True for a bold version of the font. |
bItalic | [in] True for an italic version of the font. |
bool ON_Font::SetFontCharacteristics | ( | const wchar_t * | face_name, |
ON_Font::Weight | font_weight, | ||
ON_Font::Style | font_style, | ||
ON_Font::Stretch | font_stretch, | ||
bool | bUnderlined, | ||
bool | bStrikethrough | ||
) |
Set the font's face name and characteristics.
face_name | [in] nullptr is not permitted. Pass ON_Font::Default.FaceName() if you don't have a face name. |
bool ON_Font::SetFontCharacteristics | ( | double | point_size, |
const wchar_t * | face_name, | ||
ON_Font::Weight | font_weight, | ||
ON_Font::Style | font_style, | ||
ON_Font::Stretch | font_stretch, | ||
bool | bUnderlined, | ||
bool | bStrikethrough | ||
) |
bool ON_Font::SetFontCharacteristics | ( | const wchar_t * | face_name, |
ON_Font::Weight | font_weight, | ||
ON_Font::Style | font_style, | ||
ON_Font::Stretch | font_stretch, | ||
bool | bUnderlined, | ||
bool | bStrikethrough, | ||
double | linefeed_ratio, | ||
unsigned int | logfont_charset | ||
) |
bool ON_Font::SetFontCharacteristics | ( | double | point_size, |
const wchar_t * | face_name, | ||
ON_Font::Weight | font_weight, | ||
ON_Font::Style | font_style, | ||
ON_Font::Stretch | font_stretch, | ||
bool | bUnderlined, | ||
bool | bStrikethrough, | ||
double | linefeed_ratio, | ||
unsigned int | logfont_charset | ||
) |
bool ON_Font::SetFontFaceName | ( | const wchar_t * | face_name | ) |
bool ON_Font::SetFontStretch | ( | ON_Font::Stretch | font_stretch | ) |
bool ON_Font::SetFontStyle | ( | ON_Font::Style | font_style | ) |
bool ON_Font::SetFontWeight | ( | ON_Font::Weight | font_weight | ) |
bool ON_Font::SetFromAppleFontName | ( | const wchar_t * | apple_font_name | ) |
bool ON_Font::SetFromFontDescription | ( | const wchar_t * | font_description | ) |
bool ON_Font::SetFromFontDescription | ( | const wchar_t * | font_description, |
const wchar_t * | apple_font_name | ||
) |
bool ON_Font::SetLogfontCharSet | ( | unsigned char | logfont_charset | ) |
bool ON_Font::SetPointSize | ( | double | point_size | ) |
point_size | [in] font character height in point units. |
See the remarks section ON_Font::PointSize() for more information about point units and character height.
bool ON_Font::SetStrikethrough | ( | bool | bStrikethrough | ) |
bool ON_Font::SetUnderlined | ( | bool | bUnderlined | ) |
bool ON_Font::SetWindowsLogfontWeight | ( | int | windows_logfont_weight | ) |
|
static |
|
static |
apple_font_weight_trait | [in] Apple NSFontWeightTrait The valid value range is from -1.0 to 1.0. The value of 0.0 corresponds to the regular or medium font weight. |
|
static |
The correspondence between Apple "weight of font" values and ON_Font::Weight enum values is ON_Font::Weight::Thin = 1 ON_Font::Weight::Ultralight = 2 ON_Font::Weight::Light = 3 ON_Font::Weight::Normal = 4 ON_Font::Weight::Medium = 5 ON_Font::Weight::Semibold = 6 ON_Font::Weight::Bold = 7 ON_Font::Weight::Ultrabold = 8 ON_Font::Weight::Heavy = 9
|
static |
The correspondence between Windows LOGFONT lfWeight values and ON_Font::Weight enum values is
ON_Font::Weight::Thin = 100 ON_Font::Weight::Ultralight = 200 ON_Font::Weight::Light = 300 ON_Font::Weight::Normal = 400 ON_Font::Weight::Medium = 500 ON_Font::Weight::Semibold = 600 ON_Font::Weight::Bold = 700 ON_Font::Weight::Ultrabold = 800 ON_Font::Weight::Heavy = 900
|
static |
|
static |
face_name | [in] |
int ON_Font::WindowsLogfontWeight | ( | ) | const |
|
static |
The correspondence between Windows LOGFONT lfWeight values and ON_Font::Weight enum values is ON_Font::Weight::Thin = 100 LOGFONT lfWeight ON_Font::Weight::Ultralight = 200 LOGFONT lfWeight ON_Font::Weight::Light = 300 LOGFONT lfWeight ON_Font::Weight::Normal = 400 LOGFONT lfWeight ON_Font::Weight::Medium = 500 LOGFONT lfWeight ON_Font::Weight::Semibold = 600 LOGFONT lfWeight ON_Font::Weight::Bold = 700 LOGFONT lfWeight ON_Font::Weight::Ultrabold = 800 LOGFONT lfWeight ON_Font::Weight::Heavy = 900 LOGFONT lfWeight
bool ON_Font::Write | ( | ON_BinaryArchive & | ) | const |
serialize definition to binary archive
bool ON_Font::WriteV5 | ( | int | V5_font_index, |
ON_UUID | V5_font_id, | ||
ON_BinaryArchive & | |||
) | const |
V6 separated the V5 ON_Font into ON_TextStyle and ON_Font.
|
friend |
|
friend |
|
static |