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. Oracle designates this 7 * particular file as subject to the "Classpath" exception as provided 8 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * 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/** 36 * \file 37 * \internal 38 */ 39 40#include "LETypes.h" 41#include "LayoutTables.h" 42#include "LETableReference.h" 43 44U_NAMESPACE_BEGIN 45 46enum LookupTableFormat 47{ 48 ltfSimpleArray = 0, 49 ltfSegmentSingle = 2, 50 ltfSegmentArray = 4, 51 ltfSingleTable = 6, 52 ltfTrimmedArray = 8 53}; 54 55typedef le_int16 LookupValue; 56 57struct LookupTable 58{ 59 le_int16 format; 60}; 61 62struct LookupSegment 63{ 64 TTGlyphID lastGlyph; 65 TTGlyphID firstGlyph; 66 LookupValue value; 67}; 68 69struct LookupSingle 70{ 71 TTGlyphID glyph; 72 LookupValue value; 73}; 74 75struct BinarySearchLookupTable : LookupTable 76{ 77 le_int16 unitSize; 78 le_int16 nUnits; 79 le_int16 searchRange; 80 le_int16 entrySelector; 81 le_int16 rangeShift; 82 83 const LookupSegment *lookupSegment(const LETableReference &base, const LookupSegment *segments, LEGlyphID glyph, LEErrorCode &success) const; 84 85 const LookupSingle *lookupSingle(const LETableReference &base, const LookupSingle *entries, LEGlyphID glyph, LEErrorCode &success) const; 86}; 87 88struct SimpleArrayLookupTable : LookupTable 89{ 90 LookupValue valueArray[ANY_NUMBER]; 91}; 92LE_VAR_ARRAY(SimpleArrayLookupTable, valueArray) 93 94struct SegmentSingleLookupTable : BinarySearchLookupTable 95{ 96 LookupSegment segments[ANY_NUMBER]; 97}; 98LE_VAR_ARRAY(SegmentSingleLookupTable, segments) 99 100struct SegmentArrayLookupTable : BinarySearchLookupTable 101{ 102 LookupSegment segments[ANY_NUMBER]; 103}; 104LE_VAR_ARRAY(SegmentArrayLookupTable, segments) 105 106struct SingleTableLookupTable : BinarySearchLookupTable 107{ 108 LookupSingle entries[ANY_NUMBER]; 109}; 110LE_VAR_ARRAY(SingleTableLookupTable, entries) 111 112struct TrimmedArrayLookupTable : LookupTable 113{ 114 TTGlyphID firstGlyph; 115 TTGlyphID glyphCount; 116 LookupValue valueArray[ANY_NUMBER]; 117}; 118LE_VAR_ARRAY(TrimmedArrayLookupTable, valueArray) 119 120U_NAMESPACE_END 121#endif 122