2001-10-03 21:48:10 +00:00
|
|
|
|
|
|
|
/*
|
2001-11-08 00:22:25 +00:00
|
|
|
*******************************************************************************
|
2001-10-03 21:48:10 +00:00
|
|
|
*
|
2006-04-11 01:15:08 +00:00
|
|
|
* Copyright (C) 1999-2006, International Business Machines
|
2001-11-08 00:22:25 +00:00
|
|
|
* Corporation and others. All Rights Reserved.
|
2001-10-03 21:48:10 +00:00
|
|
|
*
|
2001-11-08 00:22:25 +00:00
|
|
|
*******************************************************************************
|
|
|
|
* file name: PortableFontInstance.h
|
2001-10-03 21:48:10 +00:00
|
|
|
*
|
2001-11-08 00:22:25 +00:00
|
|
|
* created on: 11/12/1999
|
|
|
|
* created by: Eric R. Mader
|
2001-10-03 21:48:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __PORTABLEFONTINSTANCE_H
|
|
|
|
#define __PORTABLEFONTINSTANCE_H
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2003-03-03 22:54:57 +00:00
|
|
|
#include "layout/LETypes.h"
|
|
|
|
#include "layout/LEFontInstance.h"
|
|
|
|
|
|
|
|
#include "FontTableCache.h"
|
2001-10-03 21:48:10 +00:00
|
|
|
|
|
|
|
#include "sfnt.h"
|
|
|
|
#include "cmaps.h"
|
|
|
|
|
2003-03-03 22:54:57 +00:00
|
|
|
class PortableFontInstance : public LEFontInstance, protected FontTableCache
|
2001-10-03 21:48:10 +00:00
|
|
|
{
|
|
|
|
private:
|
2002-04-02 02:55:31 +00:00
|
|
|
FILE *fFile;
|
2001-10-03 21:48:10 +00:00
|
|
|
|
2005-01-25 22:29:46 +00:00
|
|
|
float fPointSize;
|
|
|
|
le_int32 fUnitsPerEM;
|
|
|
|
le_uint32 fFontChecksum;
|
|
|
|
le_int32 fAscent;
|
|
|
|
le_int32 fDescent;
|
|
|
|
le_int32 fLeading;
|
2001-10-03 21:48:10 +00:00
|
|
|
|
2002-04-02 02:55:31 +00:00
|
|
|
const SFNTDirectory *fDirectory;
|
2002-03-20 22:23:14 +00:00
|
|
|
le_uint16 fDirPower;
|
|
|
|
le_uint16 fDirExtra;
|
2001-10-03 21:48:10 +00:00
|
|
|
|
2003-03-03 22:54:57 +00:00
|
|
|
float fDeviceScaleX;
|
|
|
|
float fDeviceScaleY;
|
2002-03-27 23:24:17 +00:00
|
|
|
|
2005-01-25 22:29:46 +00:00
|
|
|
const NAMETable *fNAMETable;
|
|
|
|
le_uint16 fNameCount;
|
|
|
|
le_uint16 fNameStringOffset;
|
|
|
|
|
2002-04-02 02:55:31 +00:00
|
|
|
CMAPMapper *fCMAPMapper;
|
2001-10-03 21:48:10 +00:00
|
|
|
|
2002-04-02 02:55:31 +00:00
|
|
|
const HMTXTable *fHMTXTable;
|
|
|
|
le_uint16 fNumGlyphs;
|
|
|
|
le_uint16 fNumLongHorMetrics;
|
2001-10-03 21:48:10 +00:00
|
|
|
|
2002-03-20 22:23:14 +00:00
|
|
|
static le_int8 highBit(le_int32 value);
|
|
|
|
|
2002-04-02 02:55:31 +00:00
|
|
|
const DirectoryEntry *findTable(LETag tag) const;
|
|
|
|
const void *readTable(LETag tag, le_uint32 *length) const;
|
|
|
|
void deleteTable(const void *table) const;
|
2003-03-03 22:54:57 +00:00
|
|
|
void getMetrics();
|
|
|
|
|
|
|
|
CMAPMapper *findUnicodeMapper();
|
2001-10-03 21:48:10 +00:00
|
|
|
|
2003-03-03 22:54:57 +00:00
|
|
|
protected:
|
|
|
|
const void *readFontTable(LETag tableTag) const;
|
2001-10-03 21:48:10 +00:00
|
|
|
|
|
|
|
public:
|
2005-02-28 23:18:05 +00:00
|
|
|
PortableFontInstance(const char *fileName, float pointSize, LEErrorCode &status);
|
2001-10-03 21:48:10 +00:00
|
|
|
|
|
|
|
virtual ~PortableFontInstance();
|
|
|
|
|
2002-03-27 23:24:17 +00:00
|
|
|
virtual const void *getFontTable(LETag tableTag) const;
|
2001-10-03 21:48:10 +00:00
|
|
|
|
2005-01-25 22:29:46 +00:00
|
|
|
virtual const char *getNameString(le_uint16 nameID, le_uint16 platform, le_uint16 encoding, le_uint16 language) const;
|
|
|
|
|
|
|
|
virtual void deleteNameString(const char *name) const;
|
|
|
|
|
2006-04-11 01:15:08 +00:00
|
|
|
virtual le_int32 getUnitsPerEM() const;
|
2001-10-03 21:48:10 +00:00
|
|
|
|
2006-04-11 01:15:08 +00:00
|
|
|
virtual le_uint32 getFontChecksum() const;
|
2005-01-25 22:29:46 +00:00
|
|
|
|
2006-04-11 01:15:08 +00:00
|
|
|
virtual le_int32 getAscent() const;
|
2001-10-03 21:48:10 +00:00
|
|
|
|
2006-04-11 01:15:08 +00:00
|
|
|
virtual le_int32 getDescent() const;
|
2001-10-03 21:48:10 +00:00
|
|
|
|
2006-04-11 01:15:08 +00:00
|
|
|
virtual le_int32 getLeading() const;
|
2001-10-03 21:48:10 +00:00
|
|
|
|
2006-04-11 22:40:05 +00:00
|
|
|
// We really want to inherit this method from the superclass, but some compilers
|
|
|
|
// issue a warning if we don't implement it...
|
|
|
|
virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const;
|
|
|
|
|
|
|
|
// We really want to inherit this method from the superclass, but some compilers
|
|
|
|
// issue a warning if we don't implement it...
|
|
|
|
virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const;
|
2006-04-11 01:15:08 +00:00
|
|
|
|
|
|
|
virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch) const;
|
2001-10-03 21:48:10 +00:00
|
|
|
|
|
|
|
virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const;
|
|
|
|
|
|
|
|
virtual le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const;
|
|
|
|
|
2006-04-11 01:15:08 +00:00
|
|
|
float getXPixelsPerEm() const;
|
|
|
|
|
|
|
|
float getYPixelsPerEm() const;
|
|
|
|
|
|
|
|
float getScaleFactorX() const;
|
|
|
|
|
|
|
|
float getScaleFactorY() const;
|
2001-10-03 21:48:10 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|