hb-ot-shape-complex-arabic-win1256.hh revision e839e2523e64fd0cf21929f6a45e2facd59c7917
1f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod/*
2f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * Copyright © 2014  Google, Inc.
3f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod *
4f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod *  This is part of HarfBuzz, a text shaping library.
5f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod *
6f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * Permission is hereby granted, without written agreement and without
7f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * license or royalty fees, to use, copy, modify, and distribute this
8f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * software and its documentation for any purpose, provided that the
9f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * above copyright notice and the following two paragraphs appear in
10f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * all copies of this software.
11f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod *
12f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
16f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * DAMAGE.
17f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod *
18f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
21f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod *
24f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * Google Author(s): Behdad Esfahbod
25f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod */
26f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
27f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#ifndef HB_OT_SHAPE_COMPLEX_ARABIC_WIN1256_HH
28f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
29f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
30f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod/*
31f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * The macros in the first part of this file are generic macros that can
32f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * be used to define the bytes for OpenType table data in code in a
33f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * readable manner.  We can move the macros to reside with their respective
34f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * struct types, but since we only use these to define one data table, the
35f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * Windows-1256 Arabic shaping table in this file, we keep them here.
36f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod */
37f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
38f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
39f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod/* First we measure, then we cut. */
40f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#ifndef OT_MEASURE
41f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#define OT_MEASURE
421789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_TABLE_START			static const struct TABLE_NAME {
431789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_TABLE_END			}
441789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_LABEL_START(Name)		unsigned char Name[
451789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_LABEL_END			];
461789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_BYTE(u8)			+1/*byte*/
47f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#define OT_USHORT(u16)			+2/*bytes*/
48f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#else
49f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#undef  OT_MEASURE
501789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_TABLE_START			TABLE_NAME = {
511789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_TABLE_END			};
521789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_LABEL_START(Name)		{
531789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_LABEL_END			},
541789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_BYTE(u8)			(u8),
551789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_USHORT(u16)			(unsigned char)((u16)>>8), (unsigned char)((u16)&0xFFu),
561789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_COUNT(Name, ItemSize)	((unsigned int) sizeof(((struct TABLE_NAME*)0)->Name) \
571789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod					 / (unsigned int)(ItemSize) \
581789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod					 /* OT_ASSERT it's divisible (and positive). */)
591789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_DISTANCE(From,To)		((unsigned int) \
601789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod					 ((char*)(&((struct TABLE_NAME*)0)->To) - \
611789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod					  (char*)(&((struct TABLE_NAME*)0)->From)) \
621789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod					 /* OT_ASSERT it's positive. */)
63f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#endif
64f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
65f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
661789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_LABEL(Name) \
671789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_LABEL_END \
681789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_LABEL_START(Name)
691789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod
70f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod/* Whenever we receive an argument that is a list, it will expand to
71f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * contain commas.  That cannot be passed to another macro because the
72f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * commas will throw off the preprocessor.  The solution is to wrap
73f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * the passed-in argument in OT_LIST() before passing to the next macro.
74f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * Unfortunately this trick requires vararg macros. */
751789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_LIST(...) __VA_ARGS__
76f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
77f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
78f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod/*
79f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * Basic Types
80f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod */
81f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
821789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_TAG(a,b,c,d) \
831789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_BYTE(a) OT_BYTE(b) OT_BYTE(c) OT_BYTE(d)
84f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
851789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_OFFSET(From, To) /* Offset from From to To in bytes */ \
861789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_USHORT(OT_DISTANCE(From, To))
87f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
881789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_GLYPHID /* GlyphID */ \
891789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_USHORT
90f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
91f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#define OT_UARRAY(Name, Items) \
921789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_LABEL_START(Name) \
931789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_USHORT(OT_COUNT(Name##Data, 2)) \
94f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_LABEL(Name##Data) \
95f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	Items \
961789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_LABEL_END
97f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
98f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#define OT_UHEADLESSARRAY(Name, Items) \
991789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_LABEL_START(Name) \
1001789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_USHORT(OT_COUNT(Name##Data, 2) + 1) \
101f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_LABEL(Name##Data) \
102f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	Items \
1031789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_LABEL_END
104f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
105f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
106f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod/*
107f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * Common Types
108f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod */
109f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
1101789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_LOOKUP_FLAG_IGNORE_MARKS	0x08u
1111789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod
112f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#define OT_LOOKUP(Name, LookupType, LookupFlag, SubLookupOffsets) \
1131789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_LABEL_START(Name) \
114f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_USHORT(LookupType) \
115f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_USHORT(LookupFlag) \
1161789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_LABEL_END \
117f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_UARRAY(Name##SubLookupOffsetsArray, OT_LIST(SubLookupOffsets))
118f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
119f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#define OT_SUBLOOKUP(Name, SubFormat, Items) \
1201789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_LABEL_START(Name) \
121f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_USHORT(SubFormat) \
122f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	Items
123f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
124f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#define OT_COVERAGE1(Name, Items) \
1251789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_LABEL_START(Name) \
126f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_USHORT(1) \
1271789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_LABEL_END \
128f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_UARRAY(Name##Glyphs, OT_LIST(Items))
129f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
130f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
131f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod/*
132f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * GSUB
133f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod */
134f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
1351789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_LOOKUP_TYPE_SUBST_SINGLE	1u
1361789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_LOOKUP_TYPE_SUBST_MULTIPLE	2u
1371789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define OT_LOOKUP_TYPE_SUBST_LIGATURE	4u
1381789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod
139f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#define OT_SUBLOOKUP_SINGLE_SUBST_FORMAT2(Name, FromGlyphs, ToGlyphs) \
140f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_SUBLOOKUP(Name, 2, \
141f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod		OT_OFFSET(Name, Name##Coverage) \
1421789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod		OT_LABEL_END \
143f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod		OT_UARRAY(Name##Substitute, OT_LIST(ToGlyphs)) \
144f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	) \
145f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_COVERAGE1(Name##Coverage, OT_LIST(FromGlyphs)) \
146f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	/* ASSERT_STATIC_EXPR len(FromGlyphs) == len(ToGlyphs) */
147f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
148f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#define OT_SUBLOOKUP_MULTIPLE_SUBST_FORMAT1(Name, FromGlyphs, SequenceOffsets) \
149f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_SUBLOOKUP(Name, 1, \
150f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod		OT_OFFSET(Name, Name##Coverage) \
1511789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod		OT_LABEL_END \
152f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod		OT_UARRAY(Name##SequenceOffsetsArray, OT_LIST(SequenceOffsets)) \
153f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	) \
154f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_COVERAGE1(Name##Coverage, OT_LIST(FromGlyphs)) \
155f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	/* ASSERT_STATIC_EXPR len(FromGlyphs) == len(SequenceOffsets) */
156f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
157f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#define OT_SEQUENCE(Name, SubstituteGlyphs) \
1581789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_UARRAY(Name, OT_LIST(SubstituteGlyphs))
159f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
160f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#define OT_SUBLOOKUP_LIGATURE_SUBST_FORMAT1(Name, FirstGlyphs, LigatureSetOffsets) \
161f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_SUBLOOKUP(Name, 1, \
162f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod		OT_OFFSET(Name, Name##Coverage) \
1631789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod		OT_LABEL_END \
164f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod		OT_UARRAY(Name##LigatureSetOffsetsArray, OT_LIST(LigatureSetOffsets)) \
165f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	) \
166f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_COVERAGE1(Name##Coverage, OT_LIST(FirstGlyphs)) \
167f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	/* ASSERT_STATIC_EXPR len(FirstGlyphs) == len(LigatureSetOffsets) */
168f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
169f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#define OT_LIGATURE_SET(Name, LigatureSetOffsets) \
1701789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_UARRAY(Name, OT_LIST(LigatureSetOffsets))
171f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
172f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#define OT_LIGATURE(Name, Components, LigGlyph) \
1731789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_LABEL_START(Name) \
174f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	LigGlyph \
1751789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_LABEL_END \
176f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_UHEADLESSARRAY(Name##ComponentsArray, OT_LIST(Components))
177f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
178f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
179f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod/*
180f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod *
181f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * Start of Windows-1256 shaping table.
182f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod *
183f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod */
184f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
185f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod/* Table name. */
186f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#define TABLE_NAME arabic_win1256_gsub_lookups
187f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
188f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod/* Table manifest. */
189f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#define MANIFEST(Items) \
1901789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_LABEL_START(manifest) \
1911789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_USHORT(OT_COUNT(manifestData, 6)) \
192f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_LABEL(manifestData) \
193f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	Items \
1941789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	OT_LABEL_END
195f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
1961789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#define MANIFEST_LOOKUP(Tag, Name) \
1971789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	Tag \
198f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(manifest, Name)
199f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
200f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod/* Shorthand. */
201f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#define G	OT_GLYPHID
202f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
203f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod/* We use this to differentiate a medial-Lam from an initial-Lam.
204f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * In this two-shape encoding, those two have the same glyph.  But
205f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * for Lam-Alef ligature formations we need to differentiate.  As
206f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * such, we add a MultipleSubst to the end of 'medi' feature to
207f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * insert an extra glyph there, and we use that to replace the
208f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * proper ligature later.  As long as this is the code for an
209f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * isolated form, it will work fine, as an isolated form cannot
210f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * happen between a Lam-Alef sequence of the shapes that form a
211f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * ligature. */
212f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#define LAM_MEDI_MARKER	225
213f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
214f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
215f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod/*
216f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * Table Start
217f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod */
218f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_TABLE_START
219f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
220f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
221f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod/*
222f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * Manifest
223f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod */
224f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodMANIFEST(
2251789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	MANIFEST_LOOKUP(OT_TAG('i','n','i','t'), initLookup)
2261789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	MANIFEST_LOOKUP(OT_TAG('m','e','d','i'), mediLookup)
2271789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	MANIFEST_LOOKUP(OT_TAG('f','i','n','a'), finaLookup)
2281789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	MANIFEST_LOOKUP(OT_TAG('r','l','i','g'), rligLookup)
2291789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod	MANIFEST_LOOKUP(OT_TAG('r','l','i','g'), rligMarksLookup)
230f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod)
231f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
232f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod/*
233f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * Lookups
234f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod */
2351789ccb1dd56af6117eac00e633eff94860ba252Behdad EsfahbodOT_LOOKUP(initLookup, OT_LOOKUP_TYPE_SUBST_SINGLE, OT_LOOKUP_FLAG_IGNORE_MARKS,
236f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(initLookup, initmediSubLookup)
237f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(initLookup, initSubLookup)
238f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod)
2391789ccb1dd56af6117eac00e633eff94860ba252Behdad EsfahbodOT_LOOKUP(mediLookup, OT_LOOKUP_TYPE_SUBST_SINGLE, OT_LOOKUP_FLAG_IGNORE_MARKS,
240f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(mediLookup, initmediSubLookup)
241f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(mediLookup, mediSubLookup)
242f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod)
2431789ccb1dd56af6117eac00e633eff94860ba252Behdad EsfahbodOT_LOOKUP(finaLookup, OT_LOOKUP_TYPE_SUBST_SINGLE, OT_LOOKUP_FLAG_IGNORE_MARKS,
244f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(finaLookup, finaSubLookup)
245f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod)
2461789ccb1dd56af6117eac00e633eff94860ba252Behdad EsfahbodOT_LOOKUP(mediLamLookup, OT_LOOKUP_TYPE_SUBST_MULTIPLE, OT_LOOKUP_FLAG_IGNORE_MARKS,
247f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(mediLamLookup, mediLamSubLookup)
248f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod)
2491789ccb1dd56af6117eac00e633eff94860ba252Behdad EsfahbodOT_LOOKUP(rligLookup, OT_LOOKUP_TYPE_SUBST_LIGATURE, OT_LOOKUP_FLAG_IGNORE_MARKS,
250f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(rligLookup, lamAlefLigaturesSubLookup)
251f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod)
2521789ccb1dd56af6117eac00e633eff94860ba252Behdad EsfahbodOT_LOOKUP(rligMarksLookup, OT_LOOKUP_TYPE_SUBST_LIGATURE, 0,
253f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(rligMarksLookup, shaddaLigaturesSubLookup)
254f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod)
255f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
256f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod/*
257f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * init/medi/fina forms
258f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod */
259f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_SUBLOOKUP_SINGLE_SUBST_FORMAT2(initmediSubLookup,
260a2de193220ee2839125594bd1a60b5b66ab4598eBehdad Esfahbod	G(198)	G(200)	G(201)	G(202)	G(203)	G(204)	G(205)	G(206)	G(211)
261a2de193220ee2839125594bd1a60b5b66ab4598eBehdad Esfahbod	G(212)	G(213)	G(214)	G(223)	G(225)	G(227)	G(228)	G(236)	G(237),
262a2de193220ee2839125594bd1a60b5b66ab4598eBehdad Esfahbod	G(162)	G(4)	G(5)	G(5)	G(6)	G(7)	G(9)	G(11)	G(13)
263a2de193220ee2839125594bd1a60b5b66ab4598eBehdad Esfahbod	G(14)	G(15)	G(26)	G(140)	G(141)	G(142)	G(143)	G(154)	G(154)
264f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod)
265f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_SUBLOOKUP_SINGLE_SUBST_FORMAT2(initSubLookup,
266a2de193220ee2839125594bd1a60b5b66ab4598eBehdad Esfahbod	G(218)	G(219)	G(221)	G(222)	G(229),
267a2de193220ee2839125594bd1a60b5b66ab4598eBehdad Esfahbod	G(27)	G(30)	G(128)	G(131)	G(144)
268f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod)
269f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_SUBLOOKUP_SINGLE_SUBST_FORMAT2(mediSubLookup,
270a2de193220ee2839125594bd1a60b5b66ab4598eBehdad Esfahbod	G(218)	G(219)	G(221)	G(222)	G(229),
271a2de193220ee2839125594bd1a60b5b66ab4598eBehdad Esfahbod	G(28)	G(31)	G(129)	G(138)	G(149)
272f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod)
273f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_SUBLOOKUP_SINGLE_SUBST_FORMAT2(finaSubLookup,
274e839e2523e64fd0cf21929f6a45e2facd59c7917Behdad Esfahbod	G(194)	G(195)	G(197)	G(198)	G(199)	G(201)	G(204)	G(205)	G(206)
275e839e2523e64fd0cf21929f6a45e2facd59c7917Behdad Esfahbod	G(218)	G(219)	G(229)	G(236)	G(237),
276e839e2523e64fd0cf21929f6a45e2facd59c7917Behdad Esfahbod	G(2)	G(1)	G(3)	G(181)	G(0)	G(159)	G(8)	G(10)	G(12)
277e839e2523e64fd0cf21929f6a45e2facd59c7917Behdad Esfahbod	G(29)	G(127)	G(152) G(160)	G(156)
278f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod)
279f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_SUBLOOKUP_MULTIPLE_SUBST_FORMAT1(mediLamSubLookup,
280f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	G(141),
281f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(mediLamSubLookup, mediLamSequence)
282f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod)
283f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_SEQUENCE(mediLamSequence, G(141) G(LAM_MEDI_MARKER))
284f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
285f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod/*
286f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * Lam+Alef ligatures
287f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod */
288f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_SUBLOOKUP_LIGATURE_SUBST_FORMAT1(lamAlefLigaturesSubLookup,
289f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	G(141),
290f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(lamAlefLigaturesSubLookup, lamLigatureSet)
291f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod)
292f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_LIGATURE_SET(lamLigatureSet,
293f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(lamLigatureSet, lamInitLigature1)
294f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(lamLigatureSet, lamInitLigature2)
295f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(lamLigatureSet, lamInitLigature3)
296f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(lamLigatureSet, lamInitLigature4)
297f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(lamLigatureSet, lamMediLigature1)
298f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(lamLigatureSet, lamMediLigature2)
299f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(lamLigatureSet, lamMediLigature3)
300f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(lamLigatureSet, lamMediLigature4)
301f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod)
302f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_LIGATURE(lamInitLigature1, G(0), G(165))
303f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_LIGATURE(lamInitLigature2, G(1), G(178))
304f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_LIGATURE(lamInitLigature3, G(2), G(180))
305f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_LIGATURE(lamInitLigature4, G(3), G(252))
306f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_LIGATURE(lamMediLigature1, G(LAM_MEDI_MARKER) G(0), G(170))
307f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_LIGATURE(lamMediLigature2, G(LAM_MEDI_MARKER) G(1), G(179))
308f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_LIGATURE(lamMediLigature3, G(LAM_MEDI_MARKER) G(2), G(185))
309f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_LIGATURE(lamMediLigature4, G(LAM_MEDI_MARKER) G(3), G(255))
310f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
311f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod/*
312f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * Shadda ligatures
313f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod */
314f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_SUBLOOKUP_LIGATURE_SUBST_FORMAT1(shaddaLigaturesSubLookup,
315f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	G(248),
316f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(shaddaLigaturesSubLookup, shaddaLigatureSet)
317f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod)
318f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_LIGATURE_SET(shaddaLigatureSet,
319f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(shaddaLigatureSet, shaddaLigature1)
320f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(shaddaLigatureSet, shaddaLigature2)
321f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod	OT_OFFSET(shaddaLigatureSet, shaddaLigature3)
322f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod)
323f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_LIGATURE(shaddaLigature1, G(243), G(172))
324f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_LIGATURE(shaddaLigature2, G(245), G(173))
325f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_LIGATURE(shaddaLigature3, G(246), G(175))
326f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
327f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod/*
328f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * Table end
329f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod */
330f28b1c823db2ad56fed356ef864a7508d23048b8Behdad EsfahbodOT_TABLE_END
331f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
332f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
333f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod/*
334f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * Clean up
335f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod */
336f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#undef OT_TABLE_START
337f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#undef OT_TABLE_END
3381789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#undef OT_LABEL_START
3391789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#undef OT_LABEL_END
3401789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#undef OT_BYTE
341f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#undef OT_USHORT
342f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#undef OT_DISTANCE
3431789ccb1dd56af6117eac00e633eff94860ba252Behdad Esfahbod#undef OT_COUNT
344f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
345f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod/*
346f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod * Include a second time to get the table data...
347f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod */
348f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#ifdef OT_MEASURE
349f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#include __FILE__
350f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#endif
351f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod
352f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#define HB_OT_SHAPE_COMPLEX_ARABIC_WIN1256_HH
353f28b1c823db2ad56fed356ef864a7508d23048b8Behdad Esfahbod#endif /* HB_OT_SHAPE_COMPLEX_ARABIC_WIN1256_HH */
354