1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/* 3ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 459d709d503bab6e2b61931737e662dd293b40578ccornelius * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved 5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "LETypes.h" 9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "LayoutEngine.h" 10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "GXLayoutEngine.h" 11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "LEGlyphStorage.h" 12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "MorphTables.h" 14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_BEGIN 16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruUOBJECT_DEFINE_RTTI_IMPLEMENTATION(GXLayoutEngine) 18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1959d709d503bab6e2b61931737e662dd293b40578ccornelius GXLayoutEngine::GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const LEReferenceTo<MorphTableHeader> &morphTable, LEErrorCode &success) 2085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho : LayoutEngine(fontInstance, scriptCode, languageCode, 0, success), fMorphTable(morphTable) 21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 2259d709d503bab6e2b61931737e662dd293b40578ccornelius fMorphTable.orphan(); 23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // nothing else to do? 24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruGXLayoutEngine::~GXLayoutEngine() 27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru reset(); 29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru// apply 'mort' table 32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querule_int32 GXLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success) 33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (LE_FAILURE(success)) { 35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return 0; 36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) { 39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru success = LE_ILLEGAL_ARGUMENT_ERROR; 40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return 0; 41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru mapCharsToGlyphs(chars, offset, count, FALSE, rightToLeft, glyphStorage, success); 44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (LE_FAILURE(success)) { 46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return 0; 47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 4959d709d503bab6e2b61931737e662dd293b40578ccornelius fMorphTable->process(fMorphTable, glyphStorage, success); 50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return count; 52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru// apply positional tables 55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruvoid GXLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool /*reverse*/, 56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru LEGlyphStorage &/*glyphStorage*/, LEErrorCode &success) 57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{ 58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (LE_FAILURE(success)) { 59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return; 60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru if (chars == NULL || offset < 0 || count < 0) { 63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru success = LE_ILLEGAL_ARGUMENT_ERROR; 64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return; 65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } 66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // FIXME: no positional processing yet... 68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_END 71