2
|
1 |
/*
|
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
3 |
*
|
|
4 |
* This code is free software; you can redistribute it and/or modify it
|
|
5 |
* under the terms of the GNU General Public License version 2 only, as
|
|
6 |
* published by the Free Software Foundation. Sun designates this
|
|
7 |
* particular file as subject to the "Classpath" exception as provided
|
|
8 |
* by Sun in the LICENSE file that accompanied this code.
|
|
9 |
*
|
|
10 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
11 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
12 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
13 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
14 |
* accompanied this code).
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License version
|
|
17 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
18 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
19 |
*
|
|
20 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
21 |
* CA 95054 USA or visit www.sun.com if you need additional information or
|
|
22 |
* have any questions.
|
|
23 |
*
|
|
24 |
*/
|
|
25 |
|
|
26 |
/*
|
|
27 |
*
|
|
28 |
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
|
|
29 |
*
|
|
30 |
*/
|
|
31 |
|
|
32 |
#include "LETypes.h"
|
|
33 |
#include "LayoutEngine.h"
|
|
34 |
#include "GXLayoutEngine.h"
|
|
35 |
#include "LEGlyphStorage.h"
|
|
36 |
|
|
37 |
#include "MorphTables.h"
|
|
38 |
|
|
39 |
GXLayoutEngine::GXLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode,
|
|
40 |
le_int32 languageCode, const MorphTableHeader *morphTable)
|
|
41 |
: LayoutEngine(fontInstance, scriptCode, languageCode, 0), fMorphTable(morphTable)
|
|
42 |
{
|
|
43 |
// nothing else to do?
|
|
44 |
}
|
|
45 |
|
|
46 |
GXLayoutEngine::~GXLayoutEngine()
|
|
47 |
{
|
|
48 |
reset();
|
|
49 |
}
|
|
50 |
|
|
51 |
// apply 'mort' table
|
|
52 |
le_int32 GXLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset,
|
|
53 |
le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage,
|
|
54 |
LEErrorCode &success)
|
|
55 |
{
|
|
56 |
if (LE_FAILURE(success)) {
|
|
57 |
return 0;
|
|
58 |
}
|
|
59 |
|
|
60 |
if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) {
|
|
61 |
success = LE_ILLEGAL_ARGUMENT_ERROR;
|
|
62 |
return 0;
|
|
63 |
}
|
|
64 |
|
|
65 |
mapCharsToGlyphs(chars, offset, count, FALSE, rightToLeft, glyphStorage, success);
|
|
66 |
|
|
67 |
if (LE_FAILURE(success)) {
|
|
68 |
return 0;
|
|
69 |
}
|
|
70 |
|
|
71 |
fMorphTable->process(glyphStorage);
|
|
72 |
|
|
73 |
return count;
|
|
74 |
}
|
|
75 |
|
|
76 |
// apply positional tables
|
|
77 |
void GXLayoutEngine::adjustGlyphPositions(const LEUnicode chars[],
|
|
78 |
le_int32 offset, le_int32 count, le_bool /*reverse*/,
|
|
79 |
LEGlyphStorage &/*glyphStorage*/, LEErrorCode &success)
|
|
80 |
{
|
|
81 |
if (LE_FAILURE(success)) {
|
|
82 |
return;
|
|
83 |
}
|
|
84 |
|
|
85 |
if (chars == NULL || offset < 0 || count < 0) {
|
|
86 |
success = LE_ILLEGAL_ARGUMENT_ERROR;
|
|
87 |
return;
|
|
88 |
}
|
|
89 |
|
|
90 |
// FIXME: no positional processing yet...
|
|
91 |
}
|