wxPdfDocument 1.2.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
wxPdfFontDataType1 Class Reference

Class representing Type 1 fonts. (For internal use only) More...

#include <pdffontdatatype1.h>

Inheritance diagram for wxPdfFontDataType1:
wxPdfFontData

Public Member Functions

 wxPdfFontDataType1 (wxMemoryInputStream *pfbStream=NULL)
 < Default constructor
 
virtual ~wxPdfFontDataType1 ()
 Default destructor.
 
virtual double GetStringWidth (const wxString &s, const wxPdfEncoding *encoding=NULL, bool withKerning=false, double charSpacing=0) const
 Get the width of a string.
 
virtual bool CanShow (const wxString &s, const wxPdfEncoding *encoding=NULL) const
 Check whether the font oan show all characters of a given string.
 
virtual wxString ConvertCID2GID (const wxString &s, const wxPdfEncoding *encoding, wxPdfSortedArrayInt *usedGlyphs=NULL, wxPdfChar2GlyphMap *subsetGlyphs=NULL) const
 Convert character codes to glyph numbers.
 
virtual bool LoadFontMetrics (wxXmlNode *root)
 Load the font metrics XML file.
 
virtual bool Initialize ()
 Initialize font data.
 
virtual wxString GetWidthsAsString (bool subset=false, wxPdfSortedArrayInt *usedGlyphs=NULL, wxPdfChar2GlyphMap *subsetGlyphs=NULL) const
 Get the character width array as string.
 
virtual wxString GetWidthsAsString (const wxArrayString &glyphNames, bool subset=false, wxPdfSortedArrayInt *usedGlyphs=NULL, wxPdfChar2GlyphMap *subsetGlyphs=NULL) const
 Get the character width array as string.
 
virtual bool GetGlyphNames (wxArrayString &glyphNames) const
 Get a list of glyph names available in the font.
 
virtual size_t WriteFontData (wxOutputStream *fontData, wxPdfSortedArrayInt *usedGlyphs=NULL, wxPdfChar2GlyphMap *subsetGlyphs=NULL)
 Write font data.
 
virtual size_t WriteUnicodeMap (wxOutputStream *mapData, const wxPdfEncoding *encoding=NULL, wxPdfSortedArrayInt *usedGlyphs=NULL, wxPdfChar2GlyphMap *subsetGlyphs=NULL)
 Write character/glyph to unicode mapping.
 
void SetEncodingType (const wxString &encodingType)
 Set the encoding type.
 
wxString GetEncodingType () const
 Get the encoding type.
 
void SetEncodingMap (const wxArrayString &encodingMap)
 Set encoding map.
 
wxArrayString GetEncodingMap () const
 Get encoding map.
 
void SetType1GlyphWidthMap (wxPdfFontType1GlyphWidthMap *glyphWidthMap)
 Set glyph width map.
 
virtual wxMBConv * GetEncodingConv () const
 Get the associated encoding converter.
 
virtual void CreateDefaultEncodingConv ()
 Create the associated default encoding converter.
 
- Public Member Functions inherited from wxPdfFontData
 wxPdfFontData ()
 Default constructor.
 
virtual ~wxPdfFontData ()
 Default destructor.
 
bool IsInitialized () const
 Check initialization state.
 
void SetInitialized (bool initialized)
 Set initialization state.
 
void SetType (const wxString &type)
 Set font type.
 
wxString GetType () const
 Get font type.
 
void SetFamily (const wxString &name)
 Set font family name.
 
wxString GetFamily () const
 Get font family name.
 
void SetAlias (const wxString &alias)
 Set font family alias.
 
wxString GetAlias () const
 Get font family alias.
 
void SetName (const wxString &name)
 Set font name.
 
wxString GetName () const
 Get font name.
 
void SetFullNames (const wxArrayString &fullNames)
 Set list of full font names.
 
wxArrayString GetFullNames () const
 Get list of full font names.
 
void SetStyle (int style)
 Set font style.
 
void SetStyle (const wxString &style)
 Set font style.
 
void SetStyleFromName ()
 Set font style based on font name.
 
int GetStyle () const
 Get font style.
 
bool EmbedRequired ()
 Set embed support flag.
 
bool EmbedSupported () const
 Check whether the font embedding is required.
 
