#include <PdfFontMetrics.h>
Inherited by PoDoFo::PdfFontMetricsBase14, PoDoFo::PdfFontMetricsFreetype, and PoDoFo::PdfFontMetricsObject.
This abstract class provides access to fontmetrics informations.
◆ CharWidth()
virtual double PoDoFo::PdfFontMetrics::CharWidth |
( |
unsigned char |
c | ) |
const |
|
pure virtual |
Retrieve the width of the given character in PDF units in the current font
- Parameters
-
- Returns
- the width in PDF units
◆ CharWidthMM()
unsigned long PoDoFo::PdfFontMetrics::CharWidthMM |
( |
unsigned char |
c | ) |
const |
|
inline |
Retrieve the width of the given character in 1/1000th mm in the current font
- Parameters
-
- Returns
- the width in 1/1000th mm
◆ FontTypeFromFilename()
EPdfFontType PoDoFo::PdfFontMetrics::FontTypeFromFilename |
( |
const char * |
pszFilename | ) |
|
|
static |
Try to detect the internal fonttype from the file extension of a fontfile.
- Parameters
-
pszFilename | must be the filename of a font file |
- Returns
- font type
◆ GetAscent()
virtual double PoDoFo::PdfFontMetrics::GetAscent |
( |
| ) |
const |
|
pure virtual |
Get the ascent of this font in PDF units for the current font size.
- Returns
- the ascender for this font
- See also
- GetPdfAscent
◆ GetBoundingBox()
virtual void PoDoFo::PdfFontMetrics::GetBoundingBox |
( |
PdfArray & |
array | ) |
const |
|
pure virtual |
Create the bounding box array as required by the PDF reference so that it can be written directly to a PDF file.
- Parameters
-
array | write the bounding box to this array. |
◆ GetDescent()
virtual double PoDoFo::PdfFontMetrics::GetDescent |
( |
| ) |
const |
|
pure virtual |
Get the descent of this font in PDF units for the current font size. This value is usually negative!
- Returns
- the descender for this font
- See also
- GetPdfDescent
◆ GetFilename()
const char * PoDoFo::PdfFontMetrics::GetFilename |
( |
| ) |
const |
|
inline |
Get a pointer to the path of the font file.
- Returns
- a zero terminated string containing the filename of the font file
◆ GetFontCharSpace()
float PoDoFo::PdfFontMetrics::GetFontCharSpace |
( |
| ) |
const |
|
inline |
Retrieve the current character spacing of this metrics object
- Returns
- the current font character spacing
◆ GetFontData()
virtual const char* PoDoFo::PdfFontMetrics::GetFontData |
( |
| ) |
const |
|
pure virtual |
Get a pointer to the actual font data - if it was loaded from memory.
- Returns
- a binary buffer of data containing the font data
◆ GetFontDataLen()
virtual pdf_long PoDoFo::PdfFontMetrics::GetFontDataLen |
( |
| ) |
const |
|
pure virtual |
Get the length of the actual font data - if it was loaded from memory.
- Returns
- a the length of the font data
◆ GetFontname()
virtual const char* PoDoFo::PdfFontMetrics::GetFontname |
( |
| ) |
const |
|
pure virtual |
Get a string with the postscript name of the font.
- Returns
- the postscript name of the font or NULL string if no postscript name is available.
◆ GetFontScale()
float PoDoFo::PdfFontMetrics::GetFontScale |
( |
| ) |
const |
|
inline |
Retrieve the current horizontal scaling of this metrics object
- Returns
- the current font scaling
◆ GetFontSize()
float PoDoFo::PdfFontMetrics::GetFontSize |
( |
| ) |
const |
|
inline |
Retrieve the current font size of this metrics object
- Returns
- the current font size
◆ GetFontType()
- Returns
- the fonttype of the loaded font
◆ GetGlyphId()
virtual long PoDoFo::PdfFontMetrics::GetGlyphId |
( |
long |
lUnicode | ) |
const |
|
pure virtual |
Get the glyph id for a unicode character in the current font.
- Parameters
-
lUnicode | the unicode character value |
- Returns
- the glyhph id for the character or 0 if the glyph was not found.
◆ GetGlyphWidth() [1/2]
virtual double PoDoFo::PdfFontMetrics::GetGlyphWidth |
( |
const char * |
pszGlyphname | ) |
const |
|
pure virtual |
Get the width of a single named glyph
- Parameters
-
pszGlyphname | name of the glyph |
- Returns
- the width of a single named glyph
◆ GetGlyphWidth() [2/2]
virtual double PoDoFo::PdfFontMetrics::GetGlyphWidth |
( |
int |
nGlyphId | ) |
const |
|
pure virtual |
Get the width of a single glyph id
- Parameters
-
- Returns
- the width of a single glyph id
◆ GetItalicAngle()
virtual int PoDoFo::PdfFontMetrics::GetItalicAngle |
( |
| ) |
const |
|
pure virtual |
Get the italic angle of this font. Used to build the font dictionay
- Returns
- the italic angle of this font.
◆ GetLineSpacing()
virtual double PoDoFo::PdfFontMetrics::GetLineSpacing |
( |
| ) |
const |
|
pure virtual |
Retrieve the line spacing for this font
- Returns
- the linespacing in PDF units
◆ GetLineSpacingMM()
unsigned long PoDoFo::PdfFontMetrics::GetLineSpacingMM |
( |
| ) |
const |
|
inline |
Retrieve the line spacing for this font
- Returns
- the linespacing in 1/1000th mm
◆ GetPdfAscent()
virtual double PoDoFo::PdfFontMetrics::GetPdfAscent |
( |
| ) |
const |
|
pure virtual |
Get the ascent of this font Used to build the font dictionay
- Returns
- the ascender for this font
- See also
- GetAscent
◆ GetPdfDescent()
virtual double PoDoFo::PdfFontMetrics::GetPdfDescent |
( |
| ) |
const |
|
pure virtual |
Get the descent of this font Used to build the font dictionay
- Returns
- the descender for this font
- See also
- GetDescent
◆ GetStrikeOutPosition()
virtual double PoDoFo::PdfFontMetrics::GetStrikeOutPosition |
( |
| ) |
const |
|
pure virtual |
Return the position of the strikeout for the current font size in PDF units
- Returns
- the underline position in PDF units
◆ GetStrikeOutPositionMM()
unsigned long PoDoFo::PdfFontMetrics::GetStrikeOutPositionMM |
( |
| ) |
const |
|
inline |
Return the position of the strikeout for the current font size in 1/1000th mm
- Returns
- the underline position in 1/1000th mm
◆ GetStrikeoutThickness()
virtual double PoDoFo::PdfFontMetrics::GetStrikeoutThickness |
( |
| ) |
const |
|
pure virtual |
Get the width of the strikeout for the current font size in PDF units
- Returns
- the thickness of the strikeout in PDF units
◆ GetStrikeoutThicknessMM()
unsigned long PoDoFo::PdfFontMetrics::GetStrikeoutThicknessMM |
( |
| ) |
const |
|
inline |
Get the width of the strikeout for the current font size in 1/1000th mm
- Returns
- the thickness of the strikeout in 1/1000th mm
◆ GetSubsetFontnamePrefix()
const char * PoDoFo::PdfFontMetrics::GetSubsetFontnamePrefix |
( |
| ) |
const |
|
inline |
- Returns
- NULL or a 6 uppercase letter and "+" sign prefix used for font subsets
◆ GetUnderlinePosition()
virtual double PoDoFo::PdfFontMetrics::GetUnderlinePosition |
( |
| ) |
const |
|
pure virtual |
Return the position of the underline for the current font size in PDF units
- Returns
- the underline position in PDF units
◆ GetUnderlinePositionMM()
long PoDoFo::PdfFontMetrics::GetUnderlinePositionMM |
( |
| ) |
const |
|
inline |
Return the position of the underline for the current font size in 1/1000th mm
- Returns
- the underline position in 1/1000th mm
◆ GetUnderlineThickness()
virtual double PoDoFo::PdfFontMetrics::GetUnderlineThickness |
( |
| ) |
const |
|
pure virtual |
Get the width of the underline for the current font size in PDF units
- Returns
- the thickness of the underline in PDF units
◆ GetUnderlineThicknessMM()
unsigned long PoDoFo::PdfFontMetrics::GetUnderlineThicknessMM |
( |
| ) |
const |
|
inline |
Get the width of the underline for the current font size in 1/1000th mm
- Returns
- the thickness of the underline in 1/1000th mm
◆ GetWeight()
virtual unsigned int PoDoFo::PdfFontMetrics::GetWeight |
( |
| ) |
const |
|
pure virtual |
Get the weight of this font. Used to build the font dictionay
- Returns
- the weight of this font (500 is normal).
◆ GetWidthArray()
virtual void PoDoFo::PdfFontMetrics::GetWidthArray |
( |
PdfVariant & |
var, |
|
|
unsigned int |
nFirst, |
|
|
unsigned int |
nLast, |
|
|
const PdfEncoding * |
pEncoding = NULL |
|
) |
| const |
|
pure virtual |
Create a width array for this font which is a required part of every font dictionary.
- Parameters
-
var | the final width array is written to this PdfVariant |
nFirst | first character to be in the array |
nLast | last character code to be in the array |
pEncoding | encoding for correct character widths. If not passed default (latin1) encoding is used |
◆ GetWordSpace()
float PoDoFo::PdfFontMetrics::GetWordSpace |
( |
| ) |
const |
|
inline |
Retrieve the current word spacing of this metrics object
- Returns
- the current font word spacing in PDF units
◆ IsSymbol()
virtual bool PoDoFo::PdfFontMetrics::IsSymbol |
( |
| ) |
const |
|
pure virtual |
Symbol fonts do need special treatment in a few cases. Use this method to check if the current font is a symbol font. Symbold fonts are detected by checking if they use FT_ENCODING_MS_SYMBOL as internal encoding.
- Returns
- true if this is a symbol font
◆ SetFontCharSpace()
void PoDoFo::PdfFontMetrics::SetFontCharSpace |
( |
float |
fCharSpace | ) |
|
|
inline |
Set the character spacing of this metrics object
- Parameters
-
fCharSpace | character spacing in percent |
◆ SetFontScale()
void PoDoFo::PdfFontMetrics::SetFontScale |
( |
float |
fScale | ) |
|
|
inline |
Set the horizontal scaling of the font for compressing (< 100) and expanding (>100) This is typically called from PdfFont for you.
- Parameters
-
◆ SetFontSize()
void PoDoFo::PdfFontMetrics::SetFontSize |
( |
float |
fSize | ) |
|
|
inline |
Set the font size of this metrics object for width and height calculations. This is typically called from PdfFont for you.
- Parameters
-
◆ SetFontType()
void PoDoFo::PdfFontMetrics::SetFontType |
( |
EPdfFontType |
eFontType | ) |
|
|
inlineprotected |
Set the fonttype.
- Parameters
-
◆ SetWordSpace()
void PoDoFo::PdfFontMetrics::SetWordSpace |
( |
float |
fWordSpace | ) |
|
|
inline |
Set the word spacing of this metrics object
- Parameters
-
fWordSpace | word spacing in PDF units |
◆ StringWidth() [1/4]
double PoDoFo::PdfFontMetrics::StringWidth |
( |
const char * |
pszText, |
|
|
pdf_long |
nLength = 0 |
|
) |
| const |
Retrieve the width of a given text string in PDF units when drawn with the current font
- Parameters
-
pszText | a text string of which the width should be calculated |
nLength | if != 0 only the width of the nLength first characters is calculated |
- Returns
- the width in PDF units
◆ StringWidth() [2/4]
double PoDoFo::PdfFontMetrics::StringWidth |
( |
const pdf_utf16be * |
pszText, |
|
|
unsigned int |
nLength = 0 |
|
) |
| const |
Retrieve the width of a given text string in PDF units when drawn with the current font
- Parameters
-
pszText | a text string of which the width should be calculated |
nLength | if != 0 only the width of the nLength first characters is calculated |
- Returns
- the width in PDF units
◆ StringWidth() [3/4]
double PoDoFo::PdfFontMetrics::StringWidth |
( |
const PdfString & |
rsString | ) |
const |
|
inline |
Retrieve the width of a given text string in PDF units when drawn with the current font
- Parameters
-
rsString | a PdfString from which the width shall be calculated |
- Returns
- the width in PDF units
This is an overloaded method for your convinience!
◆ StringWidth() [4/4]
double PoDoFo::PdfFontMetrics::StringWidth |
( |
const wchar_t * |
pszText, |
|
|
unsigned int |
nLength = 0 |
|
) |
| const |
Retrieve the width of a given text string in PDF units when drawn with the current font
- Parameters
-
pszText | a text string of which the width should be calculated |
nLength | if != 0 only the width of the nLength first characters is calculated |
- Returns
- the width in PDF units
◆ StringWidthMM() [1/3]
unsigned long PoDoFo::PdfFontMetrics::StringWidthMM |
( |
const char * |
pszText, |
|
|
unsigned int |
nLength = 0 |
|
) |
| const |
|
inline |
Retrieve the width of a given text string in 1/1000th mm when drawn with the current font
- Parameters
-
pszText | a text string of which the width should be calculated |
nLength | if != 0 only the width of the nLength first characters is calculated |
- Returns
- the width in 1/1000th mm
◆ StringWidthMM() [2/3]
unsigned long PoDoFo::PdfFontMetrics::StringWidthMM |
( |
const pdf_utf16be * |
pszText, |
|
|
unsigned int |
nLength = 0 |
|
) |
| const |
|
inline |
Retrieve the width of a given text string in 1/1000th mm when drawn with the current font
- Parameters
-
pszText | a text string of which the width should be calculated |
nLength | if != 0 only the width of the nLength first characters is calculated |
- Returns
- the width in 1/1000th mm
◆ StringWidthMM() [3/3]
unsigned long PoDoFo::PdfFontMetrics::StringWidthMM |
( |
const wchar_t * |
pszText, |
|
|
unsigned int |
nLength = 0 |
|
) |
| const |
|
inline |
Retrieve the width of a given text string in 1/1000th mm when drawn with the current font
- Parameters
-
pszText | a text string of which the width should be calculated |
nLength | if != 0 only the width of the nLength first characters is calculated |
- Returns
- the width in 1/1000th mm
◆ UnicodeCharWidth()
virtual double PoDoFo::PdfFontMetrics::UnicodeCharWidth |
( |
unsigned short |
c | ) |
const |
|
pure virtual |
Retrieve the width of the given character in PDF units in the current font
- Parameters
-
- Returns
- the width in PDF units