#include <Font.hh>
Public Member Functions | |
virtual std::string | BaseName () const =0 |
Return the base name of a font. | |
virtual const Glyph * | GetGlyph (wchar_t ch) const =0 |
Return the glyph for the corresponding character code. | |
virtual unsigned | UnitsPerEM () const =0 |
Return the number of font unit in the EM square. | |
virtual double | FromFontUnit (unsigned val) const =0 |
Return the width of the glyph in PDF glyph unit. |
This class represents a font in the PDF document. It can be created by reading a PDF document which contain some fonts, or by manually creating by a font file. It provides access to the Glyph in the font.
virtual std::string pdf::Font::BaseName | ( | ) | const [pure virtual] |
This function returns the PostScript name of the font. For Type 1 fonts, this is usually the value of the FontName entry in the font program. For TrueType fonts, it is returned by the FT_Get_Postscript_Name() function in FreeType. It will be used for displaying the font's name for client applications.
virtual double pdf::Font::FromFontUnit | ( | unsigned | val | ) | const [pure virtual] |
Call this function to convert the lengths in font unit to PDF glyph unit. The PDF glyph unit is 1/1000 of user space, which is 1/72 inch. I.e. if this function returns 72000, then it is one inch. This value must be further multiplied by the font size in points to get the real device-independent size.
val | The value in font unit to be convert to glyph unit. |
virtual const Glyph* pdf::Font::GetGlyph | ( | wchar_t | ch | ) | const [pure virtual] |
This function will search the glyph for the given character code. If there is no glyph defined for this character in the font, it will return 0.
ch | The unicode value of the character. |
virtual unsigned pdf::Font::UnitsPerEM | ( | ) | const [pure virtual] |
In creating the glyph outlines, a type designer uses an imaginary square called the EM square. Typically, the EM square can be thought of as a tablet on which the characters are drawn. The square's size, i.e., the number of grid units on its sides, is very important for two reasons:
pixel_size = point_size * resolution / 72 pixel_coord = grid_coord * pixel_size / EM_size