jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.cpp
changeset 16891 91e99bed64ae
parent 16890 36b30720a997
child 22330 cafb826672bd
equal deleted inserted replaced
16890:36b30720a997 16891:91e99bed64ae
    56     return fFontInstance->canDisplay((LEUnicode) glyph);
    56     return fFontInstance->canDisplay((LEUnicode) glyph);
    57 }
    57 }
    58 
    58 
    59 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ArabicOpenTypeLayoutEngine)
    59 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ArabicOpenTypeLayoutEngine)
    60 
    60 
    61 ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
    61 ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode,
    62                         le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable, LEErrorCode &success)
    62                                                        le_int32 languageCode, le_int32 typoFlags,
       
    63                                                        const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable,
       
    64                                                        LEErrorCode &success)
    63     : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success)
    65     : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success)
    64 {
    66 {
    65     fFeatureMap = ArabicShaping::getFeatureMap(fFeatureMapCount);
    67     fFeatureMap = ArabicShaping::getFeatureMap(fFeatureMapCount);
    66     fFeatureOrder = TRUE;
    68     fFeatureOrder = TRUE;
    67 }
    69 }
    68 
    70 
    69 ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
    71 ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode,
       
    72                                                        le_int32 languageCode,
    70                                                        le_int32 typoFlags, LEErrorCode &success)
    73                                                        le_int32 typoFlags, LEErrorCode &success)
    71     : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success)
    74     : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success)
    72 {
    75 {
    73     fFeatureMap = ArabicShaping::getFeatureMap(fFeatureMapCount);
    76     fFeatureMap = ArabicShaping::getFeatureMap(fFeatureMapCount);
    74 
    77 
    86 }
    89 }
    87 
    90 
    88 // Input: characters
    91 // Input: characters
    89 // Output: characters, char indices, tags
    92 // Output: characters, char indices, tags
    90 // Returns: output character count
    93 // Returns: output character count
    91 le_int32 ArabicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
    94 le_int32 ArabicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count,
    92         LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success)
    95                                                          le_int32 max, le_bool rightToLeft, LEUnicode *&outChars,
       
    96                                                          LEGlyphStorage &glyphStorage, LEErrorCode &success)
    93 {
    97 {
    94     if (LE_FAILURE(success)) {
    98     if (LE_FAILURE(success)) {
    95         return 0;
    99         return 0;
    96     }
   100     }
    97 
   101 
   135     if (chars == NULL || offset < 0 || count < 0) {
   139     if (chars == NULL || offset < 0 || count < 0) {
   136         success = LE_ILLEGAL_ARGUMENT_ERROR;
   140         success = LE_ILLEGAL_ARGUMENT_ERROR;
   137         return;
   141         return;
   138     }
   142     }
   139 
   143 
   140     if (fGPOSTable != NULL) {
   144     if (!fGPOSTable.isEmpty()) {
   141         OpenTypeLayoutEngine::adjustGlyphPositions(chars, offset, count, reverse, glyphStorage, success);
   145         OpenTypeLayoutEngine::adjustGlyphPositions(chars, offset, count, reverse, glyphStorage, success);
   142     } else if (fGDEFTable != NULL) {
   146     } else if (!fGDEFTable.isEmpty()) {
   143         GDEFMarkFilter filter(fGDEFTable);
   147         GDEFMarkFilter filter(fGDEFTable, success);
   144 
       
   145         adjustMarkGlyphs(glyphStorage, &filter, success);
   148         adjustMarkGlyphs(glyphStorage, &filter, success);
   146     } else {
   149     } else {
   147         GlyphDefinitionTableHeader *gdefTable = (GlyphDefinitionTableHeader *) CanonShaping::glyphDefinitionTable;
   150         LEReferenceTo<GlyphDefinitionTableHeader> gdefTable(CanonShaping::glyphDefinitionTable, CanonShaping::glyphDefinitionTableLen);
   148         GDEFMarkFilter filter(gdefTable);
   151         GDEFMarkFilter filter(gdefTable, success);
   149 
   152 
   150         adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success);
   153         adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success);
   151     }
   154     }
   152 }
   155 }
   153 
   156 
   154 UnicodeArabicOpenTypeLayoutEngine::UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, LEErrorCode &success)
   157 UnicodeArabicOpenTypeLayoutEngine::UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, LEErrorCode &success)
   155     : ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags | LE_CHAR_FILTER_FEATURE_FLAG, success)
   158   : ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags | LE_CHAR_FILTER_FEATURE_FLAG, success)
   156 {
   159 {
   157     fGSUBTable = (const GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable;
   160     fGSUBTable = (const GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable;
   158     fGDEFTable = (const GlyphDefinitionTableHeader *) CanonShaping::glyphDefinitionTable;
   161     fGDEFTable = (const GlyphDefinitionTableHeader *) CanonShaping::glyphDefinitionTable;
   159     /* OpenTypeLayoutEngine will allocate a substitution filter */
   162     /* OpenTypeLayoutEngine will allocate a substitution filter */
   160 }
   163 }
   230     if (chars == NULL || offset < 0 || count < 0) {
   233     if (chars == NULL || offset < 0 || count < 0) {
   231         success = LE_ILLEGAL_ARGUMENT_ERROR;
   234         success = LE_ILLEGAL_ARGUMENT_ERROR;
   232         return;
   235         return;
   233     }
   236     }
   234 
   237 
   235     GDEFMarkFilter filter(fGDEFTable);
   238     GDEFMarkFilter filter(fGDEFTable, success);
   236 
   239 
   237     adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success);
   240     adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success);
   238 }
   241 }
   239 
   242 
   240 U_NAMESPACE_END
   243 U_NAMESPACE_END