]> git.saurik.com Git - apple/icu.git/blob - icuSources/layout/GXLayoutEngine.cpp
ICU-3.13.tar.gz
[apple/icu.git] / icuSources / layout / GXLayoutEngine.cpp
1
2 /*
3 * @(#)GXLayoutEngine.cpp 1.5 00/03/15
4 *
5 * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
6 *
7 */
8
9 #include "LETypes.h"
10 #include "LayoutEngine.h"
11 #include "GXLayoutEngine.h"
12
13 #include "MorphTables.h"
14
15 U_NAMESPACE_BEGIN
16
17 const char GXLayoutEngine::fgClassID=0;
18
19 GXLayoutEngine::GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const MorphTableHeader *morphTable)
20 : LayoutEngine(fontInstance, scriptCode, languageCode), 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, LEGlyphID *&glyphs, le_int32 *&charIndices, 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, glyphs, charIndices, success);
43
44 if (LE_FAILURE(success)) {
45 return 0;
46 }
47
48 fMorphTable->process(glyphs, charIndices, count);
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*/, LEGlyphID glyphs[], le_int32 glyphCount, float positions[], LEErrorCode &success)
55 {
56 if (LE_FAILURE(success)) {
57 return;
58 }
59
60 if (chars == NULL || glyphs == NULL || positions == NULL || offset < 0 || count < 0 || glyphCount < 0) {
61 success = LE_ILLEGAL_ARGUMENT_ERROR;
62 return;
63 }
64
65 // FIXME: no positional processing yet...
66 }
67
68 U_NAMESPACE_END