Rhino C++ API  8.13
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
ON_Font Class Reference

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 Types

enum  Constants : int { AnnotationFontCellHeight = 256, AnnotationFontApplePointSize = 256, MetricsGlyphCodePoint = 'I' }
 miscellaneous constants use to initialize Windows LOGFONT fields More...
 
enum  FontType : unsigned char { FontType::Unset = 0, FontType::ManagedFont = 1, FontType::InstalledFont = 2 }
 An enum that reports if the font face is available on the current device. More...
 
enum  NameLocale : ON__UINT8 { NameLocale::LocalizedFirst = 0, NameLocale::Localized = 1, NameLocale::English = 2 }
 ON_Font::NameLocale selects what locale is used for font name (PostScript, family, face, LOGFONT) queries. More...
 
typedef void(* ON_GetFontMetricsFuncType) (const class ON_Font *font, class ON_FontMetrics &font_metrics_in_font_design_units)
 
typedef unsigned int(* ON_GetGlyphMetricsFuncType) (const class ON_FontGlyph *font_glyph, class ON_TextBox &glyph_metrics_in_font_design_units)
 
typedef bool(* ON_GetGlyphOutlineFuncType) (const class ON_FontGlyph *glyph, bool bSingleStrokeFont, class ON_Outline &outline)
 
enum  Origin : unsigned char { Origin::Unset = 0, Origin::Unknown = 1, Origin::WindowsFont = 2, Origin::AppleFont = 3 }
 Platform where font originated. This information is useful when searching for appropriate substitutes. More...
 
enum  Stretch : unsigned char {
  Stretch::Unset = 0, Stretch::Ultracondensed = 1, Stretch::Extracondensed = 2, Stretch::Condensed = 3,
  Stretch::Semicondensed = 4, Stretch::Medium = 5, Stretch::Semiexpanded = 6, Stretch::Expanded = 7,
  Stretch::Extraexpanded = 8, Stretch::Ultraexpanded = 9
}
 Horizontal expansion or contraction of font More...
 
enum  Style : unsigned char { Style::Unset = 0, Style::Upright = 1, Style::Italic = 2, Style::Oblique = 3 }
 Vertical angle of font Upright, Italic, or Oblique More...
 
enum  Weight : unsigned char {
  Weight::Unset = 0, Weight::Thin = 1, Weight::Ultralight = 2, Weight::Light = 3,
  Weight::Normal = 4, Weight::Medium = 5, Weight::Semibold = 6, Weight::Bold = 7,
  Weight::Ultrabold = 8, Weight::Heavy = 9
}
 Weight enum values Avoid casting these values to int. Use ON_Font::WindowsLogfontWeightFromWeight() or ON_Font::AppleWeightOfFontFromWeight() or add another converter. More...
 
enum  WindowsConstants : unsigned char {
  logfont_ansi_charset = 0, logfont_default_charset = 1, logfont_symbol_charset = 2, logfont_out_precis = 7,
  logfont_quality = 4, logfont_pitch_and_family = 0
}
 

Public Member Functions

 ON_Font ()
 
 ON_Font (const ON_Font &src)
 
 ~ON_Font ()=default
 
const ON_wStringAppleFontName () const
 
const wchar_t * AppleFontNameAsPointer () const
 
double AppleFontWeightTrait () const
 
double AppleFontWeightTraitEx () const
 
double AppleFontWidthTrait () const
 
int AppleWeightOfFont () const
 
const ON_FontBestMatch (const ON_SimpleArray< const ON_Font * > &font_list) const
 
const ON_FontBestMatch (ON_Font const *const *font_list, size_t font_count) const
 
const class ON_FontGlyphCodePointGlyph (ON__UINT32 unicode_code_point) const
 
ON__UINT32 CRC32 (bool bIgnoreNameOrdinalCase) const
 
const ON_wString Description () const
 
const ON_wString Description (ON_Font::NameLocale name_local, wchar_t family_separator, wchar_t weight_width_slope_separator, bool bIncludeUndelinedAndStrikethrough) const
 
const ON_wString Description (ON_Font::NameLocale name_local, wchar_t family_separator, wchar_t weight_width_slope_separator, bool bIncludeUndelinedAndStrikethrough, bool bIncludeNotOnDevice) const
 
void Dump (ON_TextLog &) const
 for debugging More...
 
const ON_wString FaceName () const
 
const ON_wString FaceName (ON_Font::NameLocale name_locale) const
 
const ON_wString FamilyName () const
 
const ON_wString FamilyName (ON_Font::NameLocale name_locale) const
 
unsigned int FontCharacteristicsAsUnsigned () const
 
const class ON_SHA1_HashFontCharacteristicsHash () const
 
const ON_wStringFontDescription () const
 
const wchar_t * FontDescriptionAsPointer () const
 
const wchar_t * FontFaceName () const
 
const ON_FontMetricsFontMetrics () const
 
ON_Font::Origin FontOrigin () const
 
const ON_FontFaceQuartet FontQuartet () const
 
ON_Font::Stretch FontStretch () const
 
ON_Font::Style FontStyle () const
 
const ON_FontMetricsFontUnitFontMetrics () const
 
double FontUnitToNormalizedScale () const
 
ON_Font::Weight FontWeight () const
 
int GetStrikeoutPosition () const
 
int GetStrikeoutSize () const
 
int GetUnderscorePosition () const
 
int GetUnderscoreSize () const
 
bool HasUnsetProperties (bool bCheckFamilyName, bool bCheckPostScriptName) const
 
int HeightOfI () const
 
int HeightOfLinefeed () const
 
double HeightScale (double text_height) const
 
const ON_FontInstalledFamilyMemberWithWeightStretchStyle (ON_Font::Weight desired_weight, ON_Font::Stretch desired_stretch, ON_Font::Style desired_style) const
 
const ON_FontInstalledFont (bool bAllowBestMatch) const
 
const ON_FontFaceQuartet InstalledFontQuartet () const
 
bool IsBold () const
 
bool IsBoldInQuartet () const
 
bool IsDoubleStrokeFont () const
 
bool IsEngravingFont () const
 
bool IsInstalledFont () const
 
bool IsItalic () const
 
bool IsItalicInQuartet () const
 
bool IsItalicOrOblique () const
 
bool IsLight () const
 
bool IsManagedFont () const
 
bool IsManagedInstalledFont () const
 
bool IsManagedSubstitutedFont () const
 
bool IsNormalWeight () const
 
bool IsOblique ()
 ERROR - missing const. More...
 
bool IsSimulated () const
 
bool IsSingleStrokeFont () const
 
bool IsSingleStrokeOrDoubleStrokeFont () const
 
bool IsStrikethrough () const
 
bool IsSymbolFont () const
 
bool IsUnderlined () const
 
bool IsUpright () const
 
bool IsValid (ON_TextLog *text_log=nullptr) const
 
double LinefeedRatio () const
 
const ON_wString Locale () const
 BUSTED #pragma endregion. More...
 
unsigned char LogfontCharSet () const
 
const ON_FontManagedFamilyMemberWithRichTextProperties (bool bBold, bool bItalic, bool bUnderlined, bool bStrikethrough) const
 
const ON_FontManagedFamilyMemberWithWeightStretchStyle (ON_Font::Weight desired_weight, ON_Font::Stretch desired_stretch, ON_Font::Style desired_style, bool bUnderlined, bool bStrikethrough) const
 
const ON_FontManagedFont () const
 
unsigned int ManagedFontSerialNumber () const
 
double NormalizedToFontUnitScale () const
 
ON_Fontoperator= (const ON_Font &src)
 
ON_OutlineFigure::Type OutlineFigureType () const
 
const ON_PANOSE1 PANOSE1 () const
 
double PointSize () const
 
const ON_wString PostScriptName () const
 
const ON_wString PostScriptName (ON_Font::NameLocale name_locale) const
 
const wchar_t * PostScriptNameAsPointer () const
 
const ON_wString QuartetDescription () const
 
ON_FontFaceQuartet::Member QuartetFaceMember () const
 
const ON_wString QuartetName () const
 
const ON_wString QuartetName (ON_Font::NameLocale name_locale) 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...
 
const ON_wString RichTextFontName () const
 
unsigned int RuntimeSerialNumber () const
 
bool SetAppleFontWeightTrait (double apple_font_weight_trait)
 
bool SetAppleWeightOfFont (int apple_weight_of_font)
 
bool SetFamilyName (const wchar_t *family_name)
 
bool SetFontCharacteristics (const wchar_t *gdi_logfont_name, bool bBold, bool bItalic, bool bUnderlined, bool bStrikethrough)
 
bool SetFontCharacteristics (const wchar_t *gdi_logfont_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 *gdi_logfont_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 *gdi_logfont_name, bool bBold, bool bItalic, bool bUnderlined, bool bStrikethrough)
 
bool SetFontCharacteristics (double point_size, const wchar_t *gdi_logfont_name, ON_Font::Weight font_weight, ON_Font::Style font_style, ON_Font::Stretch font_stretch, bool bUnderlined, bool bStrikethrough)
 
bool SetFontCharacteristics (double point_size, const wchar_t *gdi_logfont_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 SetFontCharacteristicsForExperts (double point_size, const ON_wString postscript_name, const ON_wString quartet_name, ON_FontFaceQuartet::Member quartet_member, const ON_wString family_name, const ON_wString face_name, ON_Font::Weight font_weight, ON_Font::Style font_style, ON_Font::Stretch font_stretch, bool bUnderlined, bool bStrikethrough, unsigned char logfont_charset, int windows_logfont_weight, double apple_font_weight_trait, ON_PANOSE1 panose1)
 
bool SetFontDescriptionForExperts (const wchar_t *ignored_parameter)
 
bool SetFontFaceName (const wchar_t *windows_logfont_name)
 
void SetFontOrigin (ON_Font::Origin font_origin)
 
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 *postscript_name)
 
bool SetFromAppleFontName (const wchar_t *postscript_name, double point_size)
 
bool SetFromFontDescription (const wchar_t *font_description)
 
bool SetFromFontDescription (const wchar_t *font_description, const wchar_t *postscript_name)
 
bool SetFromPostScriptName (const wchar_t *postscript_name)
 
bool SetLogfontCharSet (unsigned char logfont_charset)
 
void SetPANOSE1 (ON_PANOSE1 panose1)
 
bool SetPointSize (double point_size)
 
void SetSimulated (bool bSimulatedWeight, bool bSimulatedStretch, bool bSimulatedStyle, bool bSimulatedOther)
 
bool SetStrikethrough (bool bStrikethrough)
 
bool SetUnderlined (bool bUnderlined)
 
unsigned int SetUnsetProperties (const ON_Font &source, bool bUpdateDescription)
 
bool SetWindowsLogfontName (const wchar_t *windows_logfont_name)
 
bool SetWindowsLogfontWeight (int windows_logfont_weight)
 
bool SimulatedStretch () const
 
bool SimulatedStyle () const
 
bool SimulatedWeight () const
 
const ON_FontSubstituteFont () const
 
const ON_wString WidthWeightSlantDescription () const
 
const ON_wString WindowsLogfontName () const
 
const ON_wString WindowsLogfontName (ON_Font::NameLocale name_locale) const
 
const wchar_t * WindowsLogfontNameAsPointer () const
 
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)
 
static int AppleWeightOfFontFromWeight (ON_Font::Weight font_weight)
 
static const ON_String CleanFontName (const wchar_t *dirty_font_name, ON_StringMapOrdinalType map)
 
static int CompareFontCharacteristics (const ON_Font &lhs, const ON_Font &rhs)
 
static int CompareFontCharacteristicsForExperts (bool bComparePlatformSpecificCharacteristics, bool bIgnoreUnsetCharacteristics, const ON_Font &lhs, const ON_Font &rhs)
 
static int CompareFontName (const ON_wString &lhs, const ON_wString &rhs)
 
static int CompareFontNamePointer (const ON_wString *lhs, const ON_wString *rhs)
 
static int CompareFontNameToHyphen (const ON_wString &lhs, const ON_wString &rhs)
 
static int CompareFontNameToHyphenPointer (const ON_wString *lhs, const ON_wString *rhs)
 
