Mako 7.5.0 API
Loading...
Searching...
No Matches
IDOMFontOpenType Class Referenceabstract

IDOMFontOpenType interface. More...

#include <idomfont.h>

Inheritance diagram for IDOMFontOpenType:

Classes

class  CCIDMap
 For TrueType-based CIDFonts, the mapping from CIDs to GlyphIds for non-identity orderings. More...
 
class  Data
 Initialization data. More...
 

Public Types

enum  eOpenTypeFontType { eOpenTypeFontTypeUnknown , eOpenTypeFontTypeTTF , eOpenTypeFontTypeCFF , eOpenTypeFontTypeTTC }
 Type used to uniquely identify the type of OpenType font. More...
 
enum  eOriginalFontType {
  eOriginalTypeOpenType , eOriginalType1 , eOriginalType2 , eOriginalType42 ,
  eOriginalType9 , eOriginalType11 , eOriginalPclTrueType
}
 Type used to uniquely identify the original type of Font. In the PostScript/PDF inputs, most font types are converted to OpenType before insertion into the DOM. This allows the ability to discover what the original type was. More...
 
- Public Types inherited from IDOMFont
enum  eFontType {
  eFontTypeUnknown , eFontTypeOpenType , eFontType3 , eFontTypePCLXL ,
  eFontTypePCL5
}
 type used to uniquely identify the type of font More...
 
typedef uint32 CharCode
 type used to uniquely identify a character code
 
typedef std::map< CharCode, IDOMGlyph::GlyphIDCCharacterMap
 Map type used for storing character code to glyph ID mappings.
 
- Public Types inherited from IDOMFontSource
enum  eFontSourceType { eFontSourceTypeNone , eFontSourceTypeStreamFilter , eFontSourceTypeStream , eFontSourceTypeFont }
 type used to uniquely identify the source type of a font More...
 

Public Member Functions

virtual bool getObfuscated () const =0
 Returns true if font is obfuscated. Obfuscated fonts are only found in XPS Documents.
 
virtual bool getIsPSStandardFont () const =0
 Establishes whether the font is a standard PostScript font.
 
virtual bool getIsPDFStandardFont () const =0
 Establishes whether the font is a standard PDF font.
 
virtual bool getEmbedded () const =0
 Establishes whether the font is flagged for embeddeding.
 
virtual void setEmbedded (bool embedded)=0
 Sets whether of not the font is flagged for embeddeding.
 
virtual bool getSubsetted () const =0
 Requests if the font reports to be a subset.
 
virtual EDLRawString getRequestedFontName () const =0
 Get the name of the font as requested by the input document. This is only useful for PDF and PostScript input. If a font has to be substituted for another requested font, this will return the name of the font the input desired. The encoding of this font name is not defined.
 
virtual EDLSysString getPostScriptName (IEDLClassFactory *pFactory, int32 fontIndex)=0
 Get the "PostScript" Name of the font, from the font data itself. This is usually extracted from the 'name' OpenType table, but may be synthesized if the name cannot be obtained.
 
virtual EDLSysString getFullName (IEDLClassFactory *pFactory, int32 fontIndex)=0
 Get the "Full" Name of the font, from the font data itself. This is usually extracted from the 'name' OpenType table, but may be synthesized if the name cannot be obtained.
 
virtual eOpenTypeFontType getOpenTypeFontType ()=0
 Returns the sub font type for this opentype font.
 
virtual eOriginalFontType getOriginalFontType ()=0
 Returns the original font type for this opentype font.
 
virtual IFontOpenTypeTableAccessorPtr getFontOpenTypeTableAccessor (uint32 fontIndex=0)=0
 Creates an OpenType font table accessor.
 
virtual IFontTrueTypeGlyphAccessorPtr getFontTrueTypeGlyphAccessor (uint32 fontIndex=0, bool stripInstructions=false)=0
 Creates a TrueType glyph accessor.
 
virtual uint16 getFontLicenseFromOS2Table (uint32 fontIndex=0)=0
 Gets the fsType field (embedded licensing information) from the OS/2 table.
 
virtual bool getIsRestricted (uint32 fontIndex=0)=0
 Is the font marked as restricted from embedding according to its license?
 
