Font Class Documentation
classFontNamespace:datalogics_interface
Detailed Description
The Font class represents a font installed on the system.
Referenced by
Constructor & Destructor Documentation
Font
Font(const std::string &font_name)Parameters
font_name: const std::string &
Direct construction is prohibited.
Font
Font(const std::string &font_name, FontCreateFlagsflags)Parameters
font_name: const std::string &flags: FontCreateFlags
Direct construction is prohibited.
Font
Font(const std::string &font_name, FontCreateFlagsflags, WritingModemode)Parameters
font_name: const std::string &flags: FontCreateFlagsmode: WritingMode
Direct construction is prohibited.
Font
Font(Font &&)Parameters
: Font &&
~Font
~Font()Member Function Documentation
embed_now
voidembed_now(Document &doc)Parameters
doc: Document &the Document the Font is embedded into
Returns:
voidEmbeds the Font.
find_index_of_first_unrepresentable_char
unsigned intfind_index_of_first_unrepresentable_char(const std::string &text)Parameters
text: const std::string &the text to check
Returns:
The index of the first character that cannot be represented in this font.Find the index of the first character that cannot be represented in this font. This will return the index of the first character in the string for which the font has no glyph. If all characters can be represented (i.e. if IsTextRepresentable() would return true), this will return the length of the string.
get_ascent
doubleget_ascent()Returns:
The Ascent value of the font in glyph space units.the Ascent value from the font descriptor. This is the maximum height above the baseline reached by glyphs in this font, excluding the height of glyphs for accented characters.
get_avg_width
doubleget_avg_width()Returns:
The AvgWidth value of the font in glyph space units, or 0 if not defined.the AvgWidth value from the font descriptor. This is the average width of glyphs in the font, or 0 if the value is not defined in the font descriptor.
get_bbox
Rectget_bbox()Returns:
The bounding box of the font as a Rect, in glyph space units.The Bounding Box rectangle of the font.
get_cap_height
doubleget_cap_height()Returns:
The CapHeight value of the font in glyph space units, or 0 if not defined.the CapHeight value from the font descriptor. This is the vertical coordinate of the top of flat capital letters, measured from the baseline, or 0 if the value is not defined in the font descriptor.
get_cid_font_type
std::stringget_cid_font_type()Returns:
The CID font type, or an empty string if not a CID font.Get the CID font type of the font.
get_descent
doubleget_descent()Returns:
The descent value of the font.the Descent value from the font descriptor. This is the maximum depth below the baseline reached by glyphs in this font. The value is a negative number.
get_embedded
boolget_embedded()Returns:
true if the font is embedded, false if it is not.Tests whether the font is embedded in the document it was created for.
get_encoding
std::stringget_encoding()Returns:
The encoding of the font, eg: WinAnsiEncoding MacRomanEncodingReturn the encoding of the font.
get_encoding_info
std::unique_ptr< EncodingInfo >get_encoding_info()Returns:
The EncodingInfo object containing encoding details for this font.Get the populated CEncodingInfo object.
get_flags
FontFlagsget_flags()Returns:
The font descriptor flags as a CFontFlags bitmask.Get the font flags for a font.
get_font_list
static std::vector< Font >get_font_list()Returns:
The list of available fonts.Get a list of available fonts.
get_full_name
std::stringget_full_name()Returns:
The Full Name of the font. Note: This method only returns a meaningful result for TrueType-based technology fonts.Get the Full Name of the font.
get_glyph_widths
std::vector< double >get_glyph_widths()Returns:
256 glyph advances in 1000-em character-space units.Retrieve the 256-entry glyph width table for this font's single-byte encoding. Values are in character-space units (1000 per em); for the user-space width of character code c at font size s use widths[c] * s / 1000.0. Only meaningful for simple single-byte fonts; CID/Type-0 fonts should use measure_text_width.
Returns the 256-entry glyph advance table in character-space units (1000 units per em). For the user-space width of character code c at font size s: widths[c] * s / 1000.0.
The returned vector always has 256 entries; positions outside the font's defined encoding are filled with whatever advance the font reports for unmapped codes (typically zero or the missing-glyph advance). This API is therefore only meaningful for simple single-byte fonts — Type 1, TrueType with a simple encoding, etc. CID / Type 0 fonts need per-glyph measurement via MeasureTextWidth instead.
get_italic_angle
doubleget_italic_angle()Returns:
The ItalicAngle value of the font in degrees.the ItalicAngle value from the font descriptor. This is the angle, expressed in degrees counterclockwise from the vertical, of the dominant vertical strokes of the font, defined in the font descriptor.
get_leading
doubleget_leading()Returns:
The leading value of the font, or 0 if not present.the Leading value from the font descriptor. This is the spacing between baselines of consecutive lines of text, or 0 if the value is not defined in the font descriptor.
get_max_width
doubleget_max_width()Returns:
The MaxWidth value of the font in glyph space units, or 0 if not present.the MaxWidth value from the font descriptor. This is the maximum glyph width present in the font, or 0 if the value is not defined in the font descriptor.
get_missing_width
doubleget_missing_width()Returns:
The MissingWidth value of the font in glyph space units, or 0 if not present.the MissingWidth value from the font descriptor. This is the width given to characters that do not have corresponding glyphs defined in the font, or 0 if the value is not defined in the font descriptor.
get_name
std::stringget_name()Returns:
The name of the font.Get the name of the font.
get_pdf_dict
PDFDictget_pdf_dict()Returns:
The PDFDict for this font's COS dictionary object.Retrieve the PDFDict representation of this font.
get_stem_h
doubleget_stem_h()Returns:
The StemH value of the font in glyph space units, or 0 if not present.the StemH value from the font descriptor. This is the vertical thickness of the dominant horizontal stems of the font's glyphs, or 0 if the value is not defined in the font descriptor.
get_stem_v
doubleget_stem_v()Returns:
The StemV value of the font in glyph space units, or 0 if not present.the StemV value from the font descriptor. This is the horizontal thickness of the dominant vertical stems of the font's glyphs, or 0 if the value is not defined in the font descriptor.
get_type
std::stringget_type()Returns:
The type of the font. Type0 Type1 MMType1 TrueTypeGet the type of the font.
get_writing_mode
WritingModeget_writing_mode()Returns:
The WritingMode of the font.Get the writing mode of the font. The writing mode of the fontwhether it will place glyphs horizontally or vertically. Text written with this font will run in the direction of the writing mode.
get_x_height
doubleget_x_height()Returns:
The XHeight value of the font in glyph space units, or 0 if not present.the XHeight value from the font descriptor. This is the vertical coordinate of the top of flat nonascending lowercase letters in fonts that have Latin characters, as measured from the baseline, or 0 if the value is not defined in the font descriptor.
is_from_doc
boolis_from_doc()Returns:
true if the font was loaded from a document, false if it was created from a system font.Determine whether this font was obtained from an existing document rather than the system.
is_text_representable
boolis_text_representable(const std::string &text)Parameters
text: const std::string &the text to check
Returns:
true if all characters in the text have corresponding glyphs in this font.Is this text representable in this font?
measure_text_width
doublemeasure_text_width(const std::string &text, doublefont_size)Parameters
text: const std::string &the Text to be measured
font_size: doublethe Font size to be used
Returns:
The width of the text in points.Measures the width of the specified text in points, using the Font at the specified size.
operator=
Parameters
: Font &&