Home | History | Annotate | Download | only in layout
      1 /*
      2  *
      3  * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
      4  *
      5  */
      6 
      7 #ifndef __LOOKUPTABLES_H
      8 #define __LOOKUPTABLES_H
      9 
     10 /**
     11  * \file
     12  * \internal
     13  */
     14 
     15 #include "LETypes.h"
     16 #include "LayoutTables.h"
     17 
     18 U_NAMESPACE_BEGIN
     19 
     20 enum LookupTableFormat
     21 {
     22     ltfSimpleArray      = 0,
     23     ltfSegmentSingle    = 2,
     24     ltfSegmentArray     = 4,
     25     ltfSingleTable      = 6,
     26     ltfTrimmedArray     = 8
     27 };
     28 
     29 typedef le_int16 LookupValue;
     30 
     31 struct LookupTable
     32 {
     33     le_int16 format;
     34 };
     35 
     36 struct LookupSegment
     37 {
     38     TTGlyphID   lastGlyph;
     39     TTGlyphID   firstGlyph;
     40     LookupValue value;
     41 };
     42 
     43 struct LookupSingle
     44 {
     45     TTGlyphID   glyph;
     46     LookupValue value;
     47 };
     48 
     49 struct BinarySearchLookupTable : LookupTable
     50 {
     51     le_int16 unitSize;
     52     le_int16 nUnits;
     53     le_int16 searchRange;
     54     le_int16 entrySelector;
     55     le_int16 rangeShift;
     56 
     57     const LookupSegment *lookupSegment(const LookupSegment *segments, LEGlyphID glyph) const;
     58 
     59     const LookupSingle *lookupSingle(const LookupSingle *entries, LEGlyphID glyph) const;
     60 };
     61 
     62 struct SimpleArrayLookupTable : LookupTable
     63 {
     64     LookupValue valueArray[ANY_NUMBER];
     65 };
     66 
     67 struct SegmentSingleLookupTable : BinarySearchLookupTable
     68 {
     69     LookupSegment segments[ANY_NUMBER];
     70 };
     71 
     72 struct SegmentArrayLookupTable : BinarySearchLookupTable
     73 {
     74     LookupSegment segments[ANY_NUMBER];
     75 };
     76 
     77 struct SingleTableLookupTable : BinarySearchLookupTable
     78 {
     79     LookupSingle entries[ANY_NUMBER];
     80 };
     81 
     82 struct TrimmedArrayLookupTable : LookupTable
     83 {
     84     TTGlyphID   firstGlyph;
     85     TTGlyphID   glyphCount;
     86     LookupValue valueArray[ANY_NUMBER];
     87 };
     88 
     89 U_NAMESPACE_END
     90 #endif
     91