static int CompareFontNameToHyphenWideChar (const wchar_t *lhs, const wchar_t *rhs)
 
static int CompareFontNameWideChar (const wchar_t *lhs, const wchar_t *rhs)
 
static int CompareWeight (ON_Font::Weight weight_a, ON_Font::Weight weight_b)
 
static const ON_FontDefaultEngravingFont ()
 
static const wchar_t * DefaultFaceName ()
 
static const wchar_t * DefaultFamilyName ()
 
static const wchar_t * DefaultPostScriptName ()
 
static const wchar_t * DefaultWindowsLogfontName ()
 
static bool EqualFontCharacteristics (const ON_Font &lhs, const ON_Font &rhs)
 
static bool EqualFontFamily (const ON_Font *lhs, const ON_Font *rhs)
 
static bool EqualFontFamilyAndFace (const ON_Font *lhs, const ON_Font *rhs)
 
static bool EqualStretch (const ON_Font *lhs, const ON_Font *rhs, bool bUnsetIsEqual)
 
static bool EqualStyle (const ON_Font *lhs, const ON_Font *rhs, bool bUnsetIsEqual)
 
static bool EqualWeight (const ON_Font *lhs, const ON_Font *rhs, bool bUnsetIsEqual)
 
static bool EqualWeightStretchStyle (const ON_Font *lhs, const ON_Font *rhs, bool bUnsetIsEqual)
 
static const ON_wString FakeWindowsLogfontNameFromFamilyAndPostScriptNames (ON_wString family_name, ON_wString postscript_name)
 
static const ON_wString FamilyNameFromDirtyName (const wchar_t *dirty_name)
 
static const ON_FontFontFromRichTextProperties (ON_wString rich_text_font_name, bool bBoldQuartetMember, bool bItalicQuartetMember, bool bUnderlined, bool bStrikethrough)
 
static const ON_SHA1_Hash FontNameHash (const wchar_t *font_name, bool bStopAtHyphen)
 
static ON_Font::Origin FontOriginFromUnsigned (unsigned int unsigned_font_origin)
 
static ON_Font::Stretch FontStretchFromUnsigned (unsigned int unsigned_font_stretch)
 
static ON_Font::Style FontStyleFromUnsigned (unsigned int unsigned_font_style)
 
static ON_Font::Weight FontWeightFromUnsigned (unsigned int unsigned_font_weight)
 
static unsigned int GetInstalledFontFamily (const wchar_t *font_family_name, ON_SimpleArray< const ON_Font * > &installed_fonts)
 
static unsigned int GetInstalledFontList (ON_SimpleArray< const ON_Font * > &installed_fonts)
 
static const ON_FontGetManagedFont (const ON_Font &font_characteristics, bool bCreateIfNotFound)
 
static const ON_FontGetManagedFont (const wchar_t *face_name)
 
static const ON_FontGetManagedFont (const wchar_t *face_name, bool bBold)
 
static const ON_FontGetManagedFont (const wchar_t *face_name, bool bBold, bool bItalic)
 
static const ON_FontGetManagedFont (const wchar_t *face_name, ON_Font::Weight font_weight, ON_Font::Style font_style)
 
