PoDoFo 1.2.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Friends | List of all members
PoDoFo::PdfFontManager Class Referencefinal

This class assists PdfDocument with caching font information. More...

#include <PdfFontManager.h>

Public Member Functions

PdfFontSearchFont (const std::string_view &fontPattern, const PdfFontSearchParams &searchParams={ }, const PdfFontCreateParams &createParams={ })
 Get a font from the cache.
 
PdfFontSearchFont (const std::string_view &fontPattern, const PdfFontCreateParams &createParams)
 Get a font from the cache.
 
PdfFontGetStandard14Font (PdfStandard14FontType stdFont, const PdfFontCreateParams &params={ })
 Get a Standard 14 font.
 
PdfFontGetOrCreateFont (const std::string_view &fontPath, unsigned faceIndex, const PdfFontCreateParams &params={ })
 Get or create a font from a file path.
 
PdfFontGetOrCreateFontFromBuffer (const bufferview &buffer, unsigned faceIndex, const PdfFontCreateParams &params={ })
 Get or create a font from a buffer.
 
PdfFontGetOrCreateFont (const std::string_view &fontPath, const PdfFontCreateParams &params={ })
 Get or create a font from a file path.
 
PdfFontGetOrCreateFontFromBuffer (const bufferview &buffer, const PdfFontCreateParams &params={ })
 Get or create a font from a buffer.
 
PdfFontGetOrCreateFont (PdfFontMetricsConstPtr metrics, const PdfFontCreateParams &params={ })
 Get or create a font from existing metrics.
 
PdfFontGetCachedFont (const PdfReference &ref)
 Try getting the font from the cached font map.
 
void EmbedFonts ()
 Embed all imported fonts.
 

Static Public Member Functions

static PdfFontMetricsConstPtr SearchFontMetrics (const std::string_view &fontPattern, const PdfFontSearchParams &params={ })
 Try to search for fontmetrics from the given fontname and parameters.
 

Friends

class PdfDocument
 
class PdfMemDocument
 
class PdfStreamedDocument
 
class PdfFont
 
class PdfCommon
 
class PdfResources
 

Detailed Description

This class assists PdfDocument with caching font information.

Additional to font caching, this class is also responsible for font matching.

PdfFont is an actual font that can be used in a PDF file (i.e. it does also font embedding) and PdfFontMetrics provides only metrics information.

See also
PdfDocument

Member Function Documentation

◆ EmbedFonts()

void PdfFontManager::EmbedFonts ( )

Embed all imported fonts.

Remarks
This is called by PdfDocument before saving, so it's usually not necessary to call it manually

◆ GetCachedFont()

PdfFont * PdfFontManager::GetCachedFont ( const PdfReference ref)

Try getting the font from the cached font map.

Parameters
refthe reference of the font
Returns
the cached font or nullptr

◆ GetOrCreateFont() [1/3]

PdfFont & PoDoFo::PdfFontManager::GetOrCreateFont ( const std::string_view &  fontPath,
const PdfFontCreateParams &  params = { } 
)

Get or create a font from a file path.

Parameters
fontPaththe path to the font file
paramsfont creation params
Returns
a PdfFont object

◆ GetOrCreateFont() [2/3]

PdfFont & PoDoFo::PdfFontManager::GetOrCreateFont ( const std::string_view &  fontPath,
unsigned  faceIndex,
const PdfFontCreateParams &  params = { } 
)

Get or create a font from a file path.

Parameters
fontPaththe path to the font file
faceIndexthe index of the face within the font file
paramsfont creation params
Returns
a PdfFont object

◆ GetOrCreateFont() [3/3]

PdfFont & PdfFontManager::GetOrCreateFont ( PdfFontMetricsConstPtr  metrics,
const PdfFontCreateParams &  params = { } 
)

Get or create a font from existing metrics.

Parameters
metricsthe font metrics
paramsfont creation params
Returns
a PdfFont object

◆ GetOrCreateFontFromBuffer() [1/2]

PdfFont & PdfFontManager::GetOrCreateFontFromBuffer ( const bufferview buffer,
const PdfFontCreateParams &  params = { } 
)

Get or create a font from a buffer.

Parameters
bufferthe buffer containing the font data
paramsfont creation params
Returns
a PdfFont object

◆ GetOrCreateFontFromBuffer() [2/2]

PdfFont & PdfFontManager::GetOrCreateFontFromBuffer ( const bufferview buffer,
unsigned  faceIndex,
const PdfFontCreateParams &  params = { } 
)

Get or create a font from a buffer.

Parameters
bufferthe buffer containing the font data
faceIndexthe index of the face within the font file
paramsfont creation params
Returns
a PdfFont object

◆ GetStandard14Font()

PdfFont & PdfFontManager::GetStandard14Font ( PdfStandard14FontType  stdFont,
const PdfFontCreateParams &  params = { } 
)

Get a Standard 14 font.

Parameters
stdFontthe standard 14 font type
paramsfont creation params
Returns
a PdfFont object

◆ SearchFont() [1/2]

PdfFont * PoDoFo::PdfFontManager::SearchFont ( const std::string_view &  fontPattern,
const PdfFontCreateParams &  createParams 
)

Get a font from the cache.

If the font does not yet exist, add it to the cache.

Parameters
fontPatterna search font pattern
createParamsfont creation params
Returns
a PdfFont object or nullptr if the font could not be created or found.

◆ SearchFont() [2/2]

PdfFont * PoDoFo::PdfFontManager::SearchFont ( const std::string_view &  fontPattern,
const PdfFontSearchParams &  searchParams = { },
const PdfFontCreateParams &  createParams = { } 
)

Get a font from the cache.

If the font does not yet exist, add it to the cache.

Parameters
fontPatterna search font pattern
searchParamsfont search params
createParamsfont creation params
Returns
a PdfFont object or nullptr if the font could not be created or found.

◆ SearchFontMetrics()

static PdfFontMetricsConstPtr PoDoFo::PdfFontManager::SearchFontMetrics ( const std::string_view &  fontPattern,
const PdfFontSearchParams &  params = { } 
)
static

Try to search for fontmetrics from the given fontname and parameters.

Parameters
fontPatterna search font pattern
paramsfont search params
Returns
the found metrics. Null if not found

The documentation for this class was generated from the following files: