Home | History | Annotate | Download | only in layout
      1 /*
      2  *
      3  * (C) Copyright IBM Corp.  and others 1998-2013 - All Rights Reserved
      4  *
      5  */
      6 
      7 #include "LETypes.h"
      8 #include "LayoutEngine.h"
      9 #include "GXLayoutEngine2.h"
     10 #include "LEGlyphStorage.h"
     11 #include "MorphTables.h"
     12 
     13 U_NAMESPACE_BEGIN
     14 
     15 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(GXLayoutEngine2)
     16 
     17 GXLayoutEngine2::GXLayoutEngine2(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const MorphTableHeader2 *morphTable, le_int32 typoFlags, LEErrorCode &success)
     18     : LayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success), fMorphTable(morphTable)
     19 {
     20     // nothing else to do?
     21 }
     22 
     23 GXLayoutEngine2::~GXLayoutEngine2()
     24 {
     25     reset();
     26 }
     27 
     28 // apply 'morx' table
     29 le_int32 GXLayoutEngine2::computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success)
     30 {
     31     if (LE_FAILURE(success)) {
     32         return 0;
     33     }
     34 
     35     if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) {
     36         success = LE_ILLEGAL_ARGUMENT_ERROR;
     37         return 0;
     38     }
     39 
     40     mapCharsToGlyphs(chars, offset, count, rightToLeft, rightToLeft, glyphStorage, success);
     41 
     42     if (LE_FAILURE(success)) {
     43         return 0;
     44     }
     45 
     46     fMorphTable->process(glyphStorage, fTypoFlags);
     47     return count;
     48 }
     49 
     50 // apply positional tables
     51 void GXLayoutEngine2::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool /*reverse*/,
     52                                           LEGlyphStorage &/*glyphStorage*/, LEErrorCode &success)
     53 {
     54     if (LE_FAILURE(success)) {
     55         return;
     56     }
     57 
     58     if (chars == NULL || offset < 0 || count < 0) {
     59         success = LE_ILLEGAL_ARGUMENT_ERROR;
     60         return;
     61     }
     62 
     63     // FIXME: no positional processing yet...
     64 }
     65 
     66 U_NAMESPACE_END
     67