Rhino C++ API
8.13
|
#include <opennurbs_font.h>
Public Member Functions | |
ON_FontGlyph ()=default | |
ON_FontGlyph (const class ON_Font *font, ON__UINT32 code_point) | |
ON_FontGlyph (const ON_FontGlyph &src) | |
~ON_FontGlyph ()=default | |
const ON__UINT32 | CodePoint () const |
bool | CodePointIsSet () const |
void | Dump (bool bIncludeCharMaps, ON_TextLog &text_log) const |
void | Dump (bool bIncludeFont, bool bIncludeCharMaps, bool bIncludeSubstitute, bool bIncludeFontUnitTextBox, ON_TextLog &text_log) const |
const class ON_Font * | Font () const |
const ON__UINT_PTR | FontGlyphId () const |
bool | FontGlyphIdIsSet () const |
unsigned int | FontGlyphIndex () const |
bool | FontGlyphIndexIsSet () const |
const ON_TextBox & | FontUnitGlyphBox () const |
bool | GetGlyphContours (bool bSingleStrokeFont, double height_of_capital, ON_ClassArray< ON_SimpleArray< ON_Curve * > > &glyph_contours, ON_BoundingBox *glyph_bbox, ON_3dVector *glyph_advance) const |
bool | GetOutline (bool bSingleStrokeFont, class ON_Outline &outline) const |
const ON_TextBox & | GlyphBox () const |
bool | IsEndOfLineCodePoint () const |
bool | IsManaged () const |
const ON_FontGlyph * | ManagedGlyph () const |
ON_FontGlyph & | operator= (const ON_FontGlyph &src) |
const ON_FontGlyph * | RenderGlyph (bool bUseReplacementCharacter) const |
bool | SetCodePoint (const class ON_Font *font, ON__UINT32 code_point) |
const ON_FontGlyph * | SubstituteGlyph () const |
Static Public Member Functions | |
static int | CompareCodePointAndFont (const ON_FontGlyph &lhs, const ON_FontGlyph &rhs) |
static int | GetGlyphList (const wchar_t *text, const class ON_Font *font, ON__UINT32 unicode_CRLF_code_point, ON_SimpleArray< const ON_FontGlyph * > &glyph_list, ON_TextBox &text_box) |
static int | GetGlyphList (size_t code_point_count, ON__UINT32 *code_points, const class ON_Font *font, ON__UINT32 unicode_CRLF_code_point, ON_SimpleArray< const ON_FontGlyph * > &glyph_list, ON_TextBox &text_box) |
static int | GetGlyphListBoundingBox (const wchar_t *text, const class ON_Font *font, ON_TextBox &text_box) |
static int | GetGlyphListBoundingBox (size_t code_point_count, ON__UINT32 *code_points, const class ON_Font *font, ON_TextBox &text_box) |
static bool | GetStringContours (const wchar_t *text_string, const class ON_Font *font, bool bSingleStrokeFont, double height_of_capital, double small_caps_scale, ON_ClassArray< ON_ClassArray< ON_SimpleArray< ON_Curve * > > > &string_contours) |
static bool | IsCarriageReturnAndLineFeed (ON__UINT32 unicode_code_point, ON__UINT32 next_unicode_code_point) |
static bool | IsEndOfLineCodePoint (ON__UINT32 unicode_code_point) |
Static Public Attributes | |
static const ON_FontGlyph | Unset |
Friends | |
class | ON_Font |
class | ON_GlyphMap |
The best way to get a useful ON_FontGlyph is to call ON_Font.CodePointGlyph(unicode_code_point)
|
default |
The best way to get a useful ON_FontGlyph is to call ON_Font.CodePointGlyph(unicode_code_point)
|
default |
ON_FontGlyph::ON_FontGlyph | ( | const ON_FontGlyph & | src | ) |
ON_FontGlyph::ON_FontGlyph | ( | const class ON_Font * | font, |
ON__UINT32 | code_point | ||
) |
If the font and code point are valid, constructs an unmanaged glyph with the specified font and code point. The glyph box is not set.
const ON__UINT32 ON_FontGlyph::CodePoint | ( | ) | const |
bool ON_FontGlyph::CodePointIsSet | ( | ) | const |
Returns: True if the unicode code point and font are set
|
static |
void ON_FontGlyph::Dump | ( | bool | bIncludeCharMaps, |
ON_TextLog & | text_log | ||
) | const |
Parameters: bIncludeCharMaps - [in] If true, then char information is printed.
void ON_FontGlyph::Dump | ( | bool | bIncludeFont, |
bool | bIncludeCharMaps, | ||
bool | bIncludeSubstitute, | ||
bool | bIncludeFontUnitTextBox, | ||
ON_TextLog & | text_log | ||
) | const |
const class ON_Font* ON_FontGlyph::Font | ( | ) | const |
const ON__UINT_PTR ON_FontGlyph::FontGlyphId | ( | ) | const |
bool ON_FontGlyph::FontGlyphIdIsSet | ( | ) | const |
unsigned int ON_FontGlyph::FontGlyphIndex | ( | ) | const |
Returns: Font glyph id. Remarks: The glyph id depends on the font and is assigned by the font designer. In particular the font glyph id for the same Unicode code point often varies from font to font. In a font, it is often the case that multiple Unicode code points map to the same glyph. For example, space an non-breaking space typically map to the same font glyph id.
bool ON_FontGlyph::FontGlyphIndexIsSet | ( | ) | const |
const ON_TextBox& ON_FontGlyph::FontUnitGlyphBox | ( | ) | const |
Returns: Font unit glyph box. Remarks: Must be used with ON_Font::FontUnitFontMetrics() and a single font to obtain useful results. You are probably better of using normalized font coordinates in a ON_FontGlyph.GlyphBox().
bool ON_FontGlyph::GetGlyphContours | ( | bool | bSingleStrokeFont, |
double | height_of_capital, | ||
ON_ClassArray< ON_SimpleArray< ON_Curve * > > & | glyph_contours, | ||
ON_BoundingBox * | glyph_bbox, | ||
ON_3dVector * | glyph_advance | ||
) | const |
Description: Get glyph contours as NURBS curves. Parameters: bSingleStrokeFont - [in] If true, open contours will not be closed by adding a line segment. height_of_capital - [in] If > 0, output curves, bounding box, and advance vector are scaled by height_of_capital/(font design capital height). For fonts like Arial, Helvetica, Times Roman, and Courier this means the height of H and I will be height_of_capital. Otherwise, no scaling is applied to the output curves, bounding box, and advance vector. Pass 0.0 or in this->Font()->HeightOfI() to get the contours to be in opennurbs normalized font coordinates. All other values < 0 are treated as 0.0. glyph_contours - [out] glyph_bbox - [out] glyph bounding box. glyph_advance - [out] glyph_advance->x = horizontal advance to apply when rendering glyphs horizontally. A positive horizontal advance indicates advance to the right. glyph_advance->y = vertical advance to apply when rendering glyphs vertically. A positive vertical advance indicates advance downwards.
|
static |
Parameters: text - [in] Null terminated wchar_t string. font - [in] The font used to render the glyphs. unicode_CRLF_code_point - [in] If unicode_CRLF_code_point is a valid unicode code point, then consecutive carriage return line feed pairs are converted to a single glyph with code point = unicode_CRLF_code_point.
ON_UnicodeCodePoint::ON_LineSeparator is a good choice when you want to
condense carriage return line feed pairs to a single unambiguous code point.
ON_UnicodeCodePoint::ON_InvalidCodePoint is a good choice when you want to preserve carriage return line feed pairs as two separate glyphs.
glyph_list - [out] Note that glyph_list.Count() is often different than the length of the text string or the number of unicode codepoints in the decoded text. Adjacent carriage return and line feed codepoints are converted to single a hard end of line. All trailing end of line code points are removed from text. Invalid unicode encoding sequences are replaced with ON_UnicodeCodePoint::ReplacementCharacter glyphs.
text_box - [out] tight bounding boxt of text extents. text_box.m_advance.i = maximum of all line horizontal advance values.. text_box.m_advance.j = vertical advance to baseline of last line If if the font height is ON_Font::Constants::AnnotationFontCellHeight. If you will render the font at a different height from ON_Font::Constants::AnnotationFontCellHeight, then use ON_TextBox::Scale as follows: ON_TextBox scaled_box = ON_TextBox::Scale( text_box, (font render height)/((double)ON_Font::Constants::AnnotationFontCellHeight) ); Return: number of lines of text or 0 if input is not valid or text is empty.
|
static |
|
static |
Parameters: font - [in] The font used to render the glyphs. text_box - [out] tight bounding boxt of text extents. text_box.m_advance.i = maximum of all line horizontal advance values.. text_box.m_advance.j = vertical advance to baseline of last line If if the font height is ON_Font::Constants::AnnotationFontCellHeight. If you will render the font at a different height from ON_Font::Constants::AnnotationFontCellHeight, then use ON_TextBox::Scale as follows: ON_TextBox scaled_box = ON_TextBox::Scale( text_box, (font render height)/((double)ON_Font::Constants::AnnotationFontCellHeight) ); Return: number of lines of text or 0 if input is not valid or text is empty.
|
static |
bool ON_FontGlyph::GetOutline | ( | bool | bSingleStrokeFont, |
class ON_Outline & | outline | ||
) | const |
|
static |
const ON_TextBox& ON_FontGlyph::GlyphBox | ( | ) | const |
Returns: Glyph box in opennurbs normalized font coordinates.
|
static |
bool ON_FontGlyph::IsEndOfLineCodePoint | ( | ) | const |
|
static |
bool ON_FontGlyph::IsManaged | ( | ) | const |
Returns: true if this is a managed instance. Managed instances persist for the lifetime of the application and the pointer can be safely saved and referenced at any time.
const ON_FontGlyph* ON_FontGlyph::ManagedGlyph | ( | ) | const |
Returns: If this->CodePointIsSet() is true, then a persistent pointer to a managed glyph with the same code point and font is returned. Otherwise nullptr is returned.
ON_FontGlyph& ON_FontGlyph::operator= | ( | const ON_FontGlyph & | src | ) |
const ON_FontGlyph* ON_FontGlyph::RenderGlyph | ( | bool | bUseReplacementCharacter | ) | const |
Parameters: bUseReplacementCharacter - [in] When this->CodePointIsSet() is true, and bUseReplacementCharacter is true, and no reasonable glyph definition exists, and no substituted is available, then the replacement character glyph for UNICODE code point ON_UnicodeCodePoint::ON_ReplacementCharacter (U+FFFD) will be returned.
Returns: A managed glyph that can be used to render "this". If this->CodePointIsSet() is false, nullptr is returned. If this->CodePointIsSet() is true, the returned glyph may have a different font and code point when the current computer requires font or glyph substitution to draw the glyph. When the current platform cannot render this, nullptr or the replacement glyph is returned depending on the value of bUseReplacementCharacter.
See Also: ON_FontGlyph.SubstituteGlyph().
bool ON_FontGlyph::SetCodePoint | ( | const class ON_Font * | font, |
ON__UINT32 | code_point | ||
) |
Description: Sets the font and code point and unsets every other property including the glyph box and substitute information. Parameters: font - [in] code_point - [in]
const ON_FontGlyph* ON_FontGlyph::SubstituteGlyph | ( | ) | const |
Returns: If this is a managed glyph or a copy of a managed glyph, and a substitute font or code point is used to render the glyph, then the substitute is returned. In all other cases, nullptr is returned. See Also: ON_FontGlyph.RenderGlyph().
|
friend |
|
friend |
|
static |