virtual IDOMFontOpenTypeTTPtr createTrueTypeOnlyFontVersion (const ISessionPtr &ptrSession, bool regenerateStream)=0
 Create a TrueType only font from this OpenType font that may contain CFF fonts.
 
virtual IDOMFontOpenTypePtr createSubsetFont (const ISessionPtr &ptrSession, const CEDLVector< uint16 > &usedGlyphs, const CEDLVector< uint32 > &usedUnicode)=0
 Create a Subsetted version if this font.
 
virtual IDOMFontOpenTypePtr createRenamedFont (const ISessionPtr &ptrSession, const EDLSysString &fontName, uint32 fontIndex=0)=0
 Get a renamed version of this font. An exception of type IEDLError is thrown on failure.
 
virtual const CEDLSimpleBuffer & getOriginalOS2Table () const =0
 Obtain the original OS/2 Table, if present, that was included in the font.
 
virtual CCIDMapConstPtr getCidMap () const =0
 Obtain the CID Map for this font, if present.
 
virtual int32 getFlags () const =0
 Obtain the PDF FontDescriptor Style flags, if present.
 
virtual const CEDLSimpleBuffer & getPanose () const =0
 Obtain the PDF Style Panose information, if present.
 
virtual void setCidMap (const CCIDMapConstPtr &cidMap)=0
 Set or clear the CIDMap for the font. Valid only for TrueType fonts.
 
virtual bool validateInstructions (const ISessionPtr &session, uint32 fontIndex=0)=0
 Validate glyph instructions.
 
virtual IDOMFontOpenTypePtr stripInstructions (const ISessionPtr &session, uint32 fontIndex=0, bool all=false)=0
 Strip glyph instructions.
 
- Public Member Functions inherited from IDOMFont
virtual eFontType getFontType () const =0
 Gets the font type. See eFontType for more information on font types.
 
virtual IDOMFontSourcePtr getFontSource () const =0
 Get the font source of this font.
 
virtual void setFontSource (const IDOMFontSourcePtr &fontSource)=0
 Sets the font source for this font.
 
virtual IInputStreamPtr getFontBaseStream () const =0
 Return the base stream for this font, obtaining it from the font source.
 
virtual void getCharacterMap (CCharacterMap &characterMap, uint32 fontIndex=0U)=0
 Get the character map for this font.
 
- Public Member Functions inherited from IDOMFontSource
virtual eFontSourceType getFontSourceType () const =0
 Gets the font source type.
 
virtual const EDLSysString & determineUri () const =0
 Determines the URI based on the font source (underlying font sources may be searched)
 
- Public Member Functions inherited from IEDLObject
virtual const CClassIDgetClassID () const =0
 Returns class ID of IEDLObject.
 
virtual bool init (CClassParams *pData)
 The init() method is called to perform any post-construction initialization of an IEDLObject that has been created by the EDL class factory, before it is actually returned by the factory.
 
virtual bool clone (IEDLObjectPtr &ptrObject, IEDLClassFactory *pFactory)
 Create a copy of EDLObject.
 
- Public Member Functions inherited from IRCObject
virtual void addRef () const =0
 Increases the reference count of the actual object pointed to. This would take place during an assignment or copying.
 
virtual bool decRef () const =0
 Decreases the reference count of the actual object pointed to. When the reference count falls to Zero, it deletes the actual object pointed to.
 
virtual int32 getRefCount () const =0
 Retrieve the current reference count of the actual object pointed to.
 
- Public Member Functions inherited from IDOMHashable
virtual ~IDOMHashable ()
 Virtual destructor.
 
virtual bool hash (uint64 &hash)=0
 Retrieve a hash for this object.
 
virtual uint64 hashE ()
 As hash(), but throws an exception if the operation fails.
 

Static Public Member Functions

static EDL_API IDOMFontOpenTypePtr create (IEDLClassFactory *pFactory, const IInputStreamPtr &stream)
 Simplified creator of a font from a stream. Throws an IEDLError exception on failure.
 
static const CClassIDclassID ()
 Retrieves the class id of IDOMFontOpenType.
 
- Static Public Member Functions inherited from IDOMFont
static const CClassIDclassID ()
 Retrieves class id of IDOMFont.
 