static const ON_FontGetManagedFont (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_FontGetManagedFont (double point_size, const wchar_t *face_name)
 
static const ON_FontGetManagedFont (double point_size, const wchar_t *face_name, bool bBold)
 
static const ON_FontGetManagedFont (double point_size, const wchar_t *face_name, bool bBold, bool bItalic)
 
static const ON_FontGetManagedFont (double point_size, const wchar_t *face_name, ON_Font::Weight font_weight, ON_Font::Style font_style)
 
static const ON_FontGetManagedFont (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_FontGetManagedFontFromAppleFontName (const char *postscript_name)
 
static const ON_FontGetManagedFontFromAppleFontName (const wchar_t *postscript_name)
 
static const ON_FontGetManagedFontFromFontDescription (const wchar_t *font_description)
 
static const ON_FontGetManagedFontFromPostScriptName (const char *postscript_name)
 
static const ON_FontGetManagedFontFromPostScriptName (const wchar_t *postscript_name)
 
static const ON_FontGetManagedFontFromSerialNumber (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 const ON_FontInstalledFontFromRichTextProperties (const wchar_t *rtf_font_name, bool bRtfBold, bool bRtfItalic)
 
static const class ON_FontListInstalledFontList ()
 
static bool IsBoldWeight (ON_Font::Weight weight)
 
static bool IsNotAppleFontName (const wchar_t *font_description)
 
static bool IsValidFaceName (const wchar_t *face_name)
 
static bool IsValidPointSize (double point_size)
 
static const ON_FontManagedFontFromRichTextProperties (const wchar_t *rtf_font_name, bool bRtfBold, bool bRtfItalic, bool bRftUnderlined, bool bRftStrikethrough)
 
static const class ON_FontListManagedFontList ()
 
static const ON_wString RichTextFontName (const ON_Font *font, bool bDefaultIfEmpty)
 
static const ON_wString RichTextPropertiesToString (bool bRtfBold, bool bRtfItalic, bool bRtfUnderlined, bool bRtfStrikethrough)
 
static const ON_wString RichTextPropertiesToString (const ON_Font *font)
 
static const ON_wString RichTextPropertiesToString (ON_Font::Weight rtf_weight, ON_Font::Style rtf_style, bool bRtfUnderlined, bool bRtfStrikethrough)
 
static unsigned int RichTextPropertyDeviation (bool bPreferedRtfBold, bool bPreferedItalic, bool bPreferedUnderline, bool bPreferedStrikethrough, bool bAvailableRtfBold, bool bAvailableItalic, bool bAvailableUnderline, bool bAvailableStrikethrough)
 
static unsigned int RichTextPropertyDeviation (bool bPreferedRtfBold, bool bPreferedItalic, bool bPreferedUnderline, bool bPreferedStrikethrough, const ON_Font *available_font)
 
static void SetCustomMeasurementFunctions (ON_GetGlyphMetricsFuncType measureGlyphFunc, ON_GetFontMetricsFuncType metricsFunction)
 
static const wchar_t * StretchToWideString (ON_Font::Stretch font_stretch)
 
static const wchar_t * StyleToWideString (ON_Font::Style font_style)
 
static bool TestInstalledFontList (class ON_TextLog &text_log)
 
static unsigned int UnderlinedStrikethroughDeviation (bool bPreferedUnderline, bool bPreferedStrikethrough, bool bAvailableUnderline, bool bAvailableStrikethrough)
 
static unsigned int UnderlinedStrikethroughDeviation (bool bPreferedUnderline, bool bPreferedStrikethrough, const ON_Font *available_font)
 
static unsigned int UnderlinedStrikethroughDeviation (const ON_Font *prefered_underlined_strikethrough, const ON_Font *available_font)
 
static ON_Font::Weight WeightFromAppleFontWeightTrait (double apple_font_weight_trait)
 
static ON_Font::Weight WeightFromAppleWeightOfFont (int apple_weight_of_font)
 
static ON_Font::Weight WeightFromWindowsLogfontWeight (int windows_logfont_weight)
 
static unsigned int WeightStretchStyleDeviation (const ON_Font *prefered_weight_stretch_style, const ON_Font *available_font)
 
static unsigned int WeightStretchStyleDeviation (ON_Font::Weight prefered_weight, ON_Font::Stretch prefered_stretch, ON_Font::Style prefered_style, const ON_Font *available_font)
 
static unsigned int WeightStretchStyleDeviation (ON_Font::Weight prefered_weight, ON_Font::Stretch prefered_stretch, ON_Font::Style prefered_style, ON_Font::Weight available_weight, ON_Font::Stretch available_stretch, ON_Font::Style available_style)
 
static const wchar_t * WeightToWideString (ON_Font::Weight font_weight)
 
static const ON_wString WidthWeightSlantDescription (ON_Font::Stretch width, ON_Font::Weight weight, ON_Font::Style slant)
 
static unsigned char WindowsLogfontCharSetFromFaceName (const wchar_t *face_name)
 
static int WindowsLogfontWeightFromWeight (ON_Font::Weight font_weight)
 

Static Public Attributes

static const ON_Font Default
 
static const ON_Font Unset
 ON_Font::Unset has unset face name and platform font name. More...
 

Friends

class ON_FontGlyph
 
class ON_FontList
 
class ON_ManagedFonts
 

Detailed Description

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.

Member Typedef Documentation

◆ ON_GetFontMetricsFuncType

typedef void(* ON_Font::ON_GetFontMetricsFuncType) (const class ON_Font *font, class ON_FontMetrics &font_metrics_in_font_design_units)

Parameters: font - [in] font_metrics_in_font_design_units - [out] font metrics in font design units

◆ ON_GetGlyphMetricsFuncType

typedef unsigned int(* ON_Font::ON_GetGlyphMetricsFuncType) (const class ON_FontGlyph *font_glyph, class ON_TextBox &glyph_metrics_in_font_design_units)

Parameters: font_glyph - [in] glyph_metrics_in_font_design_units - [out] glyph metrics in font design units Returns: >0: Glyph index 0: failed

◆ ON_GetGlyphOutlineFuncType

typedef bool(* ON_Font::ON_GetGlyphOutlineFuncType) (const class ON_FontGlyph *glyph, bool bSingleStrokeFont, class ON_Outline &outline)

Member Enumeration Documentation

◆ Constants

enum ON_Font::Constants : int

miscellaneous constants use to initialize Windows LOGFONT fields

Enumerator
AnnotationFontCellHeight 

Windows LOGFONT.lfHeight value (NOT A POINT SIZE)

1995 - 2015: Windows fonts have variations in glyph size, design and kerning for different point sizes. Text in Rhino is generally placed around geometry and the relative spatial relationships between the text and the geometry must remain constant on all devices and at all "zoom" levels. We have to choose a point size and then apply appropriate scaling during display, printing, and in other rendering calculations. After many experiments and 20 years of commercial use, (1995-2015) we have found 256 works best. This value is used on all platforms because the calculations it is used in occur on all platforms. These calculations must return consistent results so models exchanged between platforms maintain spatial relationships between text and geometry.

2017: (switching to freetype) The value ON_Font::Constants::AnnotationFontCellHeight is used to define "opennurbs normalized font coordinates". The scale ((double)ON_Font::Constants::AnnotationFontCellHeight)/(font definition grid height) is used to convert bounding information and outlines from a native font definition to opennurbs normalized font coordinates. Many TrueType fonts have font definition grid height = 2048. Many PostScript fonts have font definition grid height = 1000.

AnnotationFontApplePointSize 

This value is used on Apple platforms to get fonts used for rendering annotation. The size should be a power of 2. Ideally we want access to the font and glyph design size returned by CTFontGetUnitsPerEm().

MetricsGlyphCodePoint 

ON_Font::Constants::metric_char is the unicode code point value for the glyph used to calculate critical glyph metrics. It must be an 'I' or 'H', but we have not tested 'H'. There are problems with any other upper case latin letter in common fonts. In particular, the standard 'M' does not work. We have used 'I' for 22 years (1995 - 2017). This value is used on all platforms because the calculations it is used in occur on all platforms. These calculations must return consistent results so models exchanged between platforms maintain spatial relationships between text and geometry.

◆ FontType

enum ON_Font::FontType : unsigned char
strong

An enum that reports if the font face is available on the current device.

Enumerator
Unset 

Not set.

ManagedFont 

In the managed font list.

InstalledFont 

In the installed font list.

◆ NameLocale

ON_Font::NameLocale selects what locale is used for font name (PostScript, family, face, LOGFONT) queries.

BUSTED #pragma region RH_BUSTED_C_SHARED_ENUM [ON_Font::NameLocale] [Rhino.DocObjects.Font.NameLocale] [nested:byte]

Enumerator
LocalizedFirst 

summary> If the localalized name is not empty, return it. Otherwise return the en-us name. /summary> summary> Localized name. /summary>

Localized 

summary> en-us name. /summary>

English 

◆ Origin

enum ON_Font::Origin : unsigned char
strong

Platform where font originated. This information is useful when searching for appropriate substitutes.

Enumerator
Unset 

Not set.

Unknown 

Origin unknown. Changing an ON_Font characteristic like weight or style sets the origin to unknown.

WindowsFont 

Set from a Windows IDWriteFont by ON_Font::SetFromDWriteFont() or a Windows LOGFONT by ON_Font::SetFromWindowsLogFont() and FaceName and WindowLogfontName match a font installed on a Windows device.

AppleFont 

Set from an Apple CTFont. The PostScriptName() and FamilyName() match a font installed on device running MacOS or iOS. The FaceName() matches the "typeface" name shown in the MacOS FontBook app.

◆ Stretch

enum ON_Font::Stretch : unsigned char
strong

Horizontal expansion or contraction of font

Enumerator
Unset 

Not set.

Ultracondensed 
Extracondensed 
Condensed 
Semicondensed 
Medium 

Default font stretch.

Semiexpanded 

Normal = 5,.

Expanded 
Extraexpanded 
Ultraexpanded 

◆ Style

enum ON_Font::Style : unsigned char
strong

Vertical angle of font Upright, Italic, or Oblique

Enumerator
Unset 

Not set.

Upright 

Default font style.

Italic 

The face is sloped so the top is to the right of the base. Face names sometimes use the word "oblique" for italic faces.

Normal = 1, Roman = 1,

Oblique 

The face is sloped so the top is to the left of the base. This is extremely rare. NOTE WELL: Face names sometimes use the word "oblique" for italic faces.

◆ Weight

enum ON_Font::Weight : unsigned char
strong

Weight enum values Avoid casting these values to int. Use ON_Font::WindowsLogfontWeightFromWeight() or ON_Font::AppleWeightOfFontFromWeight() or add another converter.

Enumerator
Unset 

Not set.

Thin 

IsLight = true

Ultralight 

IsLight = true

Light 

ExtraLight = 2,.

IsLight = true

Normal 

Default font weight. IsNormalWeight = true Also called Regular.

Medium 

Regular = 4,.

IsNormalWeight = true

Semibold 

IsBold = true

Bold 

IsBold = true

Demibold = 6, Demi = 6, Semi = 6,

Ultrabold 

IsBold = true

Heavy 

ExtraBold = 8,.

IsBold = true Also called Black

◆ WindowsConstants

enum ON_Font::WindowsConstants : unsigned char

Interface

Enumerator
logfont_ansi_charset 

Values used to set Windows LOGFONT fields.

The values below are identical to the ones above and are used to insure code compiles for Apple and other platforms.

logfont_default_charset 
logfont_symbol_charset 
logfont_out_precis 
logfont_quality 
logfont_pitch_and_family 

Constructor & Destructor Documentation

◆ ON_Font() [1/2]

ON_Font::ON_Font ( )

◆ ~ON_Font()

ON_Font::~ON_Font ( )
default

◆ ON_Font() [2/2]

ON_Font::ON_Font ( const ON_Font src)

Member Function Documentation

◆ AppleFontName()

const ON_wString& ON_Font::AppleFontName ( ) const
Deprecated:
Use ON_Font::PostScriptName(ON_Font::NameLocale)

◆ AppleFontNameAsPointer()

const wchar_t* ON_Font::AppleFontNameAsPointer ( ) const
Deprecated:
Use ON_Font::PostScriptName(ON_Font::NameLocale)

◆ AppleFontWeightTrait()

double ON_Font::AppleFontWeightTrait ( ) const

◆ AppleFontWeightTraitEx()

double ON_Font::AppleFontWeightTraitEx ( ) const

Returns: If the font is created from a CTFont, the weight trait, otherwise ON_UNSET_VALUE;

◆ AppleFontWeightTraitFromWeight()

static double ON_Font::AppleFontWeightTraitFromWeight ( ON_Font::Weight  font_weight)
static

Description: 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 Returns: The Apple "WeightTrait" value that corresponds to the ON_Font::Weight enum value.

◆ AppleFontWidthTrait()

double ON_Font::AppleFontWidthTrait ( ) const

◆ AppleWeightOfFont()

int ON_Font::AppleWeightOfFont ( ) const

◆ AppleWeightOfFontFromWeight()

static int ON_Font::AppleWeightOfFontFromWeight ( ON_Font::Weight  font_weight)
static

Description: 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 Returns: The Apple "weight of font" value that corresponds to the ON_Font::Weight enum value.

◆ BestMatch() [1/2]

const ON_Font* ON_Font::BestMatch ( const ON_SimpleArray< const ON_Font * > &  font_list) const

Parameters: font_list - [in] Fonts to search for a match. All fonts in this list are tested (search time is proportional to font_list.Count()). If the list returned by GetInstalledFontFamily() contains reasonable options, it is a good choice for the font_list[] parameter. Returns: A pointer to the font in font_list[] that is the best match to this.

◆ BestMatch() [2/2]

const ON_Font* ON_Font::BestMatch ( ON_Font const *const *  font_list,
size_t  font_count 
) const

Parameters: font_list - [in] Fonts to search for a match. All fonts in this list are tested (search time is proportional to font_list.Count()). If the list returned by GetInstalledFontFamily() contains reasonable options, it is a good choice for the font_list[] parameter. font_count - [in] Number of elements in the font_list[] array. Returns: A pointer to the font in font_list[] that is the best match to this.

◆ CleanFontName()

static const ON_String ON_Font::CleanFontName ( const wchar_t *  dirty_font_name,
ON_StringMapOrdinalType  map 
)
static

Parameters: dirty_font_name - [in] A UTF-16 or UTF-32 encoded null terminated string. map - [in] Map to apply Returns: The input name with all spaces and hyphens removed.

◆ CodePointGlyph()

const class ON_FontGlyph* ON_Font::CodePointGlyph ( ON__UINT32  unicode_code_point) const

Description: Returns the glyph informationh for used to render a specific code point Parameters: unicode_code_point UNICODE code point value Returns: Glyph rendering information.

Remarks: Typically the returned glyph uses is a single glyph 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.

Example: ON_Font* font = ...; unsigned int code_point = ...; const ON_FontGlyph* g = font->CodePointGlyph(code_point); if (nullptr != g ) { if ( g->SubstituteCount() > 0 ) { / complicate case - one of more substitutes must be rendered to render g for ( const ON_FontGlyph* gsub = g.NextSubstitute(); nullptr != gsub; gsub = gsub->NextSubstitute() ) { ... } } else { / simple case - this computer can directly render g ... } }

◆ CompareFontCharacteristics()

static int ON_Font::CompareFontCharacteristics ( const ON_Font lhs,
const ON_Font rhs 
)
static

Description: Compares the font face name, weight, style, stretch, underline, strikethrough, point size, and platform specific characteristics. Returns: -1: lhs characteristics < rhs characteristics 0: lhs characteristics = rhs characteristics +1: lhs characteristics > rhs characteristics Remarks: Use FontCharacteristicsHash() when every characteristic needs to be compared.

◆ CompareFontCharacteristicsForExperts()

static int ON_Font::CompareFontCharacteristicsForExperts ( bool  bComparePlatformSpecificCharacteristics,
bool  bIgnoreUnsetCharacteristics,
const ON_Font lhs,
const ON_Font rhs 
)
static

Description: Expert user tool to compares the font face name, weight, style, stretch, underline, and strikethrough characteristics. Additional parameters determine how unset and platform specific characteristics are compared.

Parameters: bComparePlatformSpecificCharacteristics - [in] If bComparePlatformSpecificCharacteristics is true, characteristics for the current platform are compared. Otherwise all platform specific characteristics are ignored. Platform specific characteristics include m_logfont_charset on Windows, and m_apple_font_name and m_apple_font_weight_trait on Mac OS.

bIgnoreUnsetCharacteristics - [in] If bIgnoreUnsetCharacteristics is true, unset characteristics are considered equal to any other value.

WARNING: When bIgnoredUnsetCharacteristic is true, this compare function is not a well ordering of ON_Font classes and cannot be used in sorting algorithms. For example, if A, B, C are fonts with weights A.FontWeight() = ON_Font::Weight::Normal, B.FontWeight() = ON_Font::Weight::Bold, C.FontWeight() = ON_Font::Weight::Unset, and all other settings identical, then A < B and A=C and B=C.

Returns: -1: lhs characteristics < rhs characteristics 0: lhs characteristics = rhs characteristics +1: lhs characteristics > rhs characteristics

◆ CompareFontName()

static int ON_Font::CompareFontName ( const ON_wString lhs,
const ON_wString rhs 
)
static

Description: Compare the font names ignoring hyphens, underbars, and spaces. Parameters: lhs - [in] font name to compare rhs - [in] font name to compare Returns: If ON_Font::FontNameHash(lsh,false) and ON_Font::FontNameHash(rsh,false) are equal, then 0 is returned. Otherwise ON_wString::CompareOrdinal(lhs,rhs,true) is returned. Remarks: Useful for sorting font names.

◆ CompareFontNamePointer()

static int ON_Font::CompareFontNamePointer ( const ON_wString lhs,
const ON_wString rhs 
)
static

Description: Compare the font names ignoring hyphens, underbars, and spaces. Parameters: lhs - [in] font name to compare rhs - [in] font name to compare Returns: If ON_Font::FontNameHash(lsh,false) and ON_Font::FontNameHash(rsh,false) are equal, then 0 is returned. Otherwise ON_wString::CompareOrdinal(lhs,rhs,true) is returned. Remarks: Useful for sorting font names.

◆ CompareFontNameToHyphen()

static int ON_Font::CompareFontNameToHyphen ( const ON_wString lhs,
const ON_wString rhs 
)
static

Description: Compare the font names ignoring hyphens, underbars, and spaces. Ignore portions of PostScript names after the hyphen that separates the font family and font face. Parameters: lhs - [in] font name to compare rhs - [in] font name to compare Returns: If ON_Font::FontNameHash(lsh,true) and ON_Font::FontNameHash(rsh,true) are equal, then 0 is returned. Otherwise ON_wString::CompareOrdinal(lhs,rhs,true) is returned. Remarks: Useful for sorting font names.

◆ CompareFontNameToHyphenPointer()

static int ON_Font::CompareFontNameToHyphenPointer ( const ON_wString lhs,
const ON_wString rhs 
)
static

Description: Compare the font names ignoring hyphens, underbars, and spaces. Ignore portions of PostScript names after the hyphen that separates the font family and font face. Parameters: lhs - [in] font name to compare rhs - [in] font name to compare Returns: If ON_Font::FontNameHash(lsh,true) and ON_Font::FontNameHash(rsh,true) are equal, then 0 is returned. Otherwise ON_wString::CompareOrdinal(lhs,rhs,true) is returned. Remarks: Useful for sorting font names.

◆ CompareFontNameToHyphenWideChar()

static int ON_Font::CompareFontNameToHyphenWideChar ( const wchar_t *  lhs,
const wchar_t *  rhs 
)
static

Description: Compare the font names ignoring hyphens, underbars, and spaces. Ignore portions of PostScript names after the hyphen that separates the font family and font face. Parameters: lhs - [in] font name to compare rhs - [in] font name to compare Returns: If ON_Font::FontNameHash(lsh,true) and ON_Font::FontNameHash(rsh,true) are equal, then 0 is returned. Otherwise ON_wString::CompareOrdinal(lhs,rhs,true) is returned. Remarks: Useful for sorting font names.

◆ CompareFontNameWideChar()

static int ON_Font::CompareFontNameWideChar ( const wchar_t *  lhs,
const wchar_t *  rhs 
)
static

Description: Compare the font names ignoring hyphens, underbars, and spaces. Parameters: lhs - [in] font name to compare rhs - [in] font name to compare Returns: If ON_Font::FontNameHash(lsh,false) and ON_Font::FontNameHash(rsh,false) are equal, then 0 is returned. Otherwise ON_wString::CompareOrdinal(lhs,rhs,true) is returned. Remarks: Useful for sorting font names.

◆ CompareWeight()

static int ON_Font::CompareWeight ( ON_Font::Weight  weight_a,
ON_Font::Weight  weight_b 
)
static

Returns: -1: weight_a is lighter, weight_b is heavier +1: weight_a is heavier, weight_b is lighter 0: weight_a = weight_b

◆ CRC32()

ON__UINT32 ON_Font::CRC32 ( bool  bIgnoreNameOrdinalCase) const

Description: Returns a 32-bit crc of the font weight, style, stretch, underline, strikethrough, and WIndows logfont name characteristics.

Parameters: bIgnoreWindowsLogfontNameOrdinalCase - [in] If true, ON_wString::MapStringOrdinal() is applied to the windows logfont name and the returned CRC is ordinal case independent.

◆ DefaultEngravingFont()

static const ON_Font* ON_Font::DefaultEngravingFont ( )
static

◆ DefaultFaceName()

static const wchar_t* ON_Font::DefaultFaceName ( )
static

Returns: Windows: "Regular" Apple: "Regular"

◆ DefaultFamilyName()

static const wchar_t* ON_Font::DefaultFamilyName ( )
static

Returns: Windows: "Arial" Apple: "Helvetica Neue"

◆ DefaultPostScriptName()

static const wchar_t* ON_Font::DefaultPostScriptName ( )
static

Returns: Windows: "ArialMT" Apple: "HelveticaNeue"

◆ DefaultWindowsLogfontName()

static const wchar_t* ON_Font::DefaultWindowsLogfontName ( )
static

Returns: Windows: "ArialMT" Apple: "HelveticaNeue"

◆ Description() [1/3]

const ON_wString ON_Font::Description ( ) const

Returns: A long description that includes family, face, weight, stretch and style information. Generally not useful for finding matching fonts. Remarks: Calls ON_Font.Description(ON_Font::NameLocale::localizeFirst, ON_wString::HyphenMinus,ON_wString::Space,true)

◆ Description() [2/3]

const ON_wString ON_Font::Description ( ON_Font::NameLocale  name_local,
wchar_t  family_separator,
wchar_t  weight_width_slope_separator,
bool  bIncludeUndelinedAndStrikethrough 
) const

Description: Get a text description with family weight, width (stretch), slope (style). Parameters: family_separator - [in] character to place after family name in the description. 0 = no separator. 0, ON_wSting::HyphenMinus, and ON_wString::Space are common choices. weight_width_slope_separator - [in] character to place bewtween weight, stretch, and style descriptions 0 = no separator. 0, ON_wSting::HyphenMinus, and ON_wString::Space are common choices. bIncludeUndelinedAndStrikethrough - [in] If true, underlined and strikethrough attributes are appended 0 = no separator. 0, ON_wSting::HyphenMinus, and ON_wString::Space are common choices. Returns: A font description with family name, weight, stretch, and style. If present, the weight, stretch, style, underlined, and strikethrough descriptions begin with a capital letter followed by lowercase letters. Remarks: A description similar to the PostScript name is returned by DescriptionFamilyWeightStretchStyle(ON_wString::HyphenMinus,0,false). However, this often differs from the actual PostScript name.

◆ Description() [3/3]

const ON_wString ON_Font::Description ( ON_Font::NameLocale  name_local,
wchar_t  family_separator,
wchar_t  weight_width_slope_separator,
bool  bIncludeUndelinedAndStrikethrough,
bool  bIncludeNotOnDevice 
) const

Description: Get a text description with family weight, width (stretch), slope (style). Parameters: family_separator - [in] character to place after family name in the description. 0 = no separator. 0, ON_wSting::HyphenMinus, and ON_wString::Space are common choices. weight_width_slope_separator - [in] character to place bewtween weight, stretch, and style descriptions 0 = no separator. 0, ON_wSting::HyphenMinus, and ON_wString::Space are common choices. bIncludeUndelinedAndStrikethrough - [in] If true, underlined and strikethrough attributes are appended 0 = no separator. 0, ON_wSting::HyphenMinus, and ON_wString::Space are common choices. bIncludeNotOnDevice - [in] If true and this->IsManagedSubstitutedFont() is true, then the returned string begins with "[Not on device]" followed by the font's description. Returns: A font description with family name, weight, stretch, and style. If present, the weight, stretch, style, underlined, and strikethrough descriptions begin with a capital letter followed by lowercase letters. Remarks: A description similar to the PostScript name is returned by DescriptionFamilyWeightStretchStyle(ON_wString::HyphenMinus,0,false). However, this often differs from the actual PostScript name.

◆ Dump()

void ON_Font::Dump ( ON_TextLog ) const

for debugging

◆ EqualFontCharacteristics()

static bool ON_Font::EqualFontCharacteristics ( const ON_Font lhs,
const ON_Font rhs 
)
static

Description: Compares the font weight, style, stretch, underline, strikethrough, linefeed_ratio and facename characteristics. Returns: 0 == ON_Font::CompareFontCharacteristics(lhs,rhs). Remarks: Use FontCharacteristicsHash() when every characteristic needs to be compared.

◆ EqualFontFamily()

static bool ON_Font::EqualFontFamily ( const ON_Font lhs,
const ON_Font rhs 
)
static

Returns: True if lhs an rhs are in the same font family.

◆ EqualFontFamilyAndFace()

static bool ON_Font::EqualFontFamilyAndFace ( const ON_Font lhs,
const ON_Font rhs 
)
static

Returns: True if lhs and rhs have equal family names and equal face names in with the name local or in English.

◆ EqualStretch()

static bool ON_Font::EqualStretch ( const ON_Font lhs,
const ON_Font rhs,
bool  bUnsetIsEqual 
)
static

◆ EqualStyle()

static bool ON_Font::EqualStyle ( const ON_Font lhs,
const ON_Font rhs,
bool  bUnsetIsEqual 
)
static

◆ EqualWeight()

static bool ON_Font::EqualWeight ( const ON_Font lhs,
const ON_Font rhs,
bool  bUnsetIsEqual 
)
static

◆ EqualWeightStretchStyle()

static bool ON_Font::EqualWeightStretchStyle ( const ON_Font lhs,
const ON_Font rhs,
bool  bUnsetIsEqual 
)
static

◆ FaceName() [1/2]

const ON_wString ON_Font::FaceName ( ) const

Returns: ON_Font::FaceName(ON_Font::NameLocale::LocalizedFirst)

◆ FaceName() [2/2]

const ON_wString ON_Font::FaceName ( ON_Font::NameLocale  name_locale) const

Returns: The font's face name. Remarks: Typically a font family has many faces and the face name gives a clue about the weight, stretch, and style of the face.

For example, Arial is a common font family that often includes faces like "Regular", "Bold", "Italic", "Bold Italic", "Narrow", "Narrow Bold", "Narrow Italic", "Narrow Bold Italic", "Black", and "Black Oblique".

Platform equivalents: Apple: = not available Windows: = IDWriteFontFamily.GetFaceNames()

NOTE WELL: This is NOT the Windows LOGFONT lfFaceName.

◆ FakeWindowsLogfontNameFromFamilyAndPostScriptNames()

static const ON_wString ON_Font::FakeWindowsLogfontNameFromFamilyAndPostScriptNames ( ON_wString  family_name,
ON_wString  postscript_name 
)
static

Description: On non-WIndows platforms like Mac OS, iOS, and Android, this function can be used to generate fake windows logfont names. For fonts that have at most 4 faces with the same stretch and variations in weight and slant, the family_name is a good choice. For fonts that have many faces, like Helvetica Neue on Mac OS, this function will generate names that act like a Windows LOGFONT name for use in archaic name + regular/bold/italic/bold-italic font selection user interfaces. Returns: A fake windows logfont name.

◆ FamilyName() [1/2]

const ON_wString ON_Font::FamilyName ( ) const

Returns: ON_Font::FamilyName(ON_Font::NameLocale::LocalizedFirst)

◆ FamilyName() [2/2]

const ON_wString ON_Font::FamilyName ( ON_Font::NameLocale  name_locale) const

Returns: The font's family name. Remarks: Typically a font family has many faces.

Platform equivalents: Apple: = CTFontCopyFamilyName(...) / NSFont.familyName Windows: = IDWriteFontFamily.GetFamilyNames()

NOTE WELL: This is NOT the Windows LOGFONT lfFaceName.

◆ FamilyNameFromDirtyName()

static const ON_wString ON_Font::FamilyNameFromDirtyName ( const wchar_t *  dirty_name)
static

Parameters: dirty_name - [in] A Windows GDI LOGFONT name or PostScript name. Returns: A family name

◆ FontCharacteristicsAsUnsigned()

unsigned int ON_Font::FontCharacteristicsAsUnsigned ( ) const

Description: The font properties weight, style, stretch, underlined, and strikethrough are encoded in the returned value. Remarks: This is a legacy value used in 3dm archive reading/writing and some sorting operations.

◆ FontCharacteristicsHash()

const class ON_SHA1_Hash& ON_Font::FontCharacteristicsHash ( ) const

Returns: 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.

Example: ON_Font f1 = ... ON_Font f2 = ... if ( f1.FontCharacteristicsHash() == f2.FontCharacteristicsHash() ) { / f1 and f2 have identical font characteristics } else { / f1 and f2 have different font characteristics }

◆ FontDescription()

const ON_wString& ON_Font::FontDescription ( ) const

◆ FontDescriptionAsPointer()

const wchar_t* ON_Font::FontDescriptionAsPointer ( ) const

◆ FontFaceName()

const wchar_t* ON_Font::FontFaceName ( ) const
Deprecated:
Use ON_Font::WindowsLogfontName(ON_Font::NameLocale)

◆ FontFromRichTextProperties()

static const ON_Font* ON_Font::FontFromRichTextProperties ( ON_wString  rich_text_font_name,
bool  bBoldQuartetMember,
bool  bItalicQuartetMember,
bool  bUnderlined,
bool  bStrikethrough 
)
static

Description: This is the best way to get a font from rich text properties. Parameters: rich_text_font_name - [in] Rich text quartet name. If you have an ON_Font, then ON_Font.RichTextName() gets a good choice for this name. For Windows installed fonts, this is identical to the Windows LOGFONT.lfFaceName. For MacOS this is an invented name and is chosen to work cross platform as well as possible. For Apple families with up to 4 faces that align with the rich text quartet "regular/bold/italic/bold-italic" faces, things tend to work as expected. for common Apple families like Helvetica Neue with a dozen or so faces that are designed to work well for western european languages, opennurbs selects 4 faces in the family that tend to align with would many people expect as the rich text "regular/bold/italic/bold-italic" face. Things get dicier with less common families and fonts designed for non-western european languages. Basically, Apple and richt text do not play nicely together.

bBoldQuartetMember - [in] True to select the heavier members of the rich text quartet.

bItalicQuartetMember - [in] True to select the more slanted memmers of the rich text quartet.

bUnderlined - [in] True if you want underlined text. (Underlining is created as a rendering effect and not a separate face.)

bStrikethrough - [in] True if you want strikethrough text. (Strikethrough is created as a rendering effect and not a separate face.)

Returns: If there is an installed font, it is returned. Otherwise a managed font is returned. When the managed font is not installed, the corresponding member of ON_Font::Default::InstalledQuartet() is used to render the font.

◆ FontMetrics()

const ON_FontMetrics& ON_Font::FontMetrics ( ) const

Returns: Normalized font metrics.

Remarks: 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 designed 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.

◆ FontNameHash()

static const ON_SHA1_Hash ON_Font::FontNameHash ( const wchar_t *  font_name,
bool  bStopAtHyphen 
)
static

Parameters: font_name - [in] A UTF-16 or UTF-32 encoded null terminated string. bStopAtHyphen - [in] If true, the hash calculation terminates at the first hyphen. This is useful when font_name is a PostScript name and you don't want to include face weight or style information in the hash.

For example, if bStopAtHyphen is true, then the four PostScript names "Calibri", "Calibri-Bold", "Calibri-Italic", and "Calibri-BoldItalic" have the same hash.

There are some fonts where a hyphen is an integral part of the font face name. Examples include "Arial-Black", "AvenirLT-Roman", "MecSoftFont-1", "MS-Gothic", "MS-PGothic", "MS-UIGothic", "SLF-RHN-Architect", "SLF-RHN-Industrial", "SLF-RHN-WhiteLiinen", and so on. These hyphens are exempt from the bStopAtHyphen check. Returns: A hash of the font_name parameter that ignores spaces, hyphens, underbars, and case. For example, the four names "Yu Gothic Regular", "YuGothic-Regular", "YUGOTHICREGULAR", and "yugothicregular" have the same FontNameHash(). The hash will be identical for UTF-16 and UTF-32 encodings.

◆ FontOrigin()

ON_Font::Origin ON_Font::FontOrigin ( ) const

Returns: Source of the information used to set the font characteristics. Unset = 0,

◆ FontOriginFromUnsigned()

static ON_Font::Origin ON_Font::FontOriginFromUnsigned ( unsigned int  unsigned_font_origin)
static

Description: 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. Parameters: unsigned_font_weight - [in]

◆ FontQuartet()

const ON_FontFaceQuartet ON_Font::FontQuartet ( ) const

Returns: If this font is installed or managed, the installed or mangaged font face quartet is returned. Otherwise ON_FontFaceQuartet::Empty is returned. Note that managed font quartets can be enlarged to include missing faces by calling ON_Font::FontFromRichTextProperties(). Installed font quartets exactly match what is installed on the current device. if this font is not a member of an installed face quartet.

◆ FontStretch()

ON_Font::Stretch ON_Font::FontStretch ( ) const

◆ FontStretchFromUnsigned()

static ON_Font::Stretch ON_Font::FontStretchFromUnsigned ( unsigned int  unsigned_font_stretch)
static

Description: 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. Parameters: unsigned_font_stretch - [in]

◆ FontStyle()

ON_Font::Style ON_Font::FontStyle ( ) const

Remarks: When working with rich text you want to use IsItalicInQuartet(). For fonts with a slanted regular face like Corsiva, ON_Font.FontStyle() = ON_Font::Style::Italic, ON_Font.IsItalic() = true, and ON_Font.IsItalicInQuartet() = false.

◆ FontStyleFromUnsigned()

static ON_Font::Style ON_Font::FontStyleFromUnsigned ( unsigned int  unsigned_font_style)
static

Description: 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. Parameters: unsigned_font_style - [in]

◆ FontUnitFontMetrics()

const ON_FontMetrics& ON_Font::FontUnitFontMetrics ( ) const

Description: This function is for expert users doing something complicated. Returns: Font metrics read directly from the font definition with no or minimal scaling. Remarks: See ON_Font.FontMetrics() documentation for important information about the difference between normalized and font unit metrics.

◆ FontUnitToNormalizedScale()

double ON_Font::FontUnitToNormalizedScale ( ) const

Returns: scale to apply when converting from a FT_LOAD_NO_SCALE FreeType glyph metric or outline to normalized opennurbs font coordinates.

◆ FontWeight()

ON_Font::Weight ON_Font::FontWeight ( ) const

◆ FontWeightFromUnsigned()

static ON_Font::Weight ON_Font::FontWeightFromUnsigned ( unsigned int  unsigned_font_weight)
static

Description: 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. Parameters: unsigned_font_weight - [in]

◆ GetInstalledFontFamily()

static unsigned int ON_Font::GetInstalledFontFamily ( const wchar_t *  font_family_name,
ON_SimpleArray< const ON_Font * > &  installed_fonts 
)
static

Parameters: font_family_name - [in] A font family name like Arial or Helvetica. bIncludePartialMatch - [in] If true, family names that begin with font_family_name will be included. installed_fonts - [out] A list of all fonts available on the current computer with a matching font family name. Returns: Number of fonts available on the current computer.

◆ GetInstalledFontList()

static unsigned int ON_Font::GetInstalledFontList ( ON_SimpleArray< const ON_Font * > &  installed_fonts)
static

Parameters: installed_fonts - [out] A list of all fonts available on the current computer sorted by font family name. Returns: Number of fonts available on the current computer.

◆ GetManagedFont() [1/11]

static const ON_Font* ON_Font::GetManagedFont ( const ON_Font font_characteristics,
bool  bCreateIfNotFound 
)
static

◆ GetManagedFont() [2/11]

static const ON_Font* ON_Font::GetManagedFont ( const wchar_t *  face_name)
static

Description: Get a font managed by the application from the font characteristics. Never delete a font returned by GetManagedFont(). Parameters: 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

◆ GetManagedFont() [3/11]

static const ON_Font* ON_Font::GetManagedFont ( const wchar_t *  face_name,
bool  bBold 
)
static

◆ GetManagedFont() [4/11]

static const ON_Font* ON_Font::GetManagedFont ( const wchar_t *  face_name,
bool  bBold,
bool  bItalic 
)
static

◆ GetManagedFont() [5/11]

static const ON_Font* ON_Font::GetManagedFont ( const wchar_t *  face_name,
ON_Font::Weight  font_weight,
ON_Font::Style  font_style 
)
static

◆ GetManagedFont() [6/11]

static const ON_Font* 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

◆ GetManagedFont() [7/11]

static const ON_Font* ON_Font::GetManagedFont ( double  point_size,
const wchar_t *  face_name 
)
static

◆ GetManagedFont() [8/11]

static const ON_Font* ON_Font::GetManagedFont ( double  point_size,
const wchar_t *  face_name,
bool  bBold 
)
static

◆ GetManagedFont() [9/11]

static const ON_Font* ON_Font::GetManagedFont ( double  point_size,
const wchar_t *  face_name,
bool  bBold,
bool  bItalic 
)
static

◆ GetManagedFont() [10/11]

static const ON_Font* ON_Font::GetManagedFont ( double  point_size,
const wchar_t *  face_name,
ON_Font::Weight  font_weight,
ON_Font::Style  font_style 
)
static

◆ GetManagedFont() [11/11]

static const ON_Font* 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

◆ GetManagedFontFromAppleFontName() [1/2]

static const ON_Font* ON_Font::GetManagedFontFromAppleFontName ( const char *  postscript_name)
static

◆ GetManagedFontFromAppleFontName() [2/2]

static const ON_Font* ON_Font::GetManagedFontFromAppleFontName ( const wchar_t *  postscript_name)
static

◆ GetManagedFontFromFontDescription()

static const ON_Font* ON_Font::GetManagedFontFromFontDescription ( const wchar_t *  font_description)
static

◆ GetManagedFontFromPostScriptName() [1/2]

static const ON_Font* ON_Font::GetManagedFontFromPostScriptName ( const char *  postscript_name)
static

Parameters: postscript_name - [in] Windows: PostScript name = IDWriteFont.GetInformationalStrings(DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_NAME,...) Apple: PostScript name = CTFontCopyPostScriptName() / NSFont.fontName

◆ GetManagedFontFromPostScriptName() [2/2]

static const ON_Font* ON_Font::GetManagedFontFromPostScriptName ( const wchar_t *  postscript_name)
static

Parameters: postscript_name - [in] Windows: PostScript name = IDWriteFont.GetInformationalStrings(DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_NAME,...) Apple: PostScript name = CTFontCopyPostScriptName() / NSFont.fontName

◆ GetManagedFontFromSerialNumber()

static const ON_Font* ON_Font::GetManagedFontFromSerialNumber ( unsigned int  managed_font_runtime_serial_number)
static

Returns: If there is a managed font with the specified serial number, it is returned. Otherwise, nullptr is returned.

◆ GetManagedFontList()

static unsigned int ON_Font::GetManagedFontList ( ON_SimpleArray< const ON_Font * > &  managed_fonts)
static

Parameters: managed_fonts - [out] The current list of managed fonts. Returns: Number of managed fonts.

◆ GetRunBounds()

static void ON_Font::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

◆ GetStrikeoutPosition()

int ON_Font::GetStrikeoutPosition ( ) const
Deprecated:
Use FontMetrics().StrikeoutPosition()

◆ GetStrikeoutSize()

int ON_Font::GetStrikeoutSize ( ) const
Deprecated:
Use FontMetrics().StrikeoutThickness()

◆ GetUnderscorePosition()

int ON_Font::GetUnderscorePosition ( ) const
Deprecated:
Use FontMetrics().UnderscorePosition()

◆ GetUnderscoreSize()

int ON_Font::GetUnderscoreSize ( ) const
Deprecated:
Use FontMetrics().UnderscoreThickness()

◆ HasUnsetProperties()

bool ON_Font::HasUnsetProperties ( bool  bCheckFamilyName,
bool  bCheckPostScriptName 
) const

Parameters: bCheckFamilyName - [in] bCheckPostScriptName - [in] Returns: True if any of LOGFONT face name is empty. True if any of weight, stretch, or style is unset. True if bCheckFamilyName is true and FamilyName() is empty. True if bCheckPostScriptName is true and PostScriptName() is empty. False otherwise.

◆ HeightOfI()

int ON_Font::HeightOfI ( ) const
Deprecated:
Use FontMetrics().AscentOfCapital()

◆ HeightOfLinefeed()

int ON_Font::HeightOfLinefeed ( ) const
Deprecated:
Use FontMetrics().LineSpace()

◆ HeightScale()

double ON_Font::HeightScale ( double  text_height) const
Deprecated:
Use FontMetrics().GlyphScale()

◆ InstalledFamilyMemberWithWeightStretchStyle()

const ON_Font* ON_Font::InstalledFamilyMemberWithWeightStretchStyle ( ON_Font::Weight  desired_weight,
ON_Font::Stretch  desired_stretch,
ON_Font::Style  desired_style 
) const

Parameters: desired_weight - [in] Pass ON_Font::Weight::Unset if you do not want to change the weight. desired_stretch - [in] Pass ON_Font::Stretch::Unset if you do not want to change the stretch. desired_style - [in] Pass ON_Font::Style::Unset if you do not want to change the style.

Returns: The installed font in the same family as this with the best match for the desired weight, stretch, and style. If nothing close to suitable is available, nullptr is returned.

◆ InstalledFont()

const ON_Font* ON_Font::InstalledFont ( bool  bAllowBestMatch) const

Description: Look for a font installed on the current device that matches this font. The Strikethrough, Underlined, and PointSize properties are ignored. Parameters: bAllowBestMatch - [in] If no exact match is available and bAllowBestMach is true and there are installed fonts with a matching family name, then the best match in the family is returned. Returns: If there is a matching installed font, it is returned. Otherwise, nullptr is returned.

◆ InstalledFontFromRichTextProperties()

static const ON_Font* ON_Font::InstalledFontFromRichTextProperties ( const wchar_t *  rtf_font_name,
bool  bRtfBold,
bool  bRtfItalic 
)
static

Description: Unless you are certain you want to restrict your choices to installed fonts, it is better to call ON_Font::FontFromRichTextProperties(). Parameters: rtf_font_name - [in] Rich text quartet neame. This name is not well defined and depends on the device and application that created the rich text. For Windows installed fonts, this is identical to the Windows LOGFONT.lfFaceName. On MacOS this is a name Rhino cooks up and is chosen to work cross platform as well as possible. Apple and richt text do not play nicely together. bRtfBold - [in] True to prefer the heavier memmbers of the installed rich text quartet. bRtfItalic - [in] True to prefer the more slanted memmbers of the installed rich text quartet. Returns: An installed font to use for this rich text face font or nullptr if the current device does not have a in installed font with for this rich text quartet.

◆ InstalledFontList()

static const class ON_FontList& ON_Font::InstalledFontList ( )
static

Returns: The list of installed fonts in a class with lots of searching tools.

◆ InstalledFontQuartet()

const ON_FontFaceQuartet ON_Font::InstalledFontQuartet ( ) const

Returns: The installed font face quartet for this font or ON_FontFaceQuartet::Empty if this font is not a member of an installed face quartet.

◆ IsBold()

bool ON_Font::IsBold ( ) const

Description: User interfaces that want to provide a name + regular/bold/italic/bold-italic font finder must use IsBoldInQuartet() and IsItalicInQuartet().

This function looks at weight the font designer assigned to the font. This is an unreliable way to determine if a font is "light/regular/bold" compared to other faces in its font family.

Returns: True if heavier than ON_Font::Weight::Medium.

Remarks: Just in case you didn't read the description, ON_Font.IsBold() is a terrible way to decide if a font is "bold" in a quartet (regular,bold,italic,bold-italic). Use ON_Font.QuartetFaceMember()

◆ IsBoldInQuartet()

bool ON_Font::IsBoldInQuartet ( ) const

Returns: True if this font is considered a bold member in its installed font ON_FontFaceQuartet. Remarks: In a traditional regular/bold/italic/bold-italic font face interfaces, "bold" is relative to the quartet members and cannot be determined by inspecting the numerical value of the font's weight. For example, Arial Black has a weight of 900=ON_FontWeight::Weight::Heavy, but the Arial Black quartet has only two faces, regular and italic. In quartets for fonts with a simulated bold, like AvenirLT-Roman, the bold member often has a LOGFONT weight of 551 < SemiBold = 600. The Windows AvenirLT-Roman quartet has four faces and the bold faces in the quartet have weights 551.

◆ IsBoldWeight()

static bool ON_Font::IsBoldWeight ( ON_Font::Weight  weight)
static

Returns: True if weight is ON_Font::Weight::Semibold or heavier.

◆ IsDoubleStrokeFont()

bool ON_Font::IsDoubleStrokeFont ( ) const

Returns: True if this is a known double stroke font. False otherwise. See Also: IsEngravingFont()

◆ IsEngravingFont()

bool ON_Font::IsEngravingFont ( ) const

Description: The outlines for an engraving font have single-stroke, double-stroke, or perimeters designed for path engraving. These fonts behave poorly when used for filled font rendering or creating solid extrusions. The OrachTech 2 line fonts are examples of engraving fonts that are not single or double stroke. Returns: True if the font is a known engraving font.

◆ IsInstalledFont()

bool ON_Font::IsInstalledFont ( ) const

Returns: True if this font is a mangaged font with a face that is installed on the current device or this is an installed font returned by a function like ON_Font::InstalledFont(), ON_Font::GetInstalledFontFamily(), or ON_Font::GetInstalledFontList(). False in all other cases.

◆ IsItalic()

bool ON_Font::IsItalic ( ) const

Description: If is better to use IsItalicInQuartet().

Returns: true if FontStyle() is ON_Font::Style::Italic. false if FontStyle() is ON_Font::Style::Upright or .ON_Font::Style::Oblique. Remarks: When working with rich text you want to use IsItalicInQuartet(). For fonts with a slanted regular face like Corsiva, ON_Font.FontStyle() = ON_Font::Style::Italic, ON_Font.IsItalic() = true, and ON_Font.IsItalicInQuartet() = false.

◆ IsItalicInQuartet()

bool ON_Font::IsItalicInQuartet ( ) const

Returns: True if this font is considered an italic member in its installed font ON_FontFaceQuartet. Remarks: When working with rich text you want to use IsItalicInQuartet(). For fonts with a slanted regular face like Corsiva, ON_Font.FontStyle() = ON_Font::Style::Italic, ON_Font.IsItalic() = true, and ON_Font.IsItalicInQuartet() = false.

◆ IsItalicOrOblique()

bool ON_Font::IsItalicOrOblique ( ) const

Returns: true if FontStyle() is ON_Font::Style::Italic or is ON_Font::Style::Oblique. Otherwise false. Remarks: When working with rich text you want to use IsItalicInQuartet(). For fonts with a slanted regular face like Corsiva, ON_Font.FontStyle() = ON_Font::Style::Italic, ON_Font.IsItalic() = true, and ON_Font.IsItalicInQuartet() = false.

◆ IsLight()

bool ON_Font::IsLight ( ) const

Description: User interfaces that want to provide a name + regular/bold/italic/bold-italic font finder must use IsBoldInQuartet() and IsItalicInQuartet().

This function looks at weight the font designer assigned to the font. This is an unreliable way to determine if a font is "light/regular/bold" compared to other faces in its font family.

Returns: True if FontWeight() is lighter than ON_Font::Weight::Normal

◆ IsManagedFont()

bool ON_Font::IsManagedFont ( ) const

Returns: True if this font is a managed font returned by one of the static ON_Font::GetManagedFont(...) functions. Remarks: ON_Font::Default is managed.

◆ IsManagedInstalledFont()

bool ON_Font::IsManagedInstalledFont ( ) const

Returns: True if this is a managed font and the font is installed on this device. False otherwise. Remarks: If this->IsManagedFont() is true, then exactly one of IsManagedInstalledFont() or IsManagedSubstitutedFont() is true. When this->IsManagedInstalledFont() is true, this->InstalledFont() returns the installed font.

◆ IsManagedSubstitutedFont()

bool ON_Font::IsManagedSubstitutedFont ( ) const

Returns: True if this font is a managed font that references a font that is not installed on this computer. Remarks: If this->IsManagedFont() is true, then exactly one of IsManagedInstalledFont() or IsManagedSubstitutedFont() is true. When this->IsManagedSubstitutedFont() is true, this->SubstituteFont() returns the installed font.

◆ IsNormalWeight()

bool ON_Font::IsNormalWeight ( ) const

Description: User interfaces that want to provide a name + regular/bold/italic/bold-italic font finder must use IsBoldInQuartet() and IsItalicInQuartet().

This function looks at weight the font designer assigned to the font. This is an unreliable way to determine if a font is "light/regular/bold" compared to other faces in its font family.

Returns: True if FontWeight() is ON_Font::Normal or ON_Font::Weight::Medium

◆ IsNotAppleFontName()

static bool ON_Font::IsNotAppleFontName ( const wchar_t *  font_description)
static

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.

◆ IsOblique()

bool ON_Font::IsOblique ( )

ERROR - missing const.

Returns: true if FontStyle() is ON_Font::Style::Oblique. false if FontStyle() is ON_Font::Style::Upright or .ON_Font::Style::Italic. Remarks: When working with rich text you want to use IsItalicInQuartet(). For fonts with a slanted regular face like Corsiva, ON_Font.FontStyle() = ON_Font::Style::Italic, ON_Font.IsItalic() = true, and ON_Font.IsItalicInQuartet() = false.

◆ IsSimulated()

bool ON_Font::IsSimulated ( ) const

Returns: True if the font face is simulated in some way

◆ IsSingleStrokeFont()

bool ON_Font::IsSingleStrokeFont ( ) const

Returns: True if this is a known single stroke font. False otherwise. See Also: IsEngravingFont()

◆ IsSingleStrokeOrDoubleStrokeFont()

bool ON_Font::IsSingleStrokeOrDoubleStrokeFont ( ) const

Returns: True if this is a known single stroke or double stroke font. False otherwise. See Also: IsEngravingFont()

◆ IsStrikethrough()

bool ON_Font::IsStrikethrough ( ) const

◆ IsSymbolFont()

bool ON_Font::IsSymbolFont ( ) const

Returns: True if the font is a symbol font. Typically this means that there is no meaningful correspondence between public use UNICODE codepoints and glyphs. Remarks: The Linguist's Software fonts (circa 1997) with the family names CityBlueprint CountryBlueprint Romantic Technic are classified as symbol fonts but have reasonable glyphs for most ASCII codepoints.

◆ IsUnderlined()

bool ON_Font::IsUnderlined ( ) const

◆ IsUpright()

bool ON_Font::IsUpright ( ) const

Returns: true if FontStyle() is ON_Font::Style::Upright. false if FontStyle() is ON_Font::Style::Italic or .ON_Font::Style::Oblique. Remarks: When working with rich text you want to use IsItalicInQuartet(). For fonts with a slanted regular face like Corsiva, ON_Font.FontStyle() = ON_Font::Style::Italic, ON_Font.IsItalic() = true, and ON_Font.IsItalicInQuartet() = false.

◆ IsValid()

bool ON_Font::IsValid ( ON_TextLog text_log = nullptr) const

Description: Tests an object to see if its data members are correctly initialized. Parameters: 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. Returns: @untitled table true object is valid false object is invalid, uninitialized, etc.

◆ IsValidFaceName()

static bool ON_Font::IsValidFaceName ( const wchar_t *  face_name)
static

Description: This function is poorly designed, poorly named, named and doesn't do anything very useful. Avoid it. It will be deleted when it is possible to break the SDK. Parameters: face_name - [in] Name to test Returns: False if face_name is nullptr, or face_name is the empty string, or the first element in the name is < ON_wString::Space, or the face_name contains any of these elements: ; " ' ` = # True otherwise.

◆ IsValidPointSize()

static bool ON_Font::IsValidPointSize ( double  point_size)
static

◆ LinefeedRatio()

double ON_Font::LinefeedRatio ( ) const

◆ Locale()

const ON_wString ON_Font::Locale ( ) const

BUSTED #pragma endregion.

Returns: Locale for the font localized font names.

◆ LogfontCharSet()

unsigned char ON_Font::LogfontCharSet ( ) const

◆ ManagedFamilyMemberWithRichTextProperties()

const ON_Font* ON_Font::ManagedFamilyMemberWithRichTextProperties ( bool  bBold,
bool  bItalic,
bool  bUnderlined,
bool  bStrikethrough 
) const

Parameters: bBold - [in] True for the rich text quartet "bold face" with is typically heavier than the "regular" face. bItalic - [in] True for the rich text quartet "italic" with is typically more slanted than the "regular" face. bUnderlined - [in] True for an underlined face bStrikethrough - [in] True for a strikethrough face Returns: ON_Font::ManagedFontFromRichTextProperties(this->RichTextName(),bBold,bItalic,bUnderlined,bStrikethrough);

◆ ManagedFamilyMemberWithWeightStretchStyle()

const ON_Font* ON_Font::ManagedFamilyMemberWithWeightStretchStyle ( ON_Font::Weight  desired_weight,
ON_Font::Stretch  desired_stretch,
ON_Font::Style  desired_style,
bool  bUnderlined,
bool  bStrikethrough 
) const

Parameters: desired_weight - [in] Pass ON_Font::Weight::Unset if you do not want to change the weight. desired_stretch - [in] Pass ON_Font::Stretch::Unset if you do not want to change the stretch. desired_style - [in] Pass ON_Font::Style::Unset if you do not want to change the style. bUnderlined - [in] bStrikethrough - [in]

Returns: The installed font in the same family as this with the best match for the desired weight, stretch, and style. If nothing close to suitable is available, nullptr is returned.

◆ ManagedFont()

const ON_Font* ON_Font::ManagedFont ( ) const

#if defined(ON_RUNTIME_APPLE_OBJECTIVE_C_AVAILABLE) static const ON_Font* GetManagedFontFromAppleNSFont( NSFont* apple_font, bool bAnnotationFont ); endif Returns: The managed font for this font. Remarks: If this->IsManagedFont() is true, then "this" is returned.

◆ ManagedFontFromRichTextProperties()

static const ON_Font* ON_Font::ManagedFontFromRichTextProperties ( const wchar_t *  rtf_font_name,
bool  bRtfBold,
bool  bRtfItalic,
bool  bRftUnderlined,
bool  bRftStrikethrough 
)
static

Description: It is better to call ON_Font::FontFromRichTextProperties(). Parameters: rtf_font_name - [in] Rich text format name. This name is not well defined and depends on the device and application that created the rich text. On Windows this is often a LOGFONT.lfFaceName. On MacOS it is often a PostScript name.

bRtfBold - [in] RTF bold flag

bRtfItalic - [in] RTF italic flag Returns: A managed font to use for these rich text properties.

Deprecated:
Call ON_Font::FontFromRichTextProperties()

◆ ManagedFontList()

static const class ON_FontList& ON_Font::ManagedFontList ( )
static

Returns: The list of managed fonts in a class with lots of searching tools.

◆ ManagedFontSerialNumber()

unsigned int ON_Font::ManagedFontSerialNumber ( ) const

Description: Two ON_Font classes reference the same platform font and create identical glyphs if and only if the have the same ManagedFontSerialNumber(). Returns: 0: This font is unset. >= 1: Serial number of the managed font with the same characteristics. Remark: For managed fonts other than ON_Font::Default, the value of ManagedFontSerialNumber() typically varies between instances of the same application. Different platforms and application versions may use different font faces for ON_Font::Default. If an ON_Font is a managed font, then RuntimeSerialNumber() and ManagedFontSerialNumber() are identical. If an ON_Font is not a managed font, then RuntimeSerialNumber() is zero.

◆ NormalizedToFontUnitScale()

double ON_Font::NormalizedToFontUnitScale ( ) const

Returns: scale to apply when converting from a FT_LOAD_NO_SCALE FreeType glyph metric or outline to normalized opennurbs font coordinates.

◆ operator=()

ON_Font& ON_Font::operator= ( const ON_Font src)

◆ OutlineFigureType()

ON_OutlineFigure::Type ON_Font::OutlineFigureType ( ) const

Returns: If the outline figure type is known for certain, it is returned. Otherwise, ON_OutlineFigure::Type::Unknown is returned.

◆ PANOSE1()

const ON_PANOSE1 ON_Font::PANOSE1 ( ) const

◆ PointSize()

double ON_Font::PointSize ( ) const

Returns: Font character height in points (1 point = 1/72 inch).

See the remarks for a definition of "character height".

Remarks: 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 height".

Font internal leading is the space above typical capital latin letters that is reserved for diacritical marks like the ring above the A in the UNICODE "LATIN LETTER A WITH RING" U+00C5 glyph (Angstrom symbol).

◆ PostScriptName() [1/2]

const ON_wString ON_Font::PostScriptName ( ) const

Returns: ON_Font::PostScriptName(ON_Font::NameLocale::LocalizedFirst)

◆ PostScriptName() [2/2]

const ON_wString ON_Font::PostScriptName ( ON_Font::NameLocale  name_locale) const

Returns: The font's PostScript name. Remarks: The PostScript name is not always unique for each face. For example, OpenType variable fonts like Windows 10 Bahnschrift have "Bahnschrift" as the PostScript name for at least 10 different Bahnschrift faces.

Platform equivalents: Apple: = CTFontCopyPostScriptName(...) / NSFont.fontName Windows: = IDWriteFont.GetInformationalStrings(DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_NAME,...)

◆ PostScriptNameAsPointer()

const wchar_t* ON_Font::PostScriptNameAsPointer ( ) const

Returns: A pointer for immediate use in formatted printing as in FormattedPrint(L"PostScript name = \"&ls"
",font.PostScriptNameAsPointer()); Remarks: WARNING: Do not save this pointer for later use. It points to memory in a dynamic string.

◆ QuartetDescription()

const ON_wString ON_Font::QuartetDescription ( ) const

Description: Get a string like "Arial (Regular)" that describes this font's quartet. Returns: quartet name + (face)

◆ QuartetFaceMember()

ON_FontFaceQuartet::Member ON_Font::QuartetFaceMember ( ) const

Returns: If known, this font's quartet face (regular, bold, italic, bold-italic). Otherwise ON_FontFaceQuartet::Member::Unset Remarks: For Windows installed fonts, the LOGFONT partition determines the quartet face. On Apple platforms, opennurbs uses a table for common fonts and leaves the rest unset. When unset, this is the best way to determine which quartet member this font represents. In all cases, the absolute weight or the ON_Font.IsBold() is unreliable and should be avoided at all costs.

◆ QuartetName() [1/2]

const ON_wString ON_Font::QuartetName ( ) const

Returns: Name of the quartet for this font. See ON_FontFaceQuartet for more details.

◆ QuartetName() [2/2]

const ON_wString ON_Font::QuartetName ( ON_Font::NameLocale  name_locale) const

Returns: Name of the quartet for this font. See ON_FontFaceQuartet for more details.

◆ Read()

bool ON_Font::Read ( ON_BinaryArchive )

restore definition from binary archive

◆ ReadV5()

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.

◆ RichTextFontName() [1/2]

const ON_wString ON_Font::RichTextFontName ( ) const

Returns: ON_Font::RichTextFontName(this,false); Remarks: For Windows installed fonts, this is identical to the Windows LOGFONT name. For Apple platforms and rich text quartet names do not play nicely together.

◆ RichTextFontName() [2/2]

static const ON_wString ON_Font::RichTextFontName ( const ON_Font font,
bool  bDefaultIfEmpty 
)
static

Parameters: font - [in] bDefaultIfEmpty - [in] If true and font is nullptr or has empty names, then the rich text font name for ON_Font::Default is returned, Returns: Font name to use in rich text file fonttbl sections. {\fonttbl...{\fN <RichTextFontName>;}...}

◆ RichTextPropertiesToString() [1/3]

static const ON_wString ON_Font::RichTextPropertiesToString ( bool  bRtfBold,
bool  bRtfItalic,
bool  bRtfUnderlined,
bool  bRtfStrikethrough 
)
static

◆ RichTextPropertiesToString() [2/3]

static const ON_wString ON_Font::RichTextPropertiesToString ( const ON_Font font)
static

◆ RichTextPropertiesToString() [3/3]

static const ON_wString ON_Font::RichTextPropertiesToString ( ON_Font::Weight  rtf_weight,
ON_Font::Style  rtf_style,
bool  bRtfUnderlined,
bool  bRtfStrikethrough 
)
static

◆ RichTextPropertyDeviation() [1/2]

static unsigned int ON_Font::RichTextPropertyDeviation ( bool  bPreferedRtfBold,
bool  bPreferedItalic,
bool  bPreferedUnderline,
bool  bPreferedStrikethrough,
bool  bAvailableRtfBold,
bool  bAvailableItalic,
bool  bAvailableUnderline,
bool  bAvailableStrikethrough 
)
static

◆ RichTextPropertyDeviation() [2/2]

static unsigned int ON_Font::RichTextPropertyDeviation ( bool  bPreferedRtfBold,
bool  bPreferedItalic,
bool  bPreferedUnderline,
bool  bPreferedStrikethrough,
const ON_Font available_font 
)
static

◆ RuntimeSerialNumber()

unsigned int ON_Font::RuntimeSerialNumber ( ) const

Returns: 0: This is not a managed font. 1: This is the managed font ON_Font::Default. >= 2: This is a managed font other than ON_Font::Default. Remark: For managed fonts other than ON_Font::Default, the value of RuntimeSerialNumber() typically varies between instances of the same application. Different platforms and application versions may use different font faces for ON_Font::Default. If an ON_Font is a managed font, then RuntimeSerialNumber() and ManagedFontSerialNumber() are identical. If an ON_Font is not a managed font, then RuntimeSerialNumber() is zero.

◆ SetAppleFontWeightTrait()

bool ON_Font::SetAppleFontWeightTrait ( double  apple_font_weight_trait)

Description: Don't use this old function. Higher quality font information is created by SetFromAppleFont() and SetFromWindowsDWriteFont(). NOTE WELL: Changing the weight requires updating the Family, Face, PostScript and Windows LOGFONT names as well.

◆ SetAppleWeightOfFont()

bool ON_Font::SetAppleWeightOfFont ( int  apple_weight_of_font)

Description: Don't use this old function. Higher quality font information is created by SetFromAppleFont() and SetFromWindowsDWriteFont(). NOTE WELL: Changing the weight requires updating the Family, Face, PostScript and Windows LOGFONT names as well.

◆ SetCustomMeasurementFunctions()

static void ON_Font::SetCustomMeasurementFunctions ( ON_GetGlyphMetricsFuncType  measureGlyphFunc,
ON_GetFontMetricsFuncType  metricsFunction 
)
static

◆ SetFamilyName()

bool ON_Font::SetFamilyName ( const wchar_t *  family_name)

Parameters: family_name - [in] The font family name.

This a name like "Arial". It is NOT a name like ArialMT, Arial-..., "Arial Black", "Arial Narrow", ... Generally, family names do NOT contain word that specify weight (Bold, Light, Heavy, ...), width (Medium, Condensed, ...), or slope (Oblique, Italic, Upright). Generally, family names do NOT contain hyphens (like thos in PostScript names).

Apple: = CTFontCopyFamilyName() / NSFont.familyName Windows: = IDWriteFontFamily.GetFamilyNames() NOTE WELL: GDI LOGFONT.lfFaceName is NOT a font family name.

https://blogs.msdn.microsoft.com/text/2009/04/15/introducing-the-directwrite-font-system/

◆ SetFontCharacteristics() [1/6]

bool ON_Font::SetFontCharacteristics ( const wchar_t *  gdi_logfont_name,
bool  bBold,
bool  bItalic,
bool  bUnderlined,
bool  bStrikethrough 
)

Description: Create a font with a specified facename and properties. Parameters: gdi_logfont_name - [in] Windows LOGFONT.lfFaceName. bBold - [in] True for a bold version of the font. bItalic - [in] True for an italic version of the font. Returns: True if the font characteristics were valid and set on the font.

◆ SetFontCharacteristics() [2/6]

bool ON_Font::SetFontCharacteristics ( const wchar_t *  gdi_logfont_name,
ON_Font::Weight  font_weight,
ON_Font::Style  font_style,
ON_Font::Stretch  font_stretch,
bool  bUnderlined,
bool  bStrikethrough 
)

Description: Set the font's face name and characteristics. Parameters: gdi_logfont_name - [in] Windows LOGFONT.lfFaceName value. Returns: True if the font characteristics were valid and set on the font.

◆ SetFontCharacteristics() [3/6]

bool ON_Font::SetFontCharacteristics ( const wchar_t *  gdi_logfont_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 
)

◆ SetFontCharacteristics() [4/6]

bool ON_Font::SetFontCharacteristics ( double  point_size,
const wchar_t *  gdi_logfont_name,
bool  bBold,
bool  bItalic,
bool  bUnderlined,
bool  bStrikethrough 
)

Description: Create a font with a specified facename and properties. Parameters: 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] Windows LOGFONT.lfFaceName value. bBold - [in] True for a bold version of the font. bItalic - [in] True for an italic version of the font. Returns: True if the font characteristics were valid and set on the font.

◆ SetFontCharacteristics() [5/6]

bool ON_Font::SetFontCharacteristics ( double  point_size,
const wchar_t *  gdi_logfont_name,
ON_Font::Weight  font_weight,
ON_Font::Style  font_style,
ON_Font::Stretch  font_stretch,
bool  bUnderlined,
bool  bStrikethrough 
)

◆ SetFontCharacteristics() [6/6]

bool ON_Font::SetFontCharacteristics ( double  point_size,
const wchar_t *  gdi_logfont_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 
)

◆ SetFontCharacteristicsForExperts()

bool ON_Font::SetFontCharacteristicsForExperts ( double  point_size,
const ON_wString  postscript_name,
const ON_wString  quartet_name,
ON_FontFaceQuartet::Member  quartet_member,
const ON_wString  family_name,
const ON_wString  face_name,
ON_Font::Weight  font_weight,
ON_Font::Style  font_style,
ON_Font::Stretch  font_stretch,
bool  bUnderlined,
bool  bStrikethrough,
unsigned char  logfont_charset,
int  windows_logfont_weight,
double  apple_font_weight_trait,
ON_PANOSE1  panose1 
)

◆ SetFontDescriptionForExperts()

bool ON_Font::SetFontDescriptionForExperts ( const wchar_t *  ignored_parameter)
Deprecated:
V6 ON_Font does not have a description property.

◆ SetFontFaceName()

bool ON_Font::SetFontFaceName ( const wchar_t *  windows_logfont_name)

Description: This is a legacy function that traces it's heritage to Windows specific GDI LOGFONT code from 1995. Best to avoid it whenever possible. Ideally, use an Windows IDWriteFont or Apple CTFont to create an ON_Font that references an installed font. Less ideally, use a complete LOGFONT structure. Parameters: windows_logfont_name - [in] GDI LOGFONT.lfFaceName value. Note well: This is not the font "face name", not the font "family name", and not the font PostScript name. It is often a combination of the family name, an additional "GDI sub-family" name. Occasionally it includes some face weight and style attributes. Returns: True if the value was set.

Deprecated:
Use ON_Font::SetFromDWriteFont(), ON_Font::SetFromAppleFont(), or ON_Font::SetFromWindowsLogFont()

◆ SetFontOrigin()

void ON_Font::SetFontOrigin ( ON_Font::Origin  font_origin)

◆ SetFontStretch()

bool ON_Font::SetFontStretch ( ON_Font::Stretch  font_stretch)

Description: Don't use this old function. If you have a font and want a face in the same famliy with a different stretch, then call InstalledFamilyMemberWithWeightStretchStyle(nullptr,desired_stretch,unset).

NOTE WELL: Changing the stretch requires updating the Family, Face, PostScript and Windows LOGFONT names as well.

◆ SetFontStyle()

bool ON_Font::SetFontStyle ( ON_Font::Style  font_style)

Description: Don't use this old function. If you have a font and want a face in the same famliy with a different style, then call InstalledFamilyMemberWithWeightStretchStyle(nullptr,unset,desired_style).

NOTE WELL: Changing the style requires updating the Family, Face, PostScript and Windows LOGFONT names as well.

◆ SetFontWeight()

bool ON_Font::SetFontWeight ( ON_Font::Weight  font_weight)

Description: Don't use this old function. If you have a font and want a face in the same famliy with a different weight, then call InstalledFamilyMemberWithWeightStretchStyle(desired_weight,unset,unset).

NOTE WELL: Changing the weight requires updating the Family, Face, PostScript and Windows LOGFONT names as well.

◆ SetFromAppleFontName() [1/2]

bool ON_Font::SetFromAppleFontName ( const wchar_t *  postscript_name)

Parameters: postscript_name - [in] From CTFontCopyPostScriptName(...) / NSFont.fontName Remarks: The "Apple Font Name" is the PostScript font name in the Mac OS "Font Book" application and in some other Apple documentation. It is CTFontCopyPostScriptName(...) / NSFont.fontName.

◆ SetFromAppleFontName() [2/2]

bool ON_Font::SetFromAppleFontName ( const wchar_t *  postscript_name,
double  point_size 
)

Parameters: postscript_name - [in] From CTFontCopyPostScriptName(...) / NSFont.fontName point_size - [in] Pass 0.0 for annotation fonts Remarks: The "Apple Font Name" is the PostScript font name in the Mac OS "Font Book" application and in some other Apple documentation. It is CTFontCopyPostScriptName(...) / NSFont.fontName.

◆ SetFromFontDescription() [1/2]

bool ON_Font::SetFromFontDescription ( const wchar_t *  font_description)

◆ SetFromFontDescription() [2/2]

bool ON_Font::SetFromFontDescription ( const wchar_t *  font_description,
const wchar_t *  postscript_name 
)

◆ SetFromPostScriptName()

bool ON_Font::SetFromPostScriptName ( const wchar_t *  postscript_name)

Description: Sets the ON_Font information from the platform font with the specified postscript_name. Parameters: postscript_name - [in] bAcceptPartialMatch - [in] If bAcceptPartialMatch is true, there is not a font on the device with a matching name, but there are fonts with names that have significant overlap, then the font with the best overlap is returned. For example if "Arial-Black" is not present and "Arial-BoldMT" is present, then ON_Font.SetFromPostScriptName(L"Arial-Black",true) will return the font with PostScript name "Arial-BoldMT". Returns: True if the font was set.

◆ SetLogfontCharSet()

bool ON_Font::SetLogfontCharSet ( unsigned char  logfont_charset)

◆ SetPANOSE1()

void ON_Font::SetPANOSE1 ( ON_PANOSE1  panose1)

◆ SetPointSize()

bool ON_Font::SetPointSize ( double  point_size)

Parameters: point_size - [in] font character height in point units.

Remarks: See the remarks section ON_Font::PointSize() for more information about point units and character height.

◆ SetSimulated()

void ON_Font::SetSimulated ( bool  bSimulatedWeight,
bool  bSimulatedStretch,
bool  bSimulatedStyle,
bool  bSimulatedOther 
)

◆ SetStrikethrough()

bool ON_Font::SetStrikethrough ( bool  bStrikethrough)

◆ SetUnderlined()

bool ON_Font::SetUnderlined ( bool  bUnderlined)

◆ SetUnsetProperties()

unsigned int ON_Font::SetUnsetProperties ( const ON_Font source,
bool  bUpdateDescription 
)

Description: If a propery is unset in this and set in source, then it is set to the source value. Parameters: source - [in] bUpdateDescription - [in] When in doubt, pass true. If bUpdateDescription is true and at least one property is changed, then the description is also updated. Returns: Number of changed properties.

◆ SetWindowsLogfontName()

bool ON_Font::SetWindowsLogfontName ( const wchar_t *  windows_logfont_name)

Description: This is a legacy function that traces it's heritage to Windows specific GDI LOGFONT code from 1995. Best to avoid it whenever possible. Ideally, use an Windows IDWriteFont or Apple CTFont to create an ON_Font that references an installed font. Less ideally, use a complete LOGFONT structure. Parameters: windows_logfont_name - [in] GDI LOGFONT.lfFaceName value. Note well: This is not the font "face name", not the font "family name", and not the font PostScript name. It is often a combination of the family name, an additional "GDI sub-family" name. Occasionally it includes some face weight and style attributes. Returns: True if the value was set.

◆ SetWindowsLogfontWeight()

bool ON_Font::SetWindowsLogfontWeight ( int  windows_logfont_weight)

Description: Don't use this old function. Higher quality font information is created by SetFromAppleFont() and SetFromWindowsDWriteFont(). NOTE WELL: Changing the weight requires updating the Family, Face, PostScript and Windows LOGFONT names as well.

◆ SimulatedStretch()

bool ON_Font::SimulatedStretch ( ) const

Returns: often bold from normal

◆ SimulatedStyle()

bool ON_Font::SimulatedStyle ( ) const

Returns: true if the style was simulated (typically italic from upright)

◆ SimulatedWeight()

bool ON_Font::SimulatedWeight ( ) const

Returns: often bold from normal

◆ StretchToWideString()

static const wchar_t* ON_Font::StretchToWideString ( ON_Font::Stretch  font_stretch)
static

◆ StyleToWideString()

static const wchar_t* ON_Font::StyleToWideString ( ON_Font::Style  font_style)
static

◆ SubstituteFont()

const ON_Font* ON_Font::SubstituteFont ( ) const

Returns: If this font is a managed font that references a font that is not installed on this computer, then a pointer to the installed font that is the substitute for the missing font is returned. Otherwise nullptr is returned.

◆ TestInstalledFontList()

static bool ON_Font::TestInstalledFontList ( class ON_TextLog text_log)
static

Description: Tests InstalledFontList(). Parameters: text_log - [in] Summary of the test. If errors are detected, they are printed in error_log. Returns: true: Test passed - no errors detected. false: Test failed.

◆ UnderlinedStrikethroughDeviation() [1/3]

static unsigned int ON_Font::UnderlinedStrikethroughDeviation ( bool  bPreferedUnderline,
bool  bPreferedStrikethrough,
bool  bAvailableUnderline,
bool  bAvailableStrikethrough 
)
static

◆ UnderlinedStrikethroughDeviation() [2/3]

static unsigned int ON_Font::UnderlinedStrikethroughDeviation ( bool  bPreferedUnderline,
bool  bPreferedStrikethrough,
const ON_Font available_font 
)
static

◆ UnderlinedStrikethroughDeviation() [3/3]

static unsigned int ON_Font::UnderlinedStrikethroughDeviation ( const ON_Font prefered_underlined_strikethrough,
const ON_Font available_font 
)
static

◆ WeightFromAppleFontWeightTrait()

static ON_Font::Weight ON_Font::WeightFromAppleFontWeightTrait ( double  apple_font_weight_trait)
static

Parameters: apple_font_weight_trait - [in] Apple WeightTrait The valid value range is from -1.0 to 1.0. The value of 0.0 corresponds to the regular or medium font weight.

◆ WeightFromAppleWeightOfFont()

static ON_Font::Weight ON_Font::WeightFromAppleWeightOfFont ( int  apple_weight_of_font)
static

Description: 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 Returns: The best ON_Font::Weight enum value for the Apple weight of font.

◆ WeightFromWindowsLogfontWeight()

static ON_Font::Weight ON_Font::WeightFromWindowsLogfontWeight ( int  windows_logfont_weight)
static

Description: 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 Returns: The best ON_Font::Weight enum value for the Windows LOGFONT weight.

◆ WeightStretchStyleDeviation() [1/3]

static unsigned int ON_Font::WeightStretchStyleDeviation ( const ON_Font prefered_weight_stretch_style,
const ON_Font available_font 
)
static

◆ WeightStretchStyleDeviation() [2/3]

static unsigned int ON_Font::WeightStretchStyleDeviation ( ON_Font::Weight  prefered_weight,
ON_Font::Stretch  prefered_stretch,
ON_Font::Style  prefered_style,
const ON_Font available_font 
)
static

◆ WeightStretchStyleDeviation() [3/3]

static unsigned int ON_Font::WeightStretchStyleDeviation ( ON_Font::Weight  prefered_weight,
ON_Font::Stretch  prefered_stretch,
ON_Font::Style  prefered_style,
ON_Font::Weight  available_weight,
ON_Font::Stretch  available_stretch,
ON_Font::Style  available_style 
)
static

◆ WeightToWideString()

static const wchar_t* ON_Font::WeightToWideString ( ON_Font::Weight  font_weight)
static

◆ WidthWeightSlantDescription() [1/2]

const ON_wString ON_Font::WidthWeightSlantDescription ( ) const

◆ WidthWeightSlantDescription() [2/2]

static const ON_wString ON_Font::WidthWeightSlantDescription ( ON_Font::Stretch  width,
ON_Font::Weight  weight,
ON_Font::Style  slant 
)
static

◆ WindowsLogfontCharSetFromFaceName()

static unsigned char ON_Font::WindowsLogfontCharSetFromFaceName ( const wchar_t *  face_name)
static

Parameters: face_name - [in]
GDI LOGFONT.lfFaceName value. Note well: This is not the font "face name" or the font "family name". It is typically a combination of the face name and "GDI sub-family" name and typically does not include words that identify face weight or face style. Returns: If the code is running on Windows: The appropriate value of LOGFONT.lfCharSet for the input facename. If the code is not running on Windows: ON_Font::WindowsConstants::logfont_default_charset.

◆ WindowsLogfontName() [1/2]

const ON_wString ON_Font::WindowsLogfontName ( ) const

Returns: ON_Font::WindowsLogfontName(ON_Font::NameLocale::LocalizedFirst)

◆ WindowsLogfontName() [2/2]

const ON_wString ON_Font::WindowsLogfontName ( ON_Font::NameLocale  name_locale) const

Returns: The font's Windows GDI LOGFONT.lfFaceName. Remarks: This name is preserved so Rhino can write early version files and so some old code can use Windows GDI tools. Every effort should be made to avoid using Windows LOGFONT lfFaceName.

◆ WindowsLogfontNameAsPointer()

const wchar_t* ON_Font::WindowsLogfontNameAsPointer ( ) const

Returns: A pointer for immediate use in formatted printing as in FormattedPrint(L"Windows LOGFONT.lfFaceName[] = \"&ls"
",font.WindowsLogfontNameAsPointer()); Remarks: WARNING: Do not save this pointer for later use. It points to memory in a dynamic string.

◆ WindowsLogfontWeight()

int ON_Font::WindowsLogfontWeight ( ) const

◆ WindowsLogfontWeightFromWeight()

static int ON_Font::WindowsLogfontWeightFromWeight ( ON_Font::Weight  font_weight)
static

Description: 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 Returns: The Windows LOGFONT lfWeight value that corresponds to the ON_Font::Weight enum value.

◆ Write()

bool ON_Font::Write ( ON_BinaryArchive ) const

serialize definition to binary archive

◆ WriteV5()

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.

Friends And Related Function Documentation

◆ ON_FontGlyph

friend class ON_FontGlyph
friend

◆ ON_FontList

friend class ON_FontList
friend

◆ ON_ManagedFonts

friend class ON_ManagedFonts
friend

Member Data Documentation

◆ Default

const ON_Font ON_Font::Default
static

ON_Font::Default depends on the platform. Arial on Windows Helvetica Neue on Mac OS

◆ Unset

const ON_Font ON_Font::Unset
static

ON_Font::Unset has unset face name and platform font name.