]> git.saurik.com Git - apple/icu.git/blame - icuSources/layout/GXLayoutEngine.cpp
ICU-531.48.tar.gz
[apple/icu.git] / icuSources / layout / GXLayoutEngine.cpp
CommitLineData
b75a7d8f
A
1
2/*
b75a7d8f 3 *
57a6839d 4 * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved
b75a7d8f
A
5 *
6 */
7
8#include "LETypes.h"
9#include "LayoutEngine.h"
10#include "GXLayoutEngine.h"
374ca955 11#include "LEGlyphStorage.h"
b75a7d8f
A
12
13#include "MorphTables.h"
14
15U_NAMESPACE_BEGIN
16
374ca955 17UOBJECT_DEFINE_RTTI_IMPLEMENTATION(GXLayoutEngine)
b75a7d8f 18
57a6839d 19 GXLayoutEngine::GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const LEReferenceTo<MorphTableHeader> &morphTable, LEErrorCode &success)
729e4ab9 20 : LayoutEngine(fontInstance, scriptCode, languageCode, 0, success), fMorphTable(morphTable)
b75a7d8f 21{
57a6839d 22 fMorphTable.orphan();
b75a7d8f
A
23 // nothing else to do?
24}
25
26GXLayoutEngine::~GXLayoutEngine()
27{
28 reset();
29}
30
31// apply 'mort' table
374ca955 32le_int32 GXLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success)
b75a7d8f
A
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
46f4442e 43 mapCharsToGlyphs(chars, offset, count, FALSE, rightToLeft, glyphStorage, success);
b75a7d8f
A
44
45 if (LE_FAILURE(success)) {
46 return 0;
47 }
48
57a6839d 49 fMorphTable->process(fMorphTable, glyphStorage, success);
b75a7d8f
A
50
51 return count;
52}
53
54// apply positional tables
374ca955
A
55void GXLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool /*reverse*/,
56 LEGlyphStorage &/*glyphStorage*/, LEErrorCode &success)
b75a7d8f
A
57{
58 if (LE_FAILURE(success)) {
59 return;
60 }
61
374ca955 62 if (chars == NULL || offset < 0 || count < 0) {
b75a7d8f
A
63 success = LE_ILLEGAL_ARGUMENT_ERROR;
64 return;
65 }
66
67 // FIXME: no positional processing yet...
68}
69
70U_NAMESPACE_END