- Static Public Member Functions inherited from IDOMFontSource
static const CClassIDclassID ()
 Retrieves the class id of IDOMFontSource.
 

Additional Inherited Members

- Protected Member Functions inherited from IRCObject
virtual ~IRCObject ()
 Virtual destructor.
 

Detailed Description

IDOMFontOpenType interface.

Member Function Documentation

◆ classID()

static const CClassID & IDOMFontOpenType::classID ( )
inlinestatic

Retrieves the class id of IDOMFontOpenType.

Returns
CClassID Class id of the element

◆ create()

static EDL_API IDOMFontOpenTypePtr IDOMFontOpenType::create ( IEDLClassFactory * pFactory,
const IInputStreamPtr & stream )
static

Simplified creator of a font from a stream. Throws an IEDLError exception on failure.

Parameters
pFactoryEDL class factory to use.
streamThe font stream.
Returns
IDOMFontOpenTypePtr the new font

◆ createRenamedFont()

virtual IDOMFontOpenTypePtr IDOMFontOpenType::createRenamedFont ( const ISessionPtr & ptrSession,
const EDLSysString & fontName,
uint32 fontIndex = 0 )
pure virtual

Get a renamed version of this font. An exception of type IEDLError is thrown on failure.

Parameters
ptrSessionA pointer to the EDL session.
fontNameThe desired font name
fontIndexThe index of the font, if the font being renamed is a TrueType collection. The default is zero.
Returns
IDOMFontOpenTypePtr The renamed font.

◆ createSubsetFont()

virtual IDOMFontOpenTypePtr IDOMFontOpenType::createSubsetFont ( const ISessionPtr & ptrSession,
const CEDLVector< uint16 > & usedGlyphs,
const CEDLVector< uint32 > & usedUnicode )
pure virtual

Create a Subsetted version if this font.

Provide a vector of glyph IDs and/or unicode codepoints, and a subset font containing only those glyphs required will be generated. Currently only fonts with 3,0 or 3,1 format 4 subtables or a 3,10 format 12 subtable are supported. Glyphs used by composite glyphs that are to be retained in the subfont will be automatically included. Glyphs or codepoints that are out of range will be ignored.

Parameters
ptrSessionA pointer to the EDL session.
usedGlyphsA vector of glyph IDs that should be retained in the subset font.
usedUnicodeA vector of unicode code points whose underlying glyphs should be retained in the subset font.
Returns
IDOMFontOpenTypePtr The subsetted font

◆ createTrueTypeOnlyFontVersion()

virtual IDOMFontOpenTypeTTPtr IDOMFontOpenType::createTrueTypeOnlyFontVersion ( const ISessionPtr & ptrSession,
bool regenerateStream )
pure virtual

Create a TrueType only font from this OpenType font that may contain CFF fonts.

Parameters
ptrSessionA pointer to the EDL session.
regenerateStreamDetermines whether the stream should be regenerated
Returns
IDOMFontOpenTypeTTPtr The resulting TrueType-only font.

◆ getCidMap()

virtual CCIDMapConstPtr IDOMFontOpenType::getCidMap ( ) const
pure virtual

Obtain the CID Map for this font, if present.

     The CIDMap in a PDF CID font describes the mapping from PDF CIDs to
     glyph IDs. In PDF, CIDs may come from a particular ordering and supplement.
     That is, the CIDs conform to a known and understood character set.

     This information is only useful for creating PDF output where the CID information
     needs to be preserved for best interoperability, especially if the font is not
     to be embedded. This information is not required to use this font.

     Mako's PDF input will only create this entry for CID fonts where the CIDMap is
     present and uses an ordering other than Identity.

     Only relevant for TrueType-based CID Fonts.
Returns
CCIDMapConstPtr The CIDMap, or NULL if not present.

◆ getEmbedded()

virtual bool IDOMFontOpenType::getEmbedded ( ) const
pure virtual

Establishes whether the font is flagged for embeddeding.

Inputs will set this to true if the font was embedded in the input or false otherwise. Outputs will honour this setting, if possible, or not overridden. Currently this will only occur for PDF and PS output.

Returns
bool True if the font is flagged for embedding

