os/textandloc/fontservices/textshaperplugin/IcuSource/layout/GXLayoutEngine.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/textandloc/fontservices/textshaperplugin/IcuSource/layout/GXLayoutEngine.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,69 @@
     1.4 +
     1.5 +/*
     1.6 + *
     1.7 + * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
     1.8 + *
     1.9 + */
    1.10 +
    1.11 +#include "LETypes.h"
    1.12 +#include "LayoutEngine.h"
    1.13 +#include "GXLayoutEngine.h"
    1.14 +#include "LEGlyphStorage.h"
    1.15 +
    1.16 +#include "MorphTables.h"
    1.17 +
    1.18 +U_NAMESPACE_BEGIN
    1.19 +
    1.20 +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(GXLayoutEngine)
    1.21 +
    1.22 +GXLayoutEngine::GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const MorphTableHeader *morphTable) 
    1.23 +    : LayoutEngine(fontInstance, scriptCode, languageCode, 0), fMorphTable(morphTable)
    1.24 +{
    1.25 +    // nothing else to do?
    1.26 +}
    1.27 +
    1.28 +GXLayoutEngine::~GXLayoutEngine()
    1.29 +{
    1.30 +    reset();
    1.31 +}
    1.32 +
    1.33 +// apply 'mort' table
    1.34 +le_int32 GXLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success)
    1.35 +{
    1.36 +    if (LE_FAILURE(success)) {
    1.37 +        return 0;
    1.38 +    }
    1.39 +
    1.40 +    if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) {
    1.41 +        success = LE_ILLEGAL_ARGUMENT_ERROR;
    1.42 +        return 0;
    1.43 +    }
    1.44 +
    1.45 +    mapCharsToGlyphs(chars, offset, count, FALSE, rightToLeft, glyphStorage, success);
    1.46 +
    1.47 +    if (LE_FAILURE(success)) {
    1.48 +        return 0;
    1.49 +    }
    1.50 +
    1.51 +    fMorphTable->process(glyphStorage);
    1.52 +
    1.53 +    return count;
    1.54 +}
    1.55 +
    1.56 +// apply positional tables
    1.57 +void GXLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool /*reverse*/,
    1.58 +                                          LEGlyphStorage &/*glyphStorage*/, LEErrorCode &success)
    1.59 +{
    1.60 +    if (LE_FAILURE(success)) {
    1.61 +        return;
    1.62 +    }
    1.63 +
    1.64 +    if (chars == NULL || offset < 0 || count < 0) {
    1.65 +        success = LE_ILLEGAL_ARGUMENT_ERROR;
    1.66 +        return;
    1.67 +    }
    1.68 +
    1.69 +    // FIXME: no positional processing yet...
    1.70 +}
    1.71 +
    1.72 +U_NAMESPACE_END