Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/harfbuzz/src/hb-ot-shaper-arabic-win1256.hh @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 /* | |
| 2 * Copyright © 2014 Google, Inc. | |
| 3 * | |
| 4 * This is part of HarfBuzz, a text shaping library. | |
| 5 * | |
| 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. | |
| 11 * | |
| 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 | |
| 16 * DAMAGE. | |
| 17 * | |
| 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. | |
| 23 * | |
| 24 * Google Author(s): Behdad Esfahbod | |
| 25 */ | |
| 26 | |
| 27 #ifndef HB_OT_SHAPER_ARABIC_WIN1256_HH | |
| 28 | |
| 29 | |
| 30 /* | |
| 31 * The macros in the first part of this file are generic macros that can | |
| 32 * be used to define the bytes for OpenType table data in code in a | |
| 33 * readable manner. We can move the macros to reside with their respective | |
| 34 * struct types, but since we only use these to define one data table, the | |
| 35 * Windows-1256 Arabic shaping table in this file, we keep them here. | |
| 36 */ | |
| 37 | |
| 38 | |
| 39 /* First we measure, then we cut. */ | |
| 40 #ifndef OT_MEASURE | |
| 41 #define OT_MEASURE | |
| 42 #define OT_TABLE_START static const struct TABLE_NAME { | |
| 43 #define OT_TABLE_END } | |
| 44 #define OT_LABEL_START(Name) unsigned char Name[ | |
| 45 #define OT_LABEL_END ]; | |
| 46 #define OT_UINT8(u8) +1/*byte*/ | |
| 47 #define OT_UINT16(u16) +2/*bytes*/ | |
| 48 #else | |
| 49 #undef OT_MEASURE | |
| 50 #define OT_TABLE_START TABLE_NAME = { | |
| 51 #define OT_TABLE_END }; | |
| 52 #define OT_LABEL_START(Name) { | |
| 53 #define OT_LABEL_END }, | |
| 54 #define OT_UINT8(u8) (u8), | |
| 55 #define OT_UINT16(u16) (unsigned char)((u16)>>8), (unsigned char)((u16)&0xFFu), | |
| 56 #define OT_COUNT(Name, ItemSize) ((unsigned int) sizeof(((struct TABLE_NAME*)0)->Name) \ | |
| 57 / (unsigned int)(ItemSize) \ | |
| 58 /* OT_ASSERT it's divisible (and positive). */) | |
| 59 #define OT_DISTANCE(From,To) ((unsigned int) \ | |
| 60 ((char*)(&((struct TABLE_NAME*)0)->To) - \ | |
| 61 (char*)(&((struct TABLE_NAME*)0)->From)) \ | |
| 62 /* OT_ASSERT it's positive. */) | |
| 63 #endif | |
| 64 | |
| 65 | |
| 66 #define OT_LABEL(Name) \ | |
| 67 OT_LABEL_END \ | |
| 68 OT_LABEL_START(Name) | |
| 69 | |
| 70 /* Whenever we receive an argument that is a list, it will expand to | |
| 71 * contain commas. That cannot be passed to another macro because the | |
| 72 * commas will throw off the preprocessor. The solution is to wrap | |
| 73 * the passed-in argument in OT_LIST() before passing to the next macro. | |
| 74 * Unfortunately this trick requires vararg macros. */ | |
| 75 #define OT_LIST(...) __VA_ARGS__ | |
| 76 | |
| 77 | |
| 78 /* | |
| 79 * Basic Types | |
| 80 */ | |
| 81 | |
| 82 #define OT_TAG(a,b,c,d) \ | |
| 83 OT_UINT8(a) OT_UINT8(b) OT_UINT8(c) OT_UINT8(d) | |
| 84 | |
| 85 #define OT_OFFSET(From, To) /* Offset from From to To in bytes */ \ | |
| 86 OT_UINT16(OT_DISTANCE(From, To)) | |
| 87 | |
| 88 #define OT_GLYPHID /* GlyphID */ \ | |
| 89 OT_UINT16 | |
| 90 /* Shorthand. */ | |
| 91 #define G OT_GLYPHID | |
| 92 | |
| 93 #define OT_UARRAY(Name, Items) \ | |
| 94 OT_LABEL_START(Name) \ | |
| 95 OT_UINT16(OT_COUNT(Name##Data, 2)) \ | |
| 96 OT_LABEL(Name##Data) \ | |
| 97 Items \ | |
| 98 OT_LABEL_END | |
| 99 | |
| 100 #define OT_UHEADLESSARRAY(Name, Items) \ | |
| 101 OT_LABEL_START(Name) \ | |
| 102 OT_UINT16(OT_COUNT(Name##Data, 2) + 1) \ | |
| 103 OT_LABEL(Name##Data) \ | |
| 104 Items \ | |
| 105 OT_LABEL_END | |
| 106 | |
| 107 | |
| 108 /* | |
| 109 * Common Types | |
| 110 */ | |
| 111 | |
| 112 #define OT_LOOKUP_FLAG_IGNORE_MARKS 0x08u | |
| 113 | |
| 114 #define OT_LOOKUP(Name, LookupType, LookupFlag, SubLookupOffsets) \ | |
| 115 OT_LABEL_START(Name) \ | |
| 116 OT_UINT16(LookupType) \ | |
| 117 OT_UINT16(LookupFlag) \ | |
| 118 OT_LABEL_END \ | |
| 119 OT_UARRAY(Name##SubLookupOffsetsArray, OT_LIST(SubLookupOffsets)) | |
| 120 | |
| 121 #define OT_SUBLOOKUP(Name, SubFormat, Items) \ | |
| 122 OT_LABEL_START(Name) \ | |
| 123 OT_UINT16(SubFormat) \ | |
| 124 Items | |
| 125 | |
| 126 #define OT_COVERAGE1(Name, Items) \ | |
| 127 OT_LABEL_START(Name) \ | |
| 128 OT_UINT16(1) \ | |
| 129 OT_LABEL_END \ | |
| 130 OT_UARRAY(Name##Glyphs, OT_LIST(Items)) | |
| 131 | |
| 132 | |
| 133 /* | |
| 134 * GSUB | |
| 135 */ | |
| 136 | |
| 137 #define OT_LOOKUP_TYPE_SUBST_SINGLE 1u | |
| 138 #define OT_LOOKUP_TYPE_SUBST_LIGATURE 4u | |
| 139 | |
| 140 #define OT_SUBLOOKUP_SINGLE_SUBST_FORMAT2(Name, FromGlyphs, ToGlyphs) \ | |
| 141 OT_SUBLOOKUP(Name, 2, \ | |
| 142 OT_OFFSET(Name, Name##Coverage) \ | |
| 143 OT_LABEL_END \ | |
| 144 OT_UARRAY(Name##Substitute, OT_LIST(ToGlyphs)) \ | |
| 145 ) \ | |
| 146 OT_COVERAGE1(Name##Coverage, OT_LIST(FromGlyphs)) \ | |
| 147 /* static_assert_expr (len(FromGlyphs) == len(ToGlyphs)) */ | |
| 148 | |
| 149 #define OT_SUBLOOKUP_LIGATURE_SUBST_FORMAT1(Name, FirstGlyphs, LigatureSetOffsets) \ | |
| 150 OT_SUBLOOKUP(Name, 1, \ | |
| 151 OT_OFFSET(Name, Name##Coverage) \ | |
| 152 OT_LABEL_END \ | |
| 153 OT_UARRAY(Name##LigatureSetOffsetsArray, OT_LIST(LigatureSetOffsets)) \ | |
| 154 ) \ | |
| 155 OT_COVERAGE1(Name##Coverage, OT_LIST(FirstGlyphs)) \ | |
| 156 /* static_assert_expr (len(FirstGlyphs) == len(LigatureSetOffsets)) */ | |
| 157 | |
| 158 #define OT_LIGATURE_SET(Name, LigatureSetOffsets) \ | |
| 159 OT_UARRAY(Name, OT_LIST(LigatureSetOffsets)) | |
| 160 | |
| 161 #define OT_LIGATURE(Name, Components, LigGlyph) \ | |
| 162 OT_LABEL_START(Name) \ | |
| 163 LigGlyph \ | |
| 164 OT_LABEL_END \ | |
| 165 OT_UHEADLESSARRAY(Name##ComponentsArray, OT_LIST(Components)) | |
| 166 | |
| 167 /* | |
| 168 * | |
| 169 * Start of Windows-1256 shaping table. | |
| 170 * | |
| 171 */ | |
| 172 | |
| 173 /* Table name. */ | |
| 174 #define TABLE_NAME arabic_win1256_gsub_lookups | |
| 175 | |
| 176 /* Table manifest. */ | |
| 177 #define MANIFEST(Items) \ | |
| 178 OT_LABEL_START(manifest) \ | |
| 179 OT_UINT16(OT_COUNT(manifestData, 6)) \ | |
| 180 OT_LABEL(manifestData) \ | |
| 181 Items \ | |
| 182 OT_LABEL_END | |
| 183 | |
| 184 #define MANIFEST_LOOKUP(Tag, Name) \ | |
| 185 Tag \ | |
| 186 OT_OFFSET(manifest, Name) | |
| 187 | |
| 188 | |
| 189 /* | |
| 190 * Table Start | |
| 191 */ | |
| 192 OT_TABLE_START | |
| 193 | |
| 194 | |
| 195 /* | |
| 196 * Manifest | |
| 197 */ | |
| 198 MANIFEST( | |
| 199 MANIFEST_LOOKUP(OT_TAG('r','l','i','g'), rligLookup) | |
| 200 MANIFEST_LOOKUP(OT_TAG('i','n','i','t'), initLookup) | |
| 201 MANIFEST_LOOKUP(OT_TAG('m','e','d','i'), mediLookup) | |
| 202 MANIFEST_LOOKUP(OT_TAG('f','i','n','a'), finaLookup) | |
| 203 MANIFEST_LOOKUP(OT_TAG('r','l','i','g'), rligMarksLookup) | |
| 204 ) | |
| 205 | |
| 206 /* | |
| 207 * Lookups | |
| 208 */ | |
| 209 OT_LOOKUP(initLookup, OT_LOOKUP_TYPE_SUBST_SINGLE, OT_LOOKUP_FLAG_IGNORE_MARKS, | |
| 210 OT_OFFSET(initLookup, initmediSubLookup) | |
| 211 OT_OFFSET(initLookup, initSubLookup) | |
| 212 ) | |
| 213 OT_LOOKUP(mediLookup, OT_LOOKUP_TYPE_SUBST_SINGLE, OT_LOOKUP_FLAG_IGNORE_MARKS, | |
| 214 OT_OFFSET(mediLookup, initmediSubLookup) | |
| 215 OT_OFFSET(mediLookup, mediSubLookup) | |
| 216 OT_OFFSET(mediLookup, medifinaLamAlefSubLookup) | |
| 217 ) | |
| 218 OT_LOOKUP(finaLookup, OT_LOOKUP_TYPE_SUBST_SINGLE, OT_LOOKUP_FLAG_IGNORE_MARKS, | |
| 219 OT_OFFSET(finaLookup, finaSubLookup) | |
| 220 /* We don't need this one currently as the sequence inherits masks | |
| 221 * from the first item. Just in case we change that in the future | |
| 222 * to be smart about Arabic masks when ligating... */ | |
| 223 OT_OFFSET(finaLookup, medifinaLamAlefSubLookup) | |
| 224 ) | |
| 225 OT_LOOKUP(rligLookup, OT_LOOKUP_TYPE_SUBST_LIGATURE, OT_LOOKUP_FLAG_IGNORE_MARKS, | |
| 226 OT_OFFSET(rligLookup, lamAlefLigaturesSubLookup) | |
| 227 ) | |
| 228 OT_LOOKUP(rligMarksLookup, OT_LOOKUP_TYPE_SUBST_LIGATURE, 0, | |
| 229 OT_OFFSET(rligMarksLookup, shaddaLigaturesSubLookup) | |
| 230 ) | |
| 231 | |
| 232 /* | |
| 233 * init/medi/fina forms | |
| 234 */ | |
| 235 OT_SUBLOOKUP_SINGLE_SUBST_FORMAT2(initmediSubLookup, | |
| 236 G(198) G(200) G(201) G(202) G(203) G(204) G(205) G(206) G(211) | |
| 237 G(212) G(213) G(214) G(223) G(225) G(227) G(228) G(236) G(237), | |
| 238 G(162) G(4) G(5) G(5) G(6) G(7) G(9) G(11) G(13) | |
| 239 G(14) G(15) G(26) G(140) G(141) G(142) G(143) G(154) G(154) | |
| 240 ) | |
| 241 OT_SUBLOOKUP_SINGLE_SUBST_FORMAT2(initSubLookup, | |
| 242 G(218) G(219) G(221) G(222) G(229), | |
| 243 G(27) G(30) G(128) G(131) G(144) | |
| 244 ) | |
| 245 OT_SUBLOOKUP_SINGLE_SUBST_FORMAT2(mediSubLookup, | |
| 246 G(218) G(219) G(221) G(222) G(229), | |
| 247 G(28) G(31) G(129) G(138) G(149) | |
| 248 ) | |
| 249 OT_SUBLOOKUP_SINGLE_SUBST_FORMAT2(finaSubLookup, | |
| 250 G(194) G(195) G(197) G(198) G(199) G(201) G(204) G(205) G(206) | |
| 251 G(218) G(219) G(229) G(236) G(237), | |
| 252 G(2) G(1) G(3) G(181) G(0) G(159) G(8) G(10) G(12) | |
| 253 G(29) G(127) G(152) G(160) G(156) | |
| 254 ) | |
| 255 OT_SUBLOOKUP_SINGLE_SUBST_FORMAT2(medifinaLamAlefSubLookup, | |
| 256 G(165) G(178) G(180) G(252), | |
| 257 G(170) G(179) G(185) G(255) | |
| 258 ) | |
| 259 | |
| 260 /* | |
| 261 * Lam+Alef ligatures | |
| 262 */ | |
| 263 OT_SUBLOOKUP_LIGATURE_SUBST_FORMAT1(lamAlefLigaturesSubLookup, | |
| 264 G(225), | |
| 265 OT_OFFSET(lamAlefLigaturesSubLookup, lamLigatureSet) | |
| 266 ) | |
| 267 OT_LIGATURE_SET(lamLigatureSet, | |
| 268 OT_OFFSET(lamLigatureSet, lamInitLigature1) | |
| 269 OT_OFFSET(lamLigatureSet, lamInitLigature2) | |
| 270 OT_OFFSET(lamLigatureSet, lamInitLigature3) | |
| 271 OT_OFFSET(lamLigatureSet, lamInitLigature4) | |
| 272 ) | |
| 273 OT_LIGATURE(lamInitLigature1, G(199), G(165)) | |
| 274 OT_LIGATURE(lamInitLigature2, G(195), G(178)) | |
| 275 OT_LIGATURE(lamInitLigature3, G(194), G(180)) | |
| 276 OT_LIGATURE(lamInitLigature4, G(197), G(252)) | |
| 277 | |
| 278 /* | |
| 279 * Shadda ligatures | |
| 280 */ | |
| 281 OT_SUBLOOKUP_LIGATURE_SUBST_FORMAT1(shaddaLigaturesSubLookup, | |
| 282 G(248), | |
| 283 OT_OFFSET(shaddaLigaturesSubLookup, shaddaLigatureSet) | |
| 284 ) | |
| 285 OT_LIGATURE_SET(shaddaLigatureSet, | |
| 286 OT_OFFSET(shaddaLigatureSet, shaddaLigature1) | |
| 287 OT_OFFSET(shaddaLigatureSet, shaddaLigature2) | |
| 288 OT_OFFSET(shaddaLigatureSet, shaddaLigature3) | |
| 289 ) | |
| 290 OT_LIGATURE(shaddaLigature1, G(243), G(172)) | |
| 291 OT_LIGATURE(shaddaLigature2, G(245), G(173)) | |
| 292 OT_LIGATURE(shaddaLigature3, G(246), G(175)) | |
| 293 | |
| 294 /* | |
| 295 * Table end | |
| 296 */ | |
| 297 OT_TABLE_END | |
| 298 | |
| 299 | |
| 300 /* | |
| 301 * Clean up | |
| 302 */ | |
| 303 | |
| 304 #undef MANIFEST | |
| 305 #undef MANIFEST_LOOKUP | |
| 306 | |
| 307 #undef OT_TABLE_START | |
| 308 #undef OT_TABLE_END | |
| 309 #undef OT_LABEL_START | |
| 310 #undef OT_LABEL_END | |
| 311 #undef OT_UINT8 | |
| 312 #undef OT_UINT16 | |
| 313 #undef OT_COUNT | |
| 314 #undef OT_DISTANCE | |
| 315 | |
| 316 #undef OT_LABEL | |
| 317 #undef OT_LIST | |
| 318 | |
| 319 #undef OT_TAG | |
| 320 #undef OT_OFFSET | |
| 321 #undef OT_GLYPHID | |
| 322 #undef G | |
| 323 #undef OT_UARRAY | |
| 324 #undef OT_UHEADLESSARRAY | |
| 325 | |
| 326 #undef OT_LOOKUP_FLAG_IGNORE_MARKS | |
| 327 #undef OT_LOOKUP | |
| 328 #undef OT_SUBLOOKUP | |
| 329 #undef OT_COVERAGE1 | |
| 330 #undef OT_LOOKUP_TYPE_SUBST_SINGLE | |
| 331 #undef OT_LOOKUP_TYPE_SUBST_LIGATURE | |
| 332 #undef OT_SUBLOOKUP_SINGLE_SUBST_FORMAT2 | |
| 333 #undef OT_SUBLOOKUP_LIGATURE_SUBST_FORMAT1 | |
| 334 #undef OT_LIGATURE_SET | |
| 335 #undef OT_LIGATURE | |
| 336 | |
| 337 | |
| 338 /* | |
| 339 * Include a second time to get the table data... | |
| 340 */ | |
| 341 #if 0 | |
| 342 #include "hb.hh" /* Make check-includes.sh happy. */ | |
| 343 #endif | |
| 344 #ifdef OT_MEASURE | |
| 345 #include "hb-ot-shaper-arabic-win1256.hh" | |
| 346 #endif | |
| 347 | |
| 348 #define HB_OT_SHAPER_ARABIC_WIN1256_HH | |
| 349 #endif /* HB_OT_SHAPER_ARABIC_WIN1256_HH */ |