◆ getFlags()

virtual int32 IDOMFontOpenType::getFlags ( ) const
pure virtual

Obtain the PDF FontDescriptor Style flags, if present.

     The flags are described in the PDF specification. Here the flags are
     masked to the flags that affect style:

     * FixedPitch (bit 1)
     * Serif (bit 2)
     * Script (bit 4)
     * Italic (bit 7)
     * AllCap (bit 17)
     * SmallCap (bit 18)
     * ForceBold (bit 19)

     Currently only present for TrueType-based CID Fonts.
Returns
int32 The flags, or a negative value if not present.

◆ getFontLicenseFromOS2Table()

virtual uint16 IDOMFontOpenType::getFontLicenseFromOS2Table ( uint32 fontIndex = 0)
pure virtual

Gets the fsType field (embedded licensing information) from the OS/2 table.

Parameters
fontIndexThe index of the font
Returns
uint16 The function returns the fsType field from the OS/2 table, or zero if the table does not exist in the font.

◆ getFontOpenTypeTableAccessor()

virtual IFontOpenTypeTableAccessorPtr IDOMFontOpenType::getFontOpenTypeTableAccessor ( uint32 fontIndex = 0)
pure virtual

Creates an OpenType font table accessor.

Parameters
fontIndexThe index of the font - only used for TTC fonts.
Returns
IFontOpenTypeTableAccessorPtr The accessor

◆ getFontTrueTypeGlyphAccessor()

virtual IFontTrueTypeGlyphAccessorPtr IDOMFontOpenType::getFontTrueTypeGlyphAccessor ( uint32 fontIndex = 0,
bool stripInstructions = false )
pure virtual

Creates a TrueType glyph accessor.

Parameters
fontIndexThe index of the font - only used for TTC fonts.
stripInstructionsDetermines whether instructions are stripped. Default is false
Returns
IFontTrueTypeGlyphAccessorPtr The accessor

◆ getFullName()

virtual EDLSysString IDOMFontOpenType::getFullName ( IEDLClassFactory * pFactory,
int32 fontIndex )
pure virtual

Get the "Full" Name of the font, from the font data itself. This is usually extracted from the 'name' OpenType table, but may be synthesized if the name cannot be obtained.

Parameters
fontIndexThe index of the desired font (if a TrueType collection)
pFactoryA pointer to an EDL Class factory.
Returns
EDLSysString The full font name

◆ getIsPDFStandardFont()

virtual bool IDOMFontOpenType::getIsPDFStandardFont ( ) const
pure virtual

Establishes whether the font is a standard PDF font.

Returns
bool True if the font was selected when the input requested a standard PDF font

◆ getIsPSStandardFont()

virtual bool IDOMFontOpenType::getIsPSStandardFont ( ) const
pure virtual

Establishes whether the font is a standard PostScript font.

Returns
bool True if the font was selected when the input requested a standard PostScript font

◆ getIsRestricted()

virtual bool IDOMFontOpenType::getIsRestricted ( uint32 fontIndex = 0)
pure virtual

Is the font marked as restricted from embedding according to its license?

Parameters
fontIndexThe index of the font
Returns
bool true if the font is restricted, false otherwise.

◆ getObfuscated()

virtual bool IDOMFontOpenType::getObfuscated ( ) const
pure virtual

Returns true if font is obfuscated. Obfuscated fonts are only found in XPS Documents.

Embedded font obfuscation is a means of preventing end users from using standard ZIP utilities to extract fonts from XPS format documents and install them on their own systems.

Returns
bool Returns true if the font is obfuscated, false if it is not obfuscated

◆ getOpenTypeFontType()

virtual eOpenTypeFontType IDOMFontOpenType::getOpenTypeFontType ( )
pure virtual

Returns the sub font type for this opentype font.

Returns
eOpenTypeFontType The opentype font type

◆ getOriginalFontType()

virtual eOriginalFontType IDOMFontOpenType::getOriginalFontType ( )
pure virtual

Returns the original font type for this opentype font.

Returns
eOriginalFontType The original font type.

◆ getOriginalOS2Table()

virtual const CEDLSimpleBuffer & IDOMFontOpenType::getOriginalOS2Table ( ) const
pure virtual

