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 |
* This file is a modification of the ICU file IndicLayoutEngine.h
|
|
31 |
* by Jens Herden and Javier Sola for Khmer language
|
|
32 |
*
|
|
33 |
*/
|
|
34 |
|
|
35 |
#ifndef __KHMERLAYOUTENGINE_H
|
|
36 |
#define __KHMERLAYOUTENGINE_H
|
|
37 |
|
|
38 |
// #include "LETypes.h"
|
|
39 |
// #include "LEFontInstance.h"
|
|
40 |
// #include "LEGlyphFilter.h"
|
|
41 |
// #include "LayoutEngine.h"
|
|
42 |
// #include "OpenTypeLayoutEngine.h"
|
|
43 |
|
|
44 |
// #include "GlyphSubstitutionTables.h"
|
|
45 |
// #include "GlyphDefinitionTables.h"
|
|
46 |
// #include "GlyphPositioningTables.h"
|
|
47 |
|
|
48 |
// class MPreFixups;
|
|
49 |
// class LEGlyphStorage;
|
|
50 |
|
|
51 |
/**
|
|
52 |
* This class implements OpenType layout for Khmer OpenType fonts, as
|
|
53 |
* specified by Microsoft in "Creating and Supporting OpenType Fonts
|
|
54 |
* for Khmer Scripts"
|
|
55 |
* (http://www.microsoft.com/typography/otspec/indicot/default.htm)
|
|
56 |
* TODO: change url
|
|
57 |
*
|
|
58 |
* This class overrides the characterProcessing method to do Khmer
|
|
59 |
* character processing and reordering (See the MS spec. for more
|
|
60 |
* details)
|
|
61 |
*
|
|
62 |
* @internal
|
|
63 |
*/
|
|
64 |
class KhmerOpenTypeLayoutEngine : public OpenTypeLayoutEngine
|
|
65 |
{
|
|
66 |
public:
|
|
67 |
/**
|
|
68 |
* This is the main constructor. It constructs an instance of
|
|
69 |
* KhmerOpenTypeLayoutEngine for a particular font, script and
|
|
70 |
* language. It takes the GSUB table as a parameter since
|
|
71 |
* LayoutEngine::layoutEngineFactory has to read the GSUB table to
|
|
72 |
* know that it has an Khmer OpenType font.
|
|
73 |
*
|
|
74 |
* @param fontInstance - the font
|
|
75 |
* @param scriptCode - the script
|
|
76 |
* @param languageCode - the language
|
|
77 |
* @param gsubTable - the GSUB table
|
|
78 |
*
|
|
79 |
* @see LayoutEngine::layoutEngineFactory
|
|
80 |
* @see OpenTypeLayoutEngine
|
|
81 |
* @see ScriptAndLangaugeTags.h for script and language codes
|
|
82 |
*
|
|
83 |
* @internal
|
|
84 |
*/
|
|
85 |
KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance,
|
|
86 |
le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags,
|
|
87 |
const GlyphSubstitutionTableHeader *gsubTable);
|
|
88 |
|
|
89 |
/**
|
|
90 |
* This constructor is used when the font requires a "canned" GSUB
|
|
91 |
* table which can't be known until after this constructor has
|
|
92 |
* been invoked.
|
|
93 |
*
|
|
94 |
* @param fontInstance - the font
|
|
95 |
* @param scriptCode - the script
|
|
96 |
* @param langaugeCode - the language
|
|
97 |
*
|
|
98 |
* @see OpenTypeLayoutEngine
|
|
99 |
* @see ScriptAndLangaugeTags.h for script and language codes
|
|
100 |
*
|
|
101 |
* @internal
|
|
102 |
*/
|
|
103 |
KhmerOpenTypeLayoutEngine(const LEFontInstance *fontInstance,
|
|
104 |
le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags);
|
|
105 |
|
|
106 |
/**
|
|
107 |
* The destructor, virtual for correct polymorphic invocation.
|
|
108 |
*
|
|
109 |
* @internal
|
|
110 |
*/
|
|
111 |
virtual ~KhmerOpenTypeLayoutEngine();
|
|
112 |
|
|
113 |
protected:
|
|
114 |
|
|
115 |
/**
|
|
116 |
* This method does Khmer OpenType character processing. It
|
|
117 |
* assigns the OpenType feature tags to the characters, and may
|
|
118 |
* generate output characters which have been reordered. It may
|
|
119 |
* also split some vowels, resulting in more output characters
|
|
120 |
* than input characters.
|
|
121 |
*
|
|
122 |
* Input parameters:
|
|
123 |
* @param chars - the input character context
|
|
124 |
* @param offset - the index of the first character to process
|
|
125 |
* @param count - the number of characters to process
|
|
126 |
* @param max - the number of characters in the input context
|
|
127 |
* @param rightToLeft - <code>TRUE</code> if the characters are in
|
|
128 |
* a right to left directional run
|
|
129 |
* @param glyphStorage - the glyph storage object. The glyph and
|
|
130 |
* character index arrays will be set. the auxillary data array
|
|
131 |
* will be set to the feature tags.
|
|
132 |
*
|
|
133 |
* Output parameters:
|
|
134 |
* @param success - set to an error code if the operation fails
|
|
135 |
*
|
|
136 |
* @return the output character count
|
|
137 |
*
|
|
138 |
* @internal
|
|
139 |
*/
|
|
140 |
virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset,
|
|
141 |
le_int32 count, le_int32 max, le_bool rightToLeft,
|
|
142 |
LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
|
|
143 |
};
|
|
144 |
|
|
145 |
#endif
|