bool SubsetSupported () const
 Check whether the font subsetting is supported.
 
void SetEmbedSupported (bool embedSupported)
 Set embed support flag.
 
void SetSubsetSupported (bool subsetSupported)
 Set subset support flag.
 
void SetFontFileName (const wxString &fontFileName)
 Set fully qualified font file name.
 
wxString GetFontFileName () const
 Get fully qualified font file name.
 
void SetFontIndex (int fontIndex)
 Set font index in case the font is member of a font collection.
 
int GetFontIndex () const
 Get font index.
 
bool HasCff () const
 Check whether the font is in compact font format.
 
size_t GetCffOffset () const
 Get the offset of the CFF section within the font file.
 
size_t GetCffLength () const
 Get the length of the CFF section.
 
void SetUnderlinePosition (int up)
 Set underline position.
 
int GetUnderlinePosition () const
 Get underline position.
 
void SetUnderlineThickness (int ut)
 Set underline thickness.
 
int GetUnderlineThickness () const
 Get underline thickness.
 
int GetBBoxTopPosition () const
 Get bounding box top position.
 
void SetEncoding (const wxString &encoding)
 Set encoding.
 
wxString GetEncoding () const
 Get encoding.
 
const wxPdfEncodingGetBaseEncoding () const
 Get encoding.
 
bool HasDiffs () const
 Check whether the font has differences to WinAnsi encoding.
 
void SetDiffs (const wxString &diffs)
 Set encoding differences.
 
wxString GetDiffs () const
 Get encoding differences.
 
void SetFilePath (const wxString &path)
 Set path of font files.
 
wxString GetFilePath () const
 Get path of font files.
 
bool HasFile () const
 Check whether the font has an associated font file.
 
void SetFontFile (const wxString &file)
 Set the name of the font file created by MakeFont.
 
wxString GetFontFile () const
 Get the name of the associated font file.
 
void SetCtgFile (const wxString &ctg)
 Set the name of the character to glyph mapping file created by MakeFont.
 
wxString GetCtgFile () const
 Get the name of the character to glyph mapping file created by MakeFont.
 
void SetSize1 (size_t size1)
 Get font file size 1.
 
size_t GetSize1 () const
 Get font file size 1.
 
bool HasSize2 () const
 Check whether the file has a size 2.
 
void SetSize2 (size_t size2)
 Set font file size 2.
 
size_t GetSize2 () const
 Get font file size 2 (Type 1 only)
 
void SetCMap (const wxString &cmap)
 Set font CMap.
 
wxString GetCMap () const
 Get the font's CMap (Type 0 only)
 
void SetOrdering (const wxString &ordering)
 Set font ordering.
 
wxString GetOrdering () const
 Get font ordering.
 
void SetSupplement (const wxString &supplement)
 Set font supplement.
 
wxString GetSupplement () const
 Get font supplement (Type 0 only)
 
void SetGlyphWidthMap (wxPdfGlyphWidthMap *cw)
 Set glyph width map.
 
const wxPdfGlyphWidthMap * GetGlyphWidthMap () const
 Get glyph width map.
 
void SetChar2GlyphMap (wxPdfChar2GlyphMap *gn)
 Set character to glyph number map.
 
const wxPdfChar2GlyphMap * GetChar2GlyphMap () const
 Get character to glyph number map.
 
void SetKernPairMap (wxPdfKernPairMap *kp)
 Set kerning pair map.
 
const wxPdfKernPairMap * GetKernPairMap () const
 Get kerning pair map.
 
int GetKerningWidth (const wxString &s) const
 Get width of string taking kerning into account.
 
wxArrayInt GetKerningWidthArray (const wxString &s) const
 Get kerning width array.
 
void SetSubset (bool subset)
 Set subset flag if font subsetting is supported.
 
virtual bool HasVoltData () const
 Check whether VOLT data are available.
 
virtual wxString ApplyVoltData (const wxString &s) const
 Applay VOLT data.
 
virtual wxString ConvertToValid (const wxString &s, wxUniChar replace=wxS('?')) const
 Force string to valid string in respect of the current font encoding.
 