Obtain the original OS/2 Table, if present, that was included in the font.

     Currently this information is only populated for PDF input, and only if
     the font had an OS/2 table. OS/2 information in fonts embedded in PDF tends
     to be problematic, and as such, much of the OS/2 table is regenerated partially
     or completely by PDF input.

     For uses which require the original OS/2 table data, it is made available here.

     Please note that this information is not used when font hashing is performed.
Returns
CEDLSimpleBuffer A reference to the original OS/2 table, or an empty buffer.

◆ getPanose()

virtual const CEDLSimpleBuffer & IDOMFontOpenType::getPanose ( ) const
pure virtual

Obtain the PDF Style Panose information, if present.

     Please see the PDF and Panose documentation for details. If present,
     this is a 12 byte buffer describing style information which is useful
     for font substitution.

     Currently only present for TrueType-based CID Fonts.
Returns
CEDLSimpleBuffer A buffer containing the Panose information, or an empty buffer if Panose information is not present.

◆ getPostScriptName()

virtual EDLSysString IDOMFontOpenType::getPostScriptName ( IEDLClassFactory * pFactory,
int32 fontIndex )
pure virtual

Get the "PostScript" Name of the font, from the font data itself. This is usually extracted from the 'name' OpenType table, but may be synthesized if the name cannot be obtained.

Parameters
pFactoryA pointer to an EDL Class factory.
fontIndexThe index of the desired font (if a TrueType collection)
Returns
EDLSysString The PostScript font name

◆ getRequestedFontName()

virtual EDLRawString IDOMFontOpenType::getRequestedFontName ( ) const
pure virtual

Get the name of the font as requested by the input document. This is only useful for PDF and PostScript input. If a font has to be substituted for another requested font, this will return the name of the font the input desired. The encoding of this font name is not defined.

Returns
EDLRawString The requested font name if applicable, an empty string otherwise.

◆ getSubsetted()

virtual bool IDOMFontOpenType::getSubsetted ( ) const
pure virtual

Requests if the font reports to be a subset.

Currently, this is only set to true for PDF input, where the PDF indicates that the font is subset.

Returns
bool True if the font reports that it is a subset

◆ setCidMap()

virtual void IDOMFontOpenType::setCidMap ( const CCIDMapConstPtr & cidMap)
pure virtual

Set or clear the CIDMap for the font. Valid only for TrueType fonts.

Parameters
cidMapThe CID map to set. Ownership is taken by the font.

◆ setEmbedded()

virtual void IDOMFontOpenType::setEmbedded ( bool embedded)
pure virtual

Sets whether of not the font is flagged for embeddeding.

Outputs will honour this setting, if possible, or not overridden. In particular, if a font is a standard font in the output format being used, this setting will be ignored. Currently this will only occur for PDF and PS output.

Parameters
embeddedSet to true to flag the font for embedding

◆ stripInstructions()

virtual IDOMFontOpenTypePtr IDOMFontOpenType::stripInstructions ( const ISessionPtr & session,
uint32 fontIndex = 0,
bool all = false )
pure virtual

Strip glyph instructions.

Applies only to TrueType glyphs. This will attempt to strip some cases of broken instructions (hints) from a font.

Note that this it cannot detect issues seen only when rendering at a specific resolution and point size.

Parameters
sessionA pointer to the session.
fontIndexThe index of the font - only used for TTC fonts.
allWhether to strip all instructions from the font, or only instructions found to be invalid (the default).
Returns
IDOMFontOpenTypePtr The stripped font.

◆ validateInstructions()

virtual bool IDOMFontOpenType::validateInstructions ( const ISessionPtr & session,
uint32 fontIndex = 0 )
pure virtual

Validate glyph instructions.

Applies only to TrueType glyphs. This will attempt to detect some cases of broken instructions (hints) by rendering each glyph in the font and return a boolean value to indicate if any issues were found.

Note that while this function may be useful to detect general issues with fonts/glyph instructions it cannot detect issues seen only when rendering at a specific resolution and point size.

Parameters
sessionA pointer to the session.
fontIndexThe index of the font - only used for TTC fonts.
Returns
bool true on success, or false if invalid instructions were found.

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