• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /*
3  * HanLayoutEngine.h: OpenType processing for Han fonts.
4  *
5  * (C) Copyright IBM Corp. 1998-2008 - All Rights Reserved.
6  */
7 
8 #ifndef __HANLAYOUTENGINE_H
9 #define __HANLAYOUTENGINE_H
10 
11 #include "LETypes.h"
12 #include "LEFontInstance.h"
13 #include "LayoutEngine.h"
14 #include "OpenTypeLayoutEngine.h"
15 
16 #include "GlyphSubstitutionTables.h"
17 
18 U_NAMESPACE_BEGIN
19 
20 class LEGlyphStorage;
21 
22 /**
23  * This class implements OpenType layout for Han fonts. It overrides
24  * the characerProcessing method to assign the correct OpenType feature
25  * tags for the CJK language-specific forms.
26  *
27  * @internal
28  */
29 class HanOpenTypeLayoutEngine : public OpenTypeLayoutEngine
30 {
31 public:
32     /**
33      * This is the main constructor. It constructs an instance of HanOpenTypeLayoutEngine for
34      * a particular font, script and language. It takes the GSUB table as a parameter since
35      * LayoutEngine::layoutEngineFactory has to read the GSUB table to know that it has a
36      * Han OpenType font.
37      *
38      * @param fontInstance - the font
39      * @param scriptCode - the script
40      * @param langaugeCode - the language
41      * @param gsubTable - the GSUB table
42      * @param success - set to an error code if the operation fails
43      *
44      * @see LayoutEngine::layoutEngineFactory
45      * @see OpenTypeLayoutEngine
46      * @see ScriptAndLangaugeTags.h for script and language codes
47      *
48      * @internal
49      */
50     HanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
51                             le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTablem, LEErrorCode &success);
52 
53 
54     /**
55      * The destructor, virtual for correct polymorphic invocation.
56      *
57      * @internal
58      */
59     virtual ~HanOpenTypeLayoutEngine();
60 
61     /**
62      * ICU "poor man's RTTI", returns a UClassID for the actual class.
63      *
64      * @stable ICU 2.8
65      */
66     virtual UClassID getDynamicClassID() const;
67 
68     /**
69      * ICU "poor man's RTTI", returns a UClassID for this class.
70      *
71      * @stable ICU 2.8
72      */
73     static UClassID getStaticClassID();
74 
75 protected:
76 
77     /**
78      * This method does Han OpenType character processing. It assigns the OpenType feature
79      * tags to the characters to generate the correct language-specific variants.
80      *
81      * Input parameters:
82      * @param chars - the input character context
83      * @param offset - the index of the first character to process
84      * @param count - the number of characters to process
85      * @param max - the number of characters in the input context
86      * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
87      * @param glyphStorage - the object holding the glyph storage. The char index and auxillary data arrays will be set.
88      *
89      * Output parameters:
90      * @param outChars - the output character arrayt
91      * @param charIndices - the output character index array
92      * @param featureTags - the output feature tag array
93      * @param success - set to an error code if the operation fails
94      *
95      * @return the output character count
96      *
97      * @internal
98      */
99     virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
100             LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
101 
102 };
103 
104 U_NAMESPACE_END
105 #endif
106