virtual wxString ConvertGlyph (wxUint32 glyph, const wxPdfEncoding *encoding=NULL, wxPdfSortedArrayInt *usedGlyphs=NULL, wxPdfChar2GlyphMap *subsetGlyphs=NULL) const
 Convert glyph number to string.
 
virtual size_t WriteCIDToGIDMap (wxOutputStream *mapData, const wxPdfEncoding *encoding=NULL, wxPdfSortedArrayInt *usedGlyphs=NULL, wxPdfChar2GlyphMap *subsetGlyphs=NULL)
 Write CID to GID mapping.
 
virtual size_t WriteCIDSet (wxOutputStream *setData, const wxPdfEncoding *encoding=NULL, wxPdfSortedArrayInt *usedGlyphs=NULL, wxPdfChar2GlyphMap *subsetGlyphs=NULL)
 Write CID set.
 
void SetDescription (const wxPdfFontDescription &desc)
 Set the font description.
 
virtual const wxPdfFontDescriptionGetDescription () const
 Get the font description.
 
virtual void SetGlyphWidths (const wxPdfArrayUint16 &glyphWidths)
 Set the glyph widths.
 
bool GetFontDescription (const wxXmlNode *node, wxPdfFontDescription &fontDescription)
 Get the font description from XML.
 

Protected Member Functions

bool CompressFontData (wxOutputStream *fontData, wxInputStream *pfbFile)
 Compress the font data.
 
- Protected Member Functions inherited from wxPdfFontData
const wxPdfChar2GlyphMap * FindEncodingMap (const wxPdfEncoding *encoding) const
 Find the encoding map to be used for character to glyph conversion.
 

Protected Attributes

wxString m_encodingType
 encoding type
 
wxArrayString m_encodingMap
 encoding map
 
wxArrayString m_glyphNames
 list of glyph names
 
wxPdfFontType1GlyphWidthMap * m_glyphWidthMap
 mapping of glyph widths
 
wxMemoryInputStream * m_pfbStream
 Font stream in PFB format.
 
wxMBConv * m_conv
 Associated encoding converter.
 
- Protected Attributes inherited from wxPdfFontData
wxString m_type
 Font type.
 
wxString m_family
 Font family.
 
wxString m_alias
 Font family alias.
 
wxString m_name
 Font name.
 
wxArrayString m_fullNames
 List of full font names.
 
int m_style
 Font style flags.
 
bool m_initialized
 Flag whether the font has been initialized.
 
bool m_embedRequired
 Flag whether embedding of the font is allowed and supported.
 
bool m_embedSupported
 Flag whether embedding of the font is allowed and supported.
 
bool m_subsetSupported
 Flag whether subsetting of the font is allowed and supported.
 
wxString m_fontFileName
 Qualified name of the font file.
 
int m_fontIndex
 Index of the font in case of a font collection.
 
wxFont m_font
 Associated wxFont object (currently used by wxMSW only)
 
wxPdfGlyphWidthMap * m_cw
 Mapping of character ids to character widths.
 
wxPdfChar2GlyphMap * m_gn
 Mapping of character ids to glyph numbers.
 
wxPdfKernPairMap * m_kp
 Kerning pair map.
 
wxPdfFontDescription m_desc
 Font description.
 
wxString m_enc
 Encoding.
 
wxString m_diffs
 Encoding differences.
 
wxString m_path
 Path of font files.
 
wxString m_file
 Filename of font program.
 
wxString m_ctg
 Filename of char to glyph mapping.
 
size_t m_size1
 TrueType file size or Type1 file size 1.
 
size_t m_size2
 Type1 file size 2.
 
bool m_cff
 Flag whether the font has a CFF table.
 
size_t m_cffOffset
 Offset of the CFF table of a TrueType/OpenType font.
 
size_t m_cffLength
 Lenght of the CFF table of a TrueType/OpenType font.
 
wxString m_cmap
 CMap of a CID font.
 
wxString m_ordering
 Ordering of a CID font.
 
wxString m_supplement
 Supplement of a CID font.
 
wxPdfEncodingm_encoding
 Encoding.
 
wxPdfEncodingCheckerm_encodingChecker
 Encoding checker.
 

Additional Inherited Members

- Static Public Member Functions inherited from wxPdfFontData
static wxMBConv * GetWinEncodingConv ()
 Get the default WinAnsi encoding converter.
 
