3 * (C) Copyright IBM Corp. 1998-2016 - All Rights Reserved
5 * This file is a modification of the ICU file IndicLayoutEngine.h
6 * by Jens Herden and Javier Sola for Khmer language
10 #ifndef __KHMERLAYOUTENGINE_H
11 #define __KHMERLAYOUTENGINE_H
14 #include "LEFontInstance.h"
15 #include "LEGlyphFilter.h"
16 #include "LayoutEngine.h"
17 #include "OpenTypeLayoutEngine.h"
19 #include "GlyphSubstitutionTables.h"
20 #include "GlyphDefinitionTables.h"
21 #include "GlyphPositioningTables.h"
29 * This class implements OpenType layout for Khmer OpenType fonts, as
30 * specified by Microsoft in "Creating and Supporting OpenType Fonts for
31 * Khmer Scripts" (http://www.microsoft.com/typography/otspec/indicot/default.htm) TODO: change url
33 * This class overrides the characterProcessing method to do Khmer character processing
34 * and reordering (See the MS spec. for more details)
38 class KhmerOpenTypeLayoutEngine
: public OpenTypeLayoutEngine
42 * This is the main constructor. It constructs an instance of KhmerOpenTypeLayoutEngine for
43 * a particular font, script and language. It takes the GSUB table as a parameter since
44 * LayoutEngine::layoutEngineFactory has to read the GSUB table to know that it has an
45 * Khmer OpenType font.
47 * @param fontInstance - the font
48 * @param scriptCode - the script
49 * @param langaugeCode - the language
50 * @param gsubTable - the GSUB table
51 * @param success - set to an error code if the operation fails
53 * @see LayoutEngine::layoutEngineFactory
54 * @see OpenTypeLayoutEngine
55 * @see ScriptAndLangaugeTags.h for script and language codes
59 KhmerOpenTypeLayoutEngine(const LEFontInstance
*fontInstance
, le_int32 scriptCode
, le_int32 languageCode
,
60 le_int32 typoFlags
, const LEReferenceTo
<GlyphSubstitutionTableHeader
> &gsubTable
, LEErrorCode
&success
);
63 * This constructor is used when the font requires a "canned" GSUB table which can't be known
64 * until after this constructor has been invoked.
66 * @param fontInstance - the font
67 * @param scriptCode - the script
68 * @param langaugeCode - the language
69 * @param success - set to an error code if the operation fails
71 * @see OpenTypeLayoutEngine
72 * @see ScriptAndLangaugeTags.h for script and language codes
76 KhmerOpenTypeLayoutEngine(const LEFontInstance
*fontInstance
, le_int32 scriptCode
, le_int32 languageCode
,
77 le_int32 typoFlags
, LEErrorCode
&success
);
80 * The destructor, virtual for correct polymorphic invocation.
84 virtual ~KhmerOpenTypeLayoutEngine();
87 * ICU "poor man's RTTI", returns a UClassID for the actual class.
89 * @deprecated ICU 54. See {@link icu::LayoutEngine}
91 virtual UClassID
getDynamicClassID() const;
94 * ICU "poor man's RTTI", returns a UClassID for this class.
96 * @deprecated ICU 54. See {@link icu::LayoutEngine}
98 static UClassID
getStaticClassID();
103 * This method does Khmer OpenType character processing. It assigns the OpenType feature
104 * tags to the characters, and may generate output characters which have been reordered.
105 * It may also split some vowels, resulting in more output characters than input characters.
108 * @param chars - the input character context
109 * @param offset - the index of the first character to process
110 * @param count - the number of characters to process
111 * @param max - the number of characters in the input context
112 * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
113 * @param glyphStorage - the glyph storage object. The glyph and character index arrays will be set.
114 * the auxillary data array will be set to the feature tags.
117 * @param success - set to an error code if the operation fails
119 * @return the output character count
123 virtual le_int32
characterProcessing(const LEUnicode chars
[], le_int32 offset
, le_int32 count
, le_int32 max
, le_bool rightToLeft
,
124 LEUnicode
*&outChars
, LEGlyphStorage
&glyphStorage
, LEErrorCode
&success
);