~ubuntu-branches/ubuntu/gutsy/icu/gutsy

« back to all changes in this revision

Viewing changes to source/test/letest/PortableFontInstance.h

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2005-05-21 22:44:31 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: package-import@ubuntu.com-20050521224431-r7rktfhnu1n4tf1g
Tags: 2.1-2.1
Rename icu-doc to icu21-doc. icu-doc is built by the icu28 package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include "sfnt.h"
24
24
#include "cmaps.h"
25
25
 
 
26
#define TABLE_CACHE_INIT 5
 
27
#define TABLE_CACHE_GROW 5
 
28
 
 
29
struct TableCacheEntry
 
30
{
 
31
    LETag tag;
 
32
    void *table;
 
33
};
 
34
 
26
35
enum PFIErrorCode {
27
36
    PFI_NO_ERROR = 0,
28
37
 
38
47
class PortableFontInstance : public LEFontInstance
39
48
{
40
49
private:
41
 
        FILE *fFile;
 
50
    FILE *fFile;
42
51
 
43
52
    float fUnitsPerEM;
44
53
    float fPointSize;
45
54
 
46
 
        const SFNTDirectory *fDirectory;
47
 
 
48
 
        CMAPMapper *fCMAPMapper;
49
 
 
50
 
        const HMTXTable *fHMTXTable;
51
 
        le_uint16 fNumGlyphs;
52
 
        le_uint16 fNumLongHorMetrics;
53
 
 
54
 
        const DirectoryEntry *findTable(LETag tag) const;
55
 
        const void *readTable(LETag tag, le_uint32 *length) const;
56
 
        void deleteTable(const void *table) const;
57
 
 
58
 
        CMAPMapper *PortableFontInstance::findUnicodeMapper();
 
55
    const SFNTDirectory *fDirectory;
 
56
    le_uint16 fDirPower;
 
57
    le_uint16 fDirExtra;
 
58
 
 
59
    TableCacheEntry *fTableCache;
 
60
    le_int32 fTableCacheCurr;
 
61
    le_int32 fTableCacheSize;
 
62
 
 
63
    CMAPMapper *fCMAPMapper;
 
64
 
 
65
    const HMTXTable *fHMTXTable;
 
66
    le_uint16 fNumGlyphs;
 
67
    le_uint16 fNumLongHorMetrics;
 
68
 
 
69
    static le_int8 highBit(le_int32 value);
 
70
 
 
71
    PFIErrorCode PortableFontInstance::initFontTableCache();
 
72
    void PortableFontInstance::flushFontTableCache();
 
73
 
 
74
    const DirectoryEntry *findTable(LETag tag) const;
 
75
    const void *readTable(LETag tag, le_uint32 *length) const;
 
76
    void deleteTable(const void *table) const;
 
77
 
 
78
    CMAPMapper *PortableFontInstance::findUnicodeMapper();
59
79
 
60
80
public:
61
81
    PortableFontInstance(char *fileName, float pointSize, PFIErrorCode &status);
62
82
 
63
83
    virtual ~PortableFontInstance();
64
84
 
65
 
    virtual const void *getFontTable(LETag tableTag) const
66
 
    {
67
 
                le_uint32 length;
68
 
 
69
 
        return readTable(tableTag, &length);
70
 
    };
 
85
    virtual const void *getFontTable(LETag tableTag) const;
71
86
 
72
87
    virtual le_bool canDisplay(LEUnicode32 ch) const
73
88
    {
82
97
    virtual le_int32 getLineHeight() const
83
98
    {
84
99
        // this is a cheap hack!!
85
 
        return (le_int32) fPointSize;
 
100
    return (le_int32) fPointSize;
86
101
    };
87
102
 
88
103
    virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, const LECharMapper *mapper, LEGlyphID glyphs[]) const;
91
106
 
92
107
    virtual le_int32 getName(le_uint16 platformID, le_uint16 scriptID, le_uint16 languageID, le_uint16 nameID, LEUnicode *name) const
93
108
    {
94
 
                // This is only used for CDAC fonts, and we'll have to loose that support anyhow...
 
109
        // This is only used for CDAC fonts, and we'll have to loose that support anyhow...
95
110
        //return (le_int32) fFontObject->getName(platformID, scriptID, languageID, nameID, name);
96
 
                if (name != NULL) {
97
 
                        *name = 0;
98
 
                }
 
111
        if (name != NULL) {
 
112
            *name = 0;
 
113
        }
99
114
 
100
 
                return 0;
 
115
        return 0;
101
116
    };
102
117
 
103
118
    virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const;