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

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

#include <pdffontdatatype0.h>

Inheritance diagram for wxPdfFontDataType0:
wxPdfFontData

Public Member Functions

 wxPdfFontDataType0 ()
 < Default constructor
 
 wxPdfFontDataType0 (const wxString &family, const wxString &name, const wxString &encoding, const wxString &ordering, const wxString &supplement, const wxString &cmap, short *cwArray, const wxPdfFontDescription &desc)
 Constructor.
 
virtual ~wxPdfFontDataType0 ()
 Default destructor.
 
virtual wxString GetWidthsAsString (bool subset, wxPdfSortedArrayInt *usedGlyphs=NULL, wxPdfChar2GlyphMap *subsetGlyphs=NULL) const
 Get the character width array as string.
 
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 bool LoadFontMetrics (wxXmlNode *root)
 Load the font metrics XML file.
 
virtual wxMBConv * GetEncodingConv () const
 Get the associated encoding converter.
 
virtual void CreateDefaultEncodingConv ()
 Create the associated default encoding converter.
 
void SetHalfWidthRanges (bool hwRange, wxUniChar hwFirst, wxUniChar hwLast)
 
- 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 Initialize ()
 Initialize font data.
 
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 bool GetGlyphNames (wxArrayString &glyphNames) const
 Get list of glyph names supported by this 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.
 
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 HasHalfWidthRange () const
 Check whether the font has a half width range.
 
wxUniChar HalfWidthRangeFirst () const
 Get the first character in the half width range.
 
wxUniChar HalfWidthRangeLast () const
 Get the last character in the half width range.
 
- 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

bool m_hwRange
 Flag whether the font has a half width range.
 
wxUniChar m_hwFirst
 CID of the first half width character.
 
wxUniChar m_hwLast
 CID of the last half width character.
 
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 0 fonts. (For internal use only)

Constructor & Destructor Documentation

◆ wxPdfFontDataType0() [1/2]

wxPdfFontDataType0::wxPdfFontDataType0 ( )

< Default constructor

◆ wxPdfFontDataType0() [2/2]

wxPdfFontDataType0::wxPdfFontDataType0 ( const wxString & family,
const wxString & name,
const wxString & encoding,
const wxString & ordering,
const wxString & supplement,
const wxString & cmap,
short * cwArray,
const wxPdfFontDescription & desc )

Constructor.

Parameters
familythe family name of the font
namethe font name
encodingthe font's encoding
orderingthe font's registry ordering
supplementthe font's registry supplement
cmapthe font's cmap
cwArrayan array with the character widths
desca font description

◆ ~wxPdfFontDataType0()

virtual wxPdfFontDataType0::~wxPdfFontDataType0 ( )
virtual

Default destructor.

Member Function Documentation

◆ CanShow()

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

◆ CreateDefaultEncodingConv()

virtual void wxPdfFontDataType0::CreateDefaultEncodingConv ( )
virtual

Create the associated default encoding converter.

Reimplemented from wxPdfFontData.

◆ GetEncodingConv()

virtual wxMBConv * wxPdfFontDataType0::GetEncodingConv ( ) const
inlinevirtual

Get the associated encoding converter.

Returns
the encoding converter associated with this font

Reimplemented from wxPdfFontData.

◆ GetStringWidth()

virtual double wxPdfFontDataType0::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 wxPdfFontDataType0::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.

◆ HalfWidthRangeFirst()

wxUniChar wxPdfFontDataType0::HalfWidthRangeFirst ( ) const
inlineprotected

Get the first character in the half width range.

◆ HalfWidthRangeLast()

wxUniChar wxPdfFontDataType0::HalfWidthRangeLast ( ) const
inlineprotected

Get the last character in the half width range.

◆ HasHalfWidthRange()

bool wxPdfFontDataType0::HasHalfWidthRange ( ) const
inlineprotected

Check whether the font has a half width range.

◆ LoadFontMetrics()

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

◆ SetHalfWidthRanges()

void wxPdfFontDataType0::SetHalfWidthRanges ( bool hwRange,
wxUniChar hwFirst,
wxUniChar hwLast )
Parameters
hwRangeflag whether font has a half-width range
hwFirstCID of the first half-width character
hwLastCID of the last half-width character

Member Data Documentation

◆ m_conv

wxMBConv* wxPdfFontDataType0::m_conv
protected

Associated encoding converter.

◆ m_hwFirst

wxUniChar wxPdfFontDataType0::m_hwFirst
protected

CID of the first half width character.

◆ m_hwLast

wxUniChar wxPdfFontDataType0::m_hwLast
protected

CID of the last half width character.

◆ m_hwRange

bool wxPdfFontDataType0::m_hwRange
protected

Flag whether the font has a half width range.


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