static wxString GetNodeContent (const wxXmlNode *node)
 Get the content of an XML node.
 
- Static Protected Member Functions inherited from wxPdfFontData
static int FindStyleFromName (const wxString &name)
 Determine font style from font name.
 
static int CompareGlyphListEntries (wxPdfGlyphListEntry *item1, wxPdfGlyphListEntry *item2)
 Compare glyph list entries.
 
static void WriteStreamBuffer (wxOutputStream &stream, const char *buffer)
 Write a buffer to a stream.
 
static void WriteToUnicode (wxPdfGlyphList &glyphs, wxMemoryOutputStream &toUnicode, bool simple=false)
 Write a mapping from glyphs to unicode to a stream.
 
- Static Protected Attributes inherited from wxPdfFontData
static wxMBConv * ms_winEncoding
 WinAnsi converter.
 

Detailed Description

Class representing Type 1 fonts. (For internal use only)

Constructor & Destructor Documentation

◆ wxPdfFontDataType1()

wxPdfFontDataType1::wxPdfFontDataType1 ( wxMemoryInputStream * pfbStream = NULL)

< Default constructor

◆ ~wxPdfFontDataType1()

virtual wxPdfFontDataType1::~wxPdfFontDataType1 ( )
virtual

Default destructor.

Member Function Documentation

◆ CanShow()

virtual bool wxPdfFontDataType1::CanShow ( const wxString & s,
const wxPdfEncoding * encoding = NULL ) const
virtual

Check whether the font oan show all characters of a given string.

Parameters
sthe string to be checked
encodingthe character to glyph mapping
Returns
TRUE if the font can show all characters of the string, FALSE otherwise

Reimplemented from wxPdfFontData.

◆ CompressFontData()

bool wxPdfFontDataType1::CompressFontData ( wxOutputStream * fontData,
wxInputStream * pfbFile )
protected

Compress the font data.

◆ ConvertCID2GID()

virtual wxString wxPdfFontDataType1::ConvertCID2GID ( const wxString & s,
const wxPdfEncoding * encoding,
wxPdfSortedArrayInt * usedGlyphs = NULL,
wxPdfChar2GlyphMap * subsetGlyphs = NULL ) const
virtual

Convert character codes to glyph numbers.

Parameters
sthe string to be converted
encodingthe character to glyph mapping
usedGlyphsthe list of used glyphs
subsetGlyphsthe mapping of glyphs to subset glyphs
Returns
the converted string

Reimplemented from wxPdfFontData.

◆ CreateDefaultEncodingConv()

virtual void wxPdfFontDataType1::CreateDefaultEncodingConv ( )
virtual

Create the associated default encoding converter.

Reimplemented from wxPdfFontData.

◆ GetEncodingConv()

virtual wxMBConv * wxPdfFontDataType1::GetEncodingConv ( ) const
inlinevirtual

Get the associated encoding converter.

Returns
the encoding converter associated with this font

Reimplemented from wxPdfFontData.

◆ GetEncodingMap()

wxArrayString wxPdfFontDataType1::GetEncodingMap ( ) const
inline

Get encoding map.

Returns
the encoding map

◆ GetEncodingType()

wxString wxPdfFontDataType1::GetEncodingType ( ) const
inline

Get the encoding type.

Returns
the encoding type

◆ GetGlyphNames()

virtual bool wxPdfFontDataType1::GetGlyphNames ( wxArrayString & glyphNames) const
virtual

Get a list of glyph names available in the font.

Parameters
[out]glyphNamesthe list of glyph names
Returns
TRUE if the glyph names are available, FALSE otherwise

Reimplemented from wxPdfFontData.

◆ GetStringWidth()

virtual double wxPdfFontDataType1::GetStringWidth ( const wxString & s,
const wxPdfEncoding * encoding = NULL,
bool withKerning = false,
double charSpacing = 0 ) const
virtual

Get the width of a string.

Parameters
sthe string for which the width should be calculated
encodingthe character to glyph mapping
withKerningflag indicating whether kerning should be taken into account
charSpacingextra amount of spacing between characters (optional)
Returns
the width of the string

Reimplemented from wxPdfFontData.

◆ GetWidthsAsString() [1/2]

