2 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * This is part of HarfBuzz, an OpenType Layout engine library.
6 * Permission is hereby granted, without written agreement and without
7 * license or royalty fees, to use, copy, modify, and distribute this
8 * software and its documentation for any purpose, provided that the
9 * above copyright notice and the following two paragraphs appear in
10 * all copies of this software.
12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
25 #ifndef HARFBUZZ_SHAPER_PRIVATE_H
26 #define HARFBUZZ_SHAPER_PRIVATE_H
31 C_DOTTED_CIRCLE = 0x25CC
36 HB_Combining_BelowLeftAttached = 200,
37 HB_Combining_BelowAttached = 202,
38 HB_Combining_BelowRightAttached = 204,
39 HB_Combining_LeftAttached = 208,
40 HB_Combining_RightAttached = 210,
41 HB_Combining_AboveLeftAttached = 212,
42 HB_Combining_AboveAttached = 214,
43 HB_Combining_AboveRightAttached = 216,
45 HB_Combining_BelowLeft = 218,
46 HB_Combining_Below = 220,
47 HB_Combining_BelowRight = 222,
48 HB_Combining_Left = 224,
49 HB_Combining_Right = 226,
50 HB_Combining_AboveLeft = 228,
51 HB_Combining_Above = 230,
52 HB_Combining_AboveRight = 232,
54 HB_Combining_DoubleBelow = 233,
55 HB_Combining_DoubleAbove = 234,
56 HB_Combining_IotaSubscript = 240
73 /* used by indic and myanmar shaper */
75 AkhantProperty = 0x10,
77 PreFormProperty = 0x40,
78 BelowFormProperty = 0x80,
79 AboveFormProperty = 0x100,
80 HalfFormProperty = 0x200,
81 PostFormProperty = 0x400,
82 ConjunctFormProperty = 0x800,
83 VattuProperty = 0x1000,
84 PreSubstProperty = 0x2000,
85 BelowSubstProperty = 0x4000,
86 AboveSubstProperty = 0x8000,
87 PostSubstProperty = 0x10000,
88 HalantProperty = 0x20000,
89 CligProperty = 0x40000,
90 IndicCaltProperty = 0x80000
92 } HB_OpenTypeProperty;
94 /* return true if ok. */
95 typedef HB_Bool (*HB_ShapeFunction)(HB_ShaperItem *shaper_item);
98 HB_ShapeFunction shape;
101 extern const HB_ScriptEngine hb_scriptEngines[];
103 extern HB_Bool HB_BasicShape(HB_ShaperItem *shaper_item);
104 extern HB_Bool HB_GreekShape(HB_ShaperItem *shaper_item);
105 extern HB_Bool HB_TibetanShape(HB_ShaperItem *shaper_item);
106 extern HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item);
107 extern HB_Bool HB_ArabicShape(HB_ShaperItem *shaper_item);
108 extern HB_Bool HB_HangulShape(HB_ShaperItem *shaper_item);
109 extern HB_Bool HB_MyanmarShape(HB_ShaperItem *shaper_item);
110 extern HB_Bool HB_KhmerShape(HB_ShaperItem *shaper_item);
111 extern HB_Bool HB_IndicShape(HB_ShaperItem *shaper_item);
116 } HB_OpenTypeFeature;
118 #define PositioningProperties 0x80000000
120 HB_Bool HB_SelectScript(HB_ShaperItem *item, const HB_OpenTypeFeature *features);
122 HB_Bool HB_OpenTypeShape(HB_ShaperItem *item, const hb_uint32 *properties);
123 HB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int availableGlyphs, HB_Bool doLogClusters);
125 void HB_HeuristicPosition(HB_ShaperItem *item);
126 void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item);
128 #define HB_IsControlChar(uc) \
129 ((uc >= 0x200b && uc <= 0x200f /* ZW Space, ZWNJ, ZWJ, LRM and RLM */) \
130 || (uc >= 0x2028 && uc <= 0x202f /* LS, PS, LRE, RLE, PDF, LRO, RLO, NNBSP */) \
131 || (uc >= 0x206a && uc <= 0x206f /* ISS, ASS, IAFS, AFS, NADS, NODS */))
133 HB_Bool HB_ConvertStringToGlyphIndices(HB_ShaperItem *shaper_item);
135 #define HB_GetGlyphAdvances(shaper_item) \
136 shaper_item->font->klass->getGlyphAdvances(shaper_item->font, \
137 shaper_item->glyphs, shaper_item->num_glyphs, \
138 shaper_item->advances, \
139 shaper_item->face->current_flags);
141 #define HB_DECLARE_STACKARRAY(Type, Name) \
142 Type stack##Name[512]; \
143 Type *Name = stack##Name;
145 #define HB_INIT_STACKARRAY(Type, Name, Length) \
146 if ((Length) >= 512) \
147 Name = (Type *)malloc((Length) * sizeof(Type));
149 #define HB_STACKARRAY(Type, Name, Length) \
150 HB_DECLARE_STACKARRAY(Type, Name) \
151 HB_INIT_STACKARRAY(Type, Name, Length)
153 #define HB_FREE_STACKARRAY(Name) \
154 if (stack##Name != Name) \