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