2 * HanLayoutEngine.cpp: OpenType processing for Han fonts.
4 * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved.
9 #include "LELanguages.h"
11 #include "LayoutEngine.h"
12 #include "OpenTypeLayoutEngine.h"
13 #include "HanLayoutEngine.h"
14 #include "ScriptAndLanguageTags.h"
15 #include "LEGlyphStorage.h"
19 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(HanOpenTypeLayoutEngine
)
21 HanOpenTypeLayoutEngine::HanOpenTypeLayoutEngine(const LEFontInstance
*fontInstance
, le_int32 scriptCode
, le_int32 languageCode
,
22 const GlyphSubstitutionTableHeader
*gsubTable
)
23 : OpenTypeLayoutEngine(fontInstance
, scriptCode
, languageCode
, gsubTable
)
25 // nothing else to do...
28 HanOpenTypeLayoutEngine::~HanOpenTypeLayoutEngine()
33 static const LETag emptyTag
= 0x00000000;
35 static const LETag loclFeatureTag
= LE_LOCL_FEATURE_TAG
;
36 static const LETag smplFeatureTag
= LE_SMPL_FEATURE_TAG
;
37 static const LETag tradFeatureTag
= LE_TRAD_FEATURE_TAG
;
39 static const LETag features
[] = {loclFeatureTag
, emptyTag
};
41 le_int32
HanOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars
[], le_int32 offset
, le_int32 count
, le_int32 max
, le_bool
/*rightToLeft*/,
42 LEUnicode
*&/*outChars*/, LEGlyphStorage
&glyphStorage
, LEErrorCode
&success
)
44 if (LE_FAILURE(success
)) {
48 if (chars
== NULL
|| offset
< 0 || count
< 0 || max
< 0 || offset
>= max
|| offset
+ count
> max
) {
49 success
= LE_ILLEGAL_ARGUMENT_ERROR
;
53 glyphStorage
.allocateGlyphArray(count
, FALSE
, success
);
54 glyphStorage
.allocateAuxData(success
);
56 if (LE_FAILURE(success
)) {
60 // FIXME: do we want to add the 'trad' feature for 'ZHT' and the
61 // 'smpl' feature for 'ZHS'? If we do this, we can remove the exact
62 // flag from the language tag lookups, so we can use these features
63 // with the default LangSys...
64 for (le_int32 i
= 0; i
< count
; i
+= 1) {
65 glyphStorage
.setAuxData(i
, (void *) features
, success
);