fontservices/textshaperplugin/IcuSource/layout/GlyphSubstLookupProc.cpp
changeset 0 1fb32624e06b
equal deleted inserted replaced
-1:000000000000 0:1fb32624e06b
       
     1 /*
       
     2  *
       
     3  * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
       
     4  *
       
     5  */
       
     6 
       
     7 #include "LETypes.h"
       
     8 #include "LEGlyphFilter.h"
       
     9 #include "LEFontInstance.h"
       
    10 #include "OpenTypeTables.h"
       
    11 #include "Features.h"
       
    12 #include "Lookups.h"
       
    13 #include "ScriptAndLanguage.h"
       
    14 #include "GlyphDefinitionTables.h"
       
    15 #include "GlyphSubstitutionTables.h"
       
    16 #include "SingleSubstitutionSubtables.h"
       
    17 #include "MultipleSubstSubtables.h"
       
    18 #include "AlternateSubstSubtables.h"
       
    19 #include "LigatureSubstSubtables.h"
       
    20 #include "ContextualSubstSubtables.h"
       
    21 #include "ExtensionSubtables.h"
       
    22 #include "LookupProcessor.h"
       
    23 #include "GlyphSubstLookupProc.h"
       
    24 #include "LESwaps.h"
       
    25 
       
    26 U_NAMESPACE_BEGIN
       
    27 
       
    28 GlyphSubstitutionLookupProcessor::GlyphSubstitutionLookupProcessor(
       
    29         const GlyphSubstitutionTableHeader *glyphSubstitutionTableHeader,
       
    30         LETag scriptTag, LETag languageTag, const LEGlyphFilter *filter, const LETag *featureOrder)
       
    31     : LookupProcessor(
       
    32                       (char *) glyphSubstitutionTableHeader,
       
    33                       SWAPW(glyphSubstitutionTableHeader->scriptListOffset),
       
    34                       SWAPW(glyphSubstitutionTableHeader->featureListOffset),
       
    35                       SWAPW(glyphSubstitutionTableHeader->lookupListOffset),
       
    36                       scriptTag, languageTag, featureOrder), fFilter(filter)
       
    37 {
       
    38     // anything?
       
    39 }
       
    40 
       
    41 GlyphSubstitutionLookupProcessor::GlyphSubstitutionLookupProcessor()
       
    42 {
       
    43 }
       
    44 
       
    45 le_uint32 GlyphSubstitutionLookupProcessor::applySubtable(
       
    46     const LookupSubtable *lookupSubtable, le_uint16 lookupType,
       
    47     GlyphIterator *glyphIterator, const LEFontInstance *fontInstance,
       
    48     LEErrorCode& success) const
       
    49 {
       
    50     if (LE_FAILURE(success)) {
       
    51         return 0;
       
    52     }
       
    53     le_uint32 delta = 0;
       
    54 
       
    55     switch(lookupType)
       
    56     {
       
    57     case 0:
       
    58         break;
       
    59 
       
    60     case gsstSingle:
       
    61     {
       
    62         const SingleSubstitutionSubtable *subtable = (const SingleSubstitutionSubtable *) lookupSubtable;
       
    63 
       
    64         delta = subtable->process(glyphIterator, fFilter);
       
    65         break;
       
    66     }
       
    67 
       
    68     case gsstMultiple:
       
    69     {
       
    70         const MultipleSubstitutionSubtable *subtable = (const MultipleSubstitutionSubtable *) lookupSubtable;
       
    71 
       
    72         delta = subtable->process(glyphIterator, success, fFilter);
       
    73         break;
       
    74     }
       
    75 
       
    76     case gsstAlternate:
       
    77     {
       
    78         const AlternateSubstitutionSubtable *subtable = (const AlternateSubstitutionSubtable *) lookupSubtable;
       
    79 
       
    80         delta = subtable->process(glyphIterator, fFilter);
       
    81         break;
       
    82     }
       
    83 
       
    84     case gsstLigature:
       
    85     {
       
    86         const LigatureSubstitutionSubtable *subtable = (const LigatureSubstitutionSubtable *) lookupSubtable;
       
    87 
       
    88         delta = subtable->process(glyphIterator, fFilter);
       
    89         break;
       
    90     }
       
    91 
       
    92     case gsstContext:
       
    93     {
       
    94         const ContextualSubstitutionSubtable *subtable = (const ContextualSubstitutionSubtable *) lookupSubtable;
       
    95 
       
    96         delta = subtable->process(this, glyphIterator, fontInstance, success);
       
    97         break;
       
    98     }
       
    99 
       
   100     case gsstChainingContext:
       
   101     {
       
   102         const ChainingContextualSubstitutionSubtable *subtable = (const ChainingContextualSubstitutionSubtable *) lookupSubtable;
       
   103 
       
   104         delta = subtable->process(this, glyphIterator, fontInstance, success);
       
   105         break;
       
   106     }
       
   107 
       
   108     case gsstExtension:
       
   109     {
       
   110         const ExtensionSubtable *subtable = (const ExtensionSubtable *) lookupSubtable;
       
   111 
       
   112         delta = subtable->process(this, lookupType, glyphIterator, fontInstance, success);
       
   113         break;
       
   114     }
       
   115 
       
   116     default:
       
   117         break;
       
   118     }
       
   119 
       
   120     return delta;
       
   121 }
       
   122 
       
   123 GlyphSubstitutionLookupProcessor::~GlyphSubstitutionLookupProcessor()
       
   124 {
       
   125 }
       
   126 
       
   127 U_NAMESPACE_END