]> git.saurik.com Git - apple/icu.git/blame - icuSources/layout/HanLayoutEngine.cpp
ICU-6.2.4.tar.gz
[apple/icu.git] / icuSources / layout / HanLayoutEngine.cpp
CommitLineData
b75a7d8f
A
1/*
2 * HanLayoutEngine.cpp: OpenType processing for Han fonts.
3 *
374ca955 4 * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved.
b75a7d8f
A
5 */
6
7#include "LETypes.h"
8#include "LEScripts.h"
9#include "LELanguages.h"
10
11#include "LayoutEngine.h"
12#include "OpenTypeLayoutEngine.h"
13#include "HanLayoutEngine.h"
14#include "ScriptAndLanguageTags.h"
374ca955
A
15#include "LEGlyphStorage.h"
16
17U_NAMESPACE_BEGIN
b75a7d8f 18
374ca955 19UOBJECT_DEFINE_RTTI_IMPLEMENTATION(HanOpenTypeLayoutEngine)
b75a7d8f
A
20
21HanOpenTypeLayoutEngine::HanOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
22 const GlyphSubstitutionTableHeader *gsubTable)
23 : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, gsubTable)
24{
25 // nothing else to do...
26}
27
28HanOpenTypeLayoutEngine::~HanOpenTypeLayoutEngine()
29{
30 // nothing to do
31}
32
374ca955 33static const LETag emptyTag = 0x00000000;
b75a7d8f 34
374ca955
A
35static const LETag loclFeatureTag = LE_LOCL_FEATURE_TAG;
36static const LETag smplFeatureTag = LE_SMPL_FEATURE_TAG;
37static const LETag tradFeatureTag = LE_TRAD_FEATURE_TAG;
b75a7d8f 38
374ca955 39static const LETag features[] = {loclFeatureTag, emptyTag};
b75a7d8f
A
40
41le_int32 HanOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool /*rightToLeft*/,
374ca955 42 LEUnicode *&/*outChars*/, LEGlyphStorage &glyphStorage, LEErrorCode &success)
b75a7d8f
A
43{
44 if (LE_FAILURE(success)) {
45 return 0;
46 }
47
48 if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) {
49 success = LE_ILLEGAL_ARGUMENT_ERROR;
50 return 0;
51 }
52
374ca955
A
53 glyphStorage.allocateGlyphArray(count, FALSE, success);
54 glyphStorage.allocateAuxData(success);
b75a7d8f 55
374ca955 56 if (LE_FAILURE(success)) {
b75a7d8f
A
57 return 0;
58 }
59
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) {
374ca955 65 glyphStorage.setAuxData(i, (void *) features, success);
b75a7d8f
A
66 }
67
68 return count;
69}
374ca955
A
70
71U_NAMESPACE_END