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