virtual wxString wxPdfFontDataType1::GetWidthsAsString ( bool subset = false,
wxPdfSortedArrayInt * usedGlyphs = NULL,
wxPdfChar2GlyphMap * subsetGlyphs = NULL ) const
virtual

Get the character width array as string.

Parameters
subsetflag whether subsetting is enabled
usedGlyphsthe list of used glyphs
subsetGlyphsthe mapping of glyphs to subset glyphs
Returns
the string representation of the character widths

Reimplemented from wxPdfFontData.

◆ GetWidthsAsString() [2/2]

virtual wxString wxPdfFontDataType1::GetWidthsAsString ( const wxArrayString & glyphNames,
bool subset = false,
wxPdfSortedArrayInt * usedGlyphs = NULL,
wxPdfChar2GlyphMap * subsetGlyphs = NULL ) const
virtual

Get the character width array as string.

Parameters
glyphNamesthe list of glyph names available in the font
subsetflag whether subsetting is enabled
usedGlyphsthe list of used glyphs
subsetGlyphsthe mapping of glyphs to subset glyphs
Returns
the string representation of the character widths

◆ Initialize()

virtual bool wxPdfFontDataType1::Initialize ( )
virtual

Initialize font data.

Returns
TRUE if the font data has been initialized successfully, FALSE otherwise

Reimplemented from wxPdfFontData.

◆ LoadFontMetrics()

virtual bool wxPdfFontDataType1::LoadFontMetrics ( wxXmlNode * root)
virtual

Load the font metrics XML file.

Parameters
rootthe root node of the XML font metric file
Returns
TRUE if the metric file could be processed successfully, FALSE otherwise

Reimplemented from wxPdfFontData.

◆ SetEncodingMap()

void wxPdfFontDataType1::SetEncodingMap ( const wxArrayString & encodingMap)
inline

Set encoding map.

Parameters
encodingMapthe encoding map

◆ SetEncodingType()

void wxPdfFontDataType1::SetEncodingType ( const wxString & encodingType)
inline

Set the encoding type.

Parameters
encodingTypethe encoding type

◆ SetType1GlyphWidthMap()

void wxPdfFontDataType1::SetType1GlyphWidthMap ( wxPdfFontType1GlyphWidthMap * glyphWidthMap)
inline

Set glyph width map.

Parameters
glyphWidthMapthe map of glyph widths

◆ WriteFontData()

virtual size_t wxPdfFontDataType1::WriteFontData ( wxOutputStream * fontData,
wxPdfSortedArrayInt * usedGlyphs = NULL,
wxPdfChar2GlyphMap * subsetGlyphs = NULL )
virtual

Write font data.

Parameters
fontDatathe output stream
usedGlyphsthe list of used glyphs
subsetGlyphsthe mapping of glyphs to subset glyphs
Returns
the size of the written font data

Reimplemented from wxPdfFontData.

◆ WriteUnicodeMap()

virtual size_t wxPdfFontDataType1::WriteUnicodeMap ( wxOutputStream * mapData,
const wxPdfEncoding * encoding = NULL,
wxPdfSortedArrayInt * usedGlyphs = NULL,
wxPdfChar2GlyphMap * subsetGlyphs = NULL )
virtual

Write character/glyph to unicode mapping.

Parameters
mapDatathe output stream
encodingthe character to glyph mapping
usedGlyphsthe list of used glyphs
subsetGlyphsthe mapping of glyphs to subset glyphs
Returns
the size of the written data

Reimplemented from wxPdfFontData.

Member Data Documentation

◆ m_conv

wxMBConv* wxPdfFontDataType1::m_conv
protected

Associated encoding converter.

◆ m_encodingMap

wxArrayString wxPdfFontDataType1::m_encodingMap
protected

encoding map

◆ m_encodingType

wxString wxPdfFontDataType1::m_encodingType
protected

encoding type

◆ m_glyphNames

wxArrayString wxPdfFontDataType1::m_glyphNames
protected

list of glyph names

◆ m_glyphWidthMap

wxPdfFontType1GlyphWidthMap* wxPdfFontDataType1::m_glyphWidthMap
protected

mapping of glyph widths

◆ m_pfbStream

wxMemoryInputStream* wxPdfFontDataType1::m_pfbStream
protected

Font stream in PFB format.


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