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

Class representing Unicode OpenType fonts. (For internal use only) More...

#include <pdffontdataopentype.h>

Inheritance diagram for wxPdfFontDataOpenTypeUnicode:
wxPdfFontData

Public Member Functions

 wxPdfFontDataOpenTypeUnicode ()
 < Default constructor
 
virtual ~wxPdfFontDataOpenTypeUnicode ()
 Default destructor.
 
virtual bool Initialize ()
 Initialize font data.
 
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=NULL, wxPdfSortedArrayInt *usedGlyphs=NULL, wxPdfChar2GlyphMap *subsetGlyphs=NULL) const
 Convert character codes to glyph numbers.
 
virtual wxString ConvertGlyph (wxUint32 glyph, const wxPdfEncoding *encoding=NULL, wxPdfSortedArrayInt *usedGlyphs=NULL, wxPdfChar2GlyphMap *subsetGlyphs=NULL) const
 Convert glyph number to string.
 
virtual wxString GetWidthsAsString (bool subset, wxPdfSortedArrayInt *usedGlyphs=NULL, wxPdfChar2GlyphMap *subsetGlyphs=NULL) const
 Get the character width array as string.
 
virtual bool LoadFontMetrics (wxXmlNode *root)
 Load the font metrics XML file.
 
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.
 
virtual size_t WriteCIDSet (wxOutputStream *setData, const wxPdfEncoding *encoding=NULL, wxPdfSortedArrayInt *usedGlyphs=NULL, wxPdfChar2GlyphMap *subsetGlyphs=NULL)
 Write CID set.
 
virtual wxMBConv * GetEncodingConv () const
 Get the associated encoding converter.
 
virtual void CreateDefaultEncodingConv ()
 Create the associated default encoding converter.
 
void SetCffOffset (size_t cffOffset)
 Set the offset of the CFF section.
 
void SetCffLength (size_t cffLength)
 Set the lenght of the CFF section.
 
virtual void SetGlyphWidths (const wxPdfArrayUint16 &glyphWidths)
 Set glyph widths array.
 
- 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 bool GetGlyphNames (wxArrayString &glyphNames) const
 Get list of glyph names supported by this font.
 
virtual size_t WriteCIDToGIDMap (wxOutputStream *mapData, const wxPdfEncoding *encoding=NULL, wxPdfSortedArrayInt *usedGlyphs=NULL, wxPdfChar2GlyphMap *subsetGlyphs=NULL)
 Write CID to GID mapping.
 
void SetDescription (const wxPdfFontDescription &desc)
 Set the font description.
 
virtual const wxPdfFontDescriptionGetDescription () const
 Get the font description.
 
bool GetFontDescription (const wxXmlNode *node, wxPdfFontDescription &fontDescription)
 Get the font description from XML.
 

Protected Attributes

wxPdfArrayUint16 * m_gw
 Array of glyph widths.
 
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.
 
- 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.
 
- 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 Unicode OpenType fonts. (For internal use only)

Constructor & Destructor Documentation

◆ wxPdfFontDataOpenTypeUnicode()

wxPdfFontDataOpenTypeUnicode::wxPdfFontDataOpenTypeUnicode ( )

< Default constructor

◆ ~wxPdfFontDataOpenTypeUnicode()

virtual wxPdfFontDataOpenTypeUnicode::~wxPdfFontDataOpenTypeUnicode ( )
virtual

Default destructor.

Member Function Documentation

◆ CanShow()

virtual bool wxPdfFontDataOpenTypeUnicode::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.

◆ ConvertCID2GID()

virtual wxString wxPdfFontDataOpenTypeUnicode::ConvertCID2GID ( const wxString & s,
const wxPdfEncoding * encoding = NULL,
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.

◆ ConvertGlyph()

virtual wxString wxPdfFontDataOpenTypeUnicode::ConvertGlyph ( wxUint32 glyph,
const wxPdfEncoding * encoding = NULL,
wxPdfSortedArrayInt * usedGlyphs = NULL,
wxPdfChar2GlyphMap * subsetGlyphs = NULL ) const
virtual

Convert glyph number to string.

Parameters
glyphthe glyph 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 wxPdfFontDataOpenTypeUnicode::CreateDefaultEncodingConv ( )
virtual

Create the associated default encoding converter.

Reimplemented from wxPdfFontData.

◆ GetEncodingConv()

virtual wxMBConv * wxPdfFontDataOpenTypeUnicode::GetEncodingConv ( ) const
inlinevirtual

Get the associated encoding converter.

Returns
the encoding converter associated with this font

Reimplemented from wxPdfFontData.

◆ GetStringWidth()

virtual double wxPdfFontDataOpenTypeUnicode::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()

virtual wxString wxPdfFontDataOpenTypeUnicode::GetWidthsAsString ( bool subset,
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.

◆ Initialize()

virtual bool wxPdfFontDataOpenTypeUnicode::Initialize ( )
virtual

Initialize font data.

Returns
TRUE if the font data are initialized, FALSE otherwise

Reimplemented from wxPdfFontData.

◆ LoadFontMetrics()

virtual bool wxPdfFontDataOpenTypeUnicode::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.

◆ SetCffLength()

void wxPdfFontDataOpenTypeUnicode::SetCffLength ( size_t cffLength)
inline

Set the lenght of the CFF section.

Parameters
cffLengththe offset of the CFF section

◆ SetCffOffset()

void wxPdfFontDataOpenTypeUnicode::SetCffOffset ( size_t cffOffset)
inline

Set the offset of the CFF section.

Parameters
cffOffsetthe offset of the CFF section

◆ SetGlyphWidths()

virtual void wxPdfFontDataOpenTypeUnicode::SetGlyphWidths ( const wxPdfArrayUint16 & glyphWidths)
virtual

Set glyph widths array.

Parameters
glyphWidthsarray with glyph widths

Reimplemented from wxPdfFontData.

◆ WriteCIDSet()

virtual size_t wxPdfFontDataOpenTypeUnicode::WriteCIDSet ( wxOutputStream * setData,
const wxPdfEncoding * encoding = NULL,
wxPdfSortedArrayInt * usedGlyphs = NULL,
wxPdfChar2GlyphMap * subsetGlyphs = NULL )
virtual

Write CID set.

Parameters
setDatathe 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.

◆ WriteFontData()

virtual size_t wxPdfFontDataOpenTypeUnicode::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 wxPdfFontDataOpenTypeUnicode::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* wxPdfFontDataOpenTypeUnicode::m_conv
protected

Associated encoding converter.

◆ m_gw

wxPdfArrayUint16* wxPdfFontDataOpenTypeUnicode::m_gw
protected

Array of glyph widths.


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