Home | History | Annotate | Download | only in layout
      1 /*
      2  *
      3  * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved
      4  *
      5  */
      6 
      7 #ifndef __LOOKUPS_H
      8 #define __LOOKUPS_H
      9 
     10 /**
     11  * \file
     12  * \internal
     13  */
     14 
     15 #include "LETypes.h"
     16 #include "OpenTypeTables.h"
     17 
     18 U_NAMESPACE_BEGIN
     19 
     20 enum LookupFlags
     21 {
     22     lfBaselineIsLogicalEnd  = 0x0001,  // The MS spec. calls this flag "RightToLeft" but this name is more accurate
     23     lfIgnoreBaseGlyphs      = 0x0002,
     24     lfIgnoreLigatures       = 0x0004,
     25     lfIgnoreMarks           = 0x0008,
     26     lfReservedMask          = 0x00F0,
     27     lfMarkAttachTypeMask    = 0xFF00,
     28     lfMarkAttachTypeShift   = 8
     29 };
     30 
     31 struct LookupSubtable
     32 {
     33     le_uint16 subtableFormat;
     34     Offset    coverageTableOffset;
     35 
     36   inline le_int32  getGlyphCoverage(const LEReferenceTo<LookupSubtable> &base, LEGlyphID glyphID, LEErrorCode &success) const;
     37 
     38   le_int32  getGlyphCoverage(const LEReferenceTo<LookupSubtable> &base, Offset tableOffset, LEGlyphID glyphID, LEErrorCode &success) const;
     39 
     40   // convenience
     41   inline le_int32  getGlyphCoverage(const LETableReference &base, LEGlyphID glyphID, LEErrorCode &success) const;
     42 
     43   inline le_int32  getGlyphCoverage(const LETableReference &base, Offset tableOffset, LEGlyphID glyphID, LEErrorCode &success) const;
     44 };
     45 
     46 struct LookupTable
     47 {
     48     le_uint16       lookupType;
     49     le_uint16       lookupFlags;
     50     le_uint16       subTableCount;
     51     Offset          subTableOffsetArray[ANY_NUMBER];
     52 
     53   const LEReferenceTo<LookupSubtable> getLookupSubtable(const LEReferenceTo<LookupTable> &base, le_uint16 subtableIndex, LEErrorCode &success) const;
     54 };
     55 LE_VAR_ARRAY(LookupTable, subTableOffsetArray)
     56 
     57 struct LookupListTable
     58 {
     59     le_uint16   lookupCount;
     60     Offset      lookupTableOffsetArray[ANY_NUMBER];
     61 
     62   const LEReferenceTo<LookupTable> getLookupTable(const LEReferenceTo<LookupListTable> &base, le_uint16 lookupTableIndex, LEErrorCode &success) const;
     63 };
     64 LE_VAR_ARRAY(LookupListTable, lookupTableOffsetArray)
     65 
     66 inline le_int32 LookupSubtable::getGlyphCoverage(const LEReferenceTo<LookupSubtable> &base, LEGlyphID glyphID, LEErrorCode &success) const
     67 {
     68   return getGlyphCoverage(base, coverageTableOffset, glyphID, success);
     69 }
     70 
     71 inline le_int32  LookupSubtable::getGlyphCoverage(const LETableReference &base, LEGlyphID glyphID, LEErrorCode &success) const {
     72   LEReferenceTo<LookupSubtable> thisRef(base, success, this);
     73   return getGlyphCoverage(thisRef, glyphID, success);
     74 }
     75 
     76 inline le_int32  LookupSubtable::getGlyphCoverage(const LETableReference &base, Offset tableOffset, LEGlyphID glyphID, LEErrorCode &success) const {
     77   LEReferenceTo<LookupSubtable> thisRef(base, success, this);
     78   return getGlyphCoverage(thisRef, tableOffset, glyphID, success);
     79 }
     80 
     81 U_NAMESPACE_END
     82 #endif
     83