J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 3 | * |
| 4 | * This code is free software; you can redistribute it and/or modify it |
| 5 | * under the terms of the GNU General Public License version 2 only, as |
| 6 | * published by the Free Software Foundation. Sun designates this |
| 7 | * particular file as subject to the "Classpath" exception as provided |
| 8 | * by Sun in the LICENSE file that accompanied this code. |
| 9 | * |
| 10 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 13 | * version 2 for more details (a copy is included in the LICENSE file that |
| 14 | * accompanied this code). |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License version |
| 17 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 18 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 19 | * |
| 20 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 21 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 22 | * have any questions. |
| 23 | * |
| 24 | */ |
| 25 | |
| 26 | /* |
| 27 | * |
| 28 | * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved |
| 29 | * |
| 30 | */ |
| 31 | |
| 32 | #ifndef __LOOKUPTABLES_H |
| 33 | #define __LOOKUPTABLES_H |
| 34 | |
| 35 | #include "LETypes.h" |
| 36 | #include "LayoutTables.h" |
| 37 | |
| 38 | enum LookupTableFormat |
| 39 | { |
| 40 | ltfSimpleArray = 0, |
| 41 | ltfSegmentSingle = 2, |
| 42 | ltfSegmentArray = 4, |
| 43 | ltfSingleTable = 6, |
| 44 | ltfTrimmedArray = 8 |
| 45 | }; |
| 46 | |
| 47 | typedef le_int16 LookupValue; |
| 48 | |
| 49 | struct LookupTable |
| 50 | { |
| 51 | le_int16 format; |
| 52 | }; |
| 53 | |
| 54 | struct LookupSegment |
| 55 | { |
| 56 | TTGlyphID lastGlyph; |
| 57 | TTGlyphID firstGlyph; |
| 58 | LookupValue value; |
| 59 | }; |
| 60 | |
| 61 | struct LookupSingle |
| 62 | { |
| 63 | TTGlyphID glyph; |
| 64 | LookupValue value; |
| 65 | }; |
| 66 | |
| 67 | struct BinarySearchLookupTable : LookupTable |
| 68 | { |
| 69 | le_int16 unitSize; |
| 70 | le_int16 nUnits; |
| 71 | le_int16 searchRange; |
| 72 | le_int16 entrySelector; |
| 73 | le_int16 rangeShift; |
| 74 | |
| 75 | const LookupSegment *lookupSegment(const LookupSegment *segments, LEGlyphID glyph) const; |
| 76 | |
| 77 | const LookupSingle *lookupSingle(const LookupSingle *entries, LEGlyphID glyph) const; |
| 78 | }; |
| 79 | |
| 80 | struct SimpleArrayLookupTable : LookupTable |
| 81 | { |
| 82 | LookupValue valueArray[ANY_NUMBER]; |
| 83 | }; |
| 84 | |
| 85 | struct SegmentSingleLookupTable : BinarySearchLookupTable |
| 86 | { |
| 87 | LookupSegment segments[ANY_NUMBER]; |
| 88 | }; |
| 89 | |
| 90 | struct SegmentArrayLookupTable : BinarySearchLookupTable |
| 91 | { |
| 92 | LookupSegment segments[ANY_NUMBER]; |
| 93 | }; |
| 94 | |
| 95 | struct SingleTableLookupTable : BinarySearchLookupTable |
| 96 | { |
| 97 | LookupSingle entries[ANY_NUMBER]; |
| 98 | }; |
| 99 | |
| 100 | struct TrimmedArrayLookupTable : LookupTable |
| 101 | { |
| 102 | TTGlyphID firstGlyph; |
| 103 | TTGlyphID glyphCount; |
| 104 | LookupValue valueArray[ANY_NUMBER]; |
| 105 | }; |
| 106 | |
| 107 | #endif |