-
Notifications
You must be signed in to change notification settings - Fork 0
/
harfbuzz.py
6589 lines (5891 loc) · 248 KB
/
harfbuzz.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#+
# Python-3 binding for HarfBuzz.
#
# Additional recommended libraries:
# python_freetype <https://github.com/ldo/python_freetype> -- binding for FreeType
# Qahirah <https://github.com/ldo/qahirah> -- binding for Cairo
# PyBidi <https://github.com/ldo/pybidi> -- binding for FriBidi
#
# Python adaptation copyright © 2016-2018 Lawrence D'Oliveiro,
# based on C original by Behdad Esfahbod and others.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library, in a file named COPYING; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA
#-
import sys
import ctypes as ct
import array
from weakref import \
ref as wref, \
WeakValueDictionary
import atexit
try :
import freetype2 as freetype
except ImportError :
freetype = None
#end try
try :
import qahirah
except ImportError :
qahirah = None
#end try
LIBNAME = \
{
"linux" :
{
"harfbuzz" : "libharfbuzz.so",
},
"openbsd6" :
{
"harfbuzz" : "libharfbuzz.so",
},
"darwin" :
{
"harfbuzz" : "libharfbuzz.dylib",
},
"win32" :
{
"harfbuzz" : "libharfbuzz-0.dll",
},
}[sys.platform]
hb = ct.cdll.LoadLibrary(LIBNAME["harfbuzz"])
class HARFBUZZ :
"useful definitions adapted from harfbuzz/*.h. You will need to use the constants" \
" and “macro” functions, but apart from that, see the more Pythonic wrappers" \
" defined outside this class in preference to accessing low-level structures directly."
# General ctypes gotcha: when passing addresses of ctypes-constructed objects
# to routine calls, do not construct the objects directly in the call. Otherwise
# the refcount goes to 0 before the routine is actually entered, and the object
# can get prematurely disposed. Always store the object reference into a local
# variable, and pass the value of the variable instead.
# from hb-version.h:
VERSION_MAJOR = 2
VERSION_MINOR = 2
VERSION_MICRO = 0
VERSION_STRING = "2.2.0"
# VERSION_ATLEAST defined below
# from hb-common.h:
bool_t = ct.c_int
codepoint_t = ct.c_uint
position_t = ct.c_int # fixed 16.6?
mask_t = ct.c_uint
to_position_t = lambda x : round(x * 64)
from_position_t = lambda x : x / 64
class var_int_t(ct.Union) :
_fields_ = \
[
("u32", ct.c_uint),
("i32", ct.c_int),
("u16", ct.c_ushort),
("i16", ct.c_short),
("u8", ct.c_ubyte),
("i8", ct.c_byte),
]
#end var_int_t
tag_t = ct.c_uint
def TAG(*args) :
"creates a tag_t from four byte values or a bytes or str value of length 4."
result = None # to begin with
if len(args) == 4 :
c1, c2, c3, c4 = args
elif len(args) == 1 :
arg = args[0]
if isinstance(arg, (bytes, bytearray, list, tuple)) :
c1, c2, c3, c4 = tuple(arg)
elif isinstance(arg, str) :
args = tuple(ord(c) for c in arg)
if len(args) != 4 or not all(i < 128 for i in args) :
raise TypeError("TAG string must be 4 ASCII chars in [0 .. 255]")
#end if
c1, c2, c3, c4 = args
elif isinstance(arg, int) :
if arg < 0 or arg > 0xFFFFFFFF :
raise ValueError("TAG int must be in [0 .. 2 ** 32 - 1]")
#end if
result = arg
else :
raise TypeError("TAG arg must be bytes or string")
#end if
else :
raise TypeError("wrong nr of TAG args")
#end if
if result == None :
result = c1 << 24 | c2 << 16 | c3 << 8 | c4
#end if
return \
result
#end TAG
def UNTAG(tag, printable = False) :
"decomposes a tag_t into a tuple or bytes object of four byte values."
result = (tag >> 24 & 255, tag >> 16 & 255, tag >> 8 & 255, tag & 255)
if printable :
result = bytes(result)
#end if
return \
result
#end UNTAG
TAG_NONE = TAG(0, 0, 0, 0)
TAG_MAX = TAG(0xff, 0xff, 0xff, 0xff)
TAG_MAX_SIGNED = TAG(0x7f, 0xff, 0xff, 0xff)
direction_t = ct.c_uint
DIRECTION_INVALID = 0
DIRECTION_LTR = 4
DIRECTION_RTL = 5
DIRECTION_TTB = 6
DIRECTION_BTT = 7
def DIRECTION_IS_VALID(dirn) :
return \
dirn & ~3 == 4
#end DIRECTION_IS_VALID
# Direction must be valid for the following
def DIRECTION_IS_HORIZONTAL(dirn) :
return \
dirn & ~1 == 4
#end DIRECTION_IS_HORIZONTAL
def DIRECTION_IS_VERTICAL(dirn) :
return \
dirn & ~1 == 6
#end DIRECTION_IS_VERTICAL
def DIRECTION_IS_FORWARD(dirn) :
return \
dirn & ~2 == 4
#end DIRECTION_IS_FORWARD
def DIRECTION_IS_BACKWARD(dirn) :
return \
dirn & ~2 == 5
#end DIRECTION_IS_BACKWARD
def DIRECTION_REVERSE(dirn) :
return \
dirn ^ 1
#end DIRECTION_REVERSE
script_t = ct.c_uint
# http://unicode.org/iso15924/
# http://goo.gl/x9ilM
# Unicode Character Database property: Script (sc)
# 1.1
SCRIPT_COMMON = TAG(b'Zyyy')
SCRIPT_INHERITED = TAG(b'Zinh')
# 5.0
SCRIPT_UNKNOWN = TAG(b'Zzzz')
# 1.1
SCRIPT_ARABIC = TAG(b'Arab')
SCRIPT_ARMENIAN = TAG(b'Armn')
SCRIPT_BENGALI = TAG(b'Beng')
SCRIPT_CYRILLIC = TAG(b'Cyrl')
SCRIPT_DEVANAGARI = TAG(b'Deva')
SCRIPT_GEORGIAN = TAG(b'Geor')
SCRIPT_GREEK = TAG(b'Grek')
SCRIPT_GUJARATI = TAG(b'Gujr')
SCRIPT_GURMUKHI = TAG(b'Guru')
SCRIPT_HANGUL = TAG(b'Hang')
SCRIPT_HAN = TAG(b'Hani')
SCRIPT_HEBREW = TAG(b'Hebr')
SCRIPT_HIRAGANA = TAG(b'Hira')
SCRIPT_KANNADA = TAG(b'Knda')
SCRIPT_KATAKANA = TAG(b'Kana')
SCRIPT_LAO = TAG(b'Laoo')
SCRIPT_LATIN = TAG(b'Latn')
SCRIPT_MALAYALAM = TAG(b'Mlym')
SCRIPT_ORIYA = TAG(b'Orya')
SCRIPT_TAMIL = TAG(b'Taml')
SCRIPT_TELUGU = TAG(b'Telu')
SCRIPT_THAI = TAG(b'Thai')
# 2.0
SCRIPT_TIBETAN = TAG(b'Tibt')
# 3.0
SCRIPT_BOPOMOFO = TAG(b'Bopo')
SCRIPT_BRAILLE = TAG(b'Brai')
SCRIPT_CANADIAN_SYLLABICS = TAG(b'Cans')
SCRIPT_CHEROKEE = TAG(b'Cher')
SCRIPT_ETHIOPIC = TAG(b'Ethi')
SCRIPT_KHMER = TAG(b'Khmr')
SCRIPT_MONGOLIAN = TAG(b'Mong')
SCRIPT_MYANMAR = TAG(b'Mymr')
SCRIPT_OGHAM = TAG(b'Ogam')
SCRIPT_RUNIC = TAG(b'Runr')
SCRIPT_SINHALA = TAG(b'Sinh')
SCRIPT_SYRIAC = TAG(b'Syrc')
SCRIPT_THAANA = TAG(b'Thaa')
SCRIPT_YI = TAG(b'Yiii')
# 3.1
SCRIPT_DESERET = TAG(b'Dsrt')
SCRIPT_GOTHIC = TAG(b'Goth')
SCRIPT_OLD_ITALIC = TAG(b'Ital')
# 3.2
SCRIPT_BUHID = TAG(b'Buhd')
SCRIPT_HANUNOO = TAG(b'Hano')
SCRIPT_TAGALOG = TAG(b'Tglg')
SCRIPT_TAGBANWA = TAG(b'Tagb')
# 4.0
SCRIPT_CYPRIOT = TAG(b'Cprt')
SCRIPT_LIMBU = TAG(b'Limb')
SCRIPT_LINEAR_B = TAG(b'Linb')
SCRIPT_OSMANYA = TAG(b'Osma')
SCRIPT_SHAVIAN = TAG(b'Shaw')
SCRIPT_TAI_LE = TAG(b'Tale')
SCRIPT_UGARITIC = TAG(b'Ugar')
# 4.1
SCRIPT_BUGINESE = TAG(b'Bugi')
SCRIPT_COPTIC = TAG(b'Copt')
SCRIPT_GLAGOLITIC = TAG(b'Glag')
SCRIPT_KHAROSHTHI = TAG(b'Khar')
SCRIPT_NEW_TAI_LUE = TAG(b'Talu')
SCRIPT_OLD_PERSIAN = TAG(b'Xpeo')
SCRIPT_SYLOTI_NAGRI = TAG(b'Sylo')
SCRIPT_TIFINAGH = TAG(b'Tfng')
# 5.0
SCRIPT_BALINESE = TAG(b'Bali')
SCRIPT_CUNEIFORM = TAG(b'Xsux')
SCRIPT_NKO = TAG(b'Nkoo')
SCRIPT_PHAGS_PA = TAG(b'Phag')
SCRIPT_PHOENICIAN = TAG(b'Phnx')
# 5.1
SCRIPT_CARIAN = TAG(b'Cari')
SCRIPT_CHAM = TAG(b'Cham')
SCRIPT_KAYAH_LI = TAG(b'Kali')
SCRIPT_LEPCHA = TAG(b'Lepc')
SCRIPT_LYCIAN = TAG(b'Lyci')
SCRIPT_LYDIAN = TAG(b'Lydi')
SCRIPT_OL_CHIKI = TAG(b'Olck')
SCRIPT_REJANG = TAG(b'Rjng')
SCRIPT_SAURASHTRA = TAG(b'Saur')
SCRIPT_SUNDANESE = TAG(b'Sund')
SCRIPT_VAI = TAG(b'Vaii')
# 5.2
SCRIPT_AVESTAN = TAG(b'Avst')
SCRIPT_BAMUM = TAG(b'Bamu')
SCRIPT_EGYPTIAN_HIEROGLYPHS = TAG(b'Egyp')
SCRIPT_IMPERIAL_ARAMAIC = TAG(b'Armi')
SCRIPT_INSCRIPTIONAL_PAHLAVI = TAG(b'Phli')
SCRIPT_INSCRIPTIONAL_PARTHIAN = TAG(b'Prti')
SCRIPT_JAVANESE = TAG(b'Java')
SCRIPT_KAITHI = TAG(b'Kthi')
SCRIPT_LISU = TAG(b'Lisu')
SCRIPT_MEETEI_MAYEK = TAG(b'Mtei')
SCRIPT_OLD_SOUTH_ARABIAN = TAG(b'Sarb')
SCRIPT_OLD_TURKIC = TAG(b'Orkh')
SCRIPT_SAMARITAN = TAG(b'Samr')
SCRIPT_TAI_THAM = TAG(b'Lana')
SCRIPT_TAI_VIET = TAG(b'Tavt')
# 6.0
SCRIPT_BATAK = TAG(b'Batk')
SCRIPT_BRAHMI = TAG(b'Brah')
SCRIPT_MANDAIC = TAG(b'Mand')
# 6.1
SCRIPT_CHAKMA = TAG(b'Cakm')
SCRIPT_MEROITIC_CURSIVE = TAG(b'Merc')
SCRIPT_MEROITIC_HIEROGLYPHS = TAG(b'Mero')
SCRIPT_MIAO = TAG(b'Plrd')
SCRIPT_SHARADA = TAG(b'Shrd')
SCRIPT_SORA_SOMPENG = TAG(b'Sora')
SCRIPT_TAKRI = TAG(b'Takr')
# Since: 0.9.30
# 7.0
SCRIPT_BASSA_VAH = TAG(b'Bass')
SCRIPT_CAUCASIAN_ALBANIAN = TAG(b'Aghb')
SCRIPT_DUPLOYAN = TAG(b'Dupl')
SCRIPT_ELBASAN = TAG(b'Elba')
SCRIPT_GRANTHA = TAG(b'Gran')
SCRIPT_KHOJKI = TAG(b'Khoj')
SCRIPT_KHUDAWADI = TAG(b'Sind')
SCRIPT_LINEAR_A = TAG(b'Lina')
SCRIPT_MAHAJANI = TAG(b'Mahj')
SCRIPT_MANICHAEAN = TAG(b'Mani')
SCRIPT_MENDE_KIKAKUI = TAG(b'Mend')
SCRIPT_MODI = TAG(b'Modi')
SCRIPT_MRO = TAG(b'Mroo')
SCRIPT_NABATAEAN = TAG(b'Nbat')
SCRIPT_OLD_NORTH_ARABIAN = TAG(b'Narb')
SCRIPT_OLD_PERMIC = TAG(b'Perm')
SCRIPT_PAHAWH_HMONG = TAG(b'Hmng')
SCRIPT_PALMYRENE = TAG(b'Palm')
SCRIPT_PAU_CIN_HAU = TAG(b'Pauc')
SCRIPT_PSALTER_PAHLAVI = TAG(b'Phlp')
SCRIPT_SIDDHAM = TAG(b'Sidd')
SCRIPT_TIRHUTA = TAG(b'Tirh')
SCRIPT_WARANG_CITI = TAG(b'Wara')
# 8.0
SCRIPT_AHOM = TAG(b'Ahom')
SCRIPT_ANATOLIAN_HIEROGLYPHS = TAG(b'Hluw')
SCRIPT_HATRAN = TAG(b'Hatr')
SCRIPT_MULTANI = TAG(b'Mult')
SCRIPT_OLD_HUNGARIAN = TAG(b'Hung')
SCRIPT_SIGNWRITING = TAG(b'Sgnw')
# since 1.3.0
# 9.0
SCRIPT_ADLAM = TAG(b'Adlm')
SCRIPT_BHAIKSUKI = TAG(b'Bhks')
SCRIPT_MARCHEN = TAG(b'Marc')
SCRIPT_OSAGE = TAG(b'Osge')
SCRIPT_TANGUT = TAG(b'Tang')
SCRIPT_NEWA = TAG(b'Newa')
# since 1.6.0
# 10.0
SCRIPT_MASARAM_GONDI = TAG(b'Gonm')
SCRIPT_NUSHU = TAG(b'Nshu')
SCRIPT_SOYOMBO = TAG(b'Soyo')
ZANABAZAR_SQUARE = TAG(b'Zanb')
# since 1.8.0
# 11.0
SCRIPT_DOGRA = TAG(b'Dogr')
SCRIPT_GUNJALA_GONDI = TAG(b'Gong')
SCRIPT_HANIFI_ROHINGYA = TAG(b'Rohg')
SCRIPT_MAKASAR = TAG(b'Maka')
SCRIPT_MEDEFAIDRIN = TAG(b'Medf')
SCRIPT_OLD_SOGDIAN = TAG(b'Sogo')
SCRIPT_SOGDIAN = TAG(b'Sogd')
# No script set.
SCRIPT_INVALID = TAG_NONE
# NYI _HB_SCRIPT_MAX_VALUE, _HB_SCRIPT_MAX_VALUE_SIGNED?
destroy_func_t = ct.CFUNCTYPE(None, ct.c_void_p)
# from hb-common.h
class feature_t(ct.Structure) :
pass
feature_t._fields_ = \
[
("tag", tag_t),
("value", ct.c_uint),
("start", ct.c_uint),
("end", ct.c_uint),
]
#end feature_t
# since 1.4.2:
class variation_t(ct.Structure) :
pass
variation_t._fields_ = \
[
("tag", tag_t),
("value", ct.c_float),
]
#end variation_t
# since 2.0.0:
FEATURE_GLOBAL_START = 0
FEATURE_GLOBAL_END = 0xFFFFFFFF
# since 2.1.0:
colour_t = ct.c_uint
color_t = colour_t
COLOUR = TAG
COLOR = COLOUR
UNCOLOUR = UNTAG
UNCOLOR = UNCOLOUR
colour_get_alpha = lambda c : c & 0xFF
colour_get_red = lambda c : c >> 8 & 0xFF
colour_get_green = lambda c : c >> 16 & 0xFF
colour_get_blue = lambda c : c >> 24 & 0xFF
color_get_alpha = colour_get_alpha
color_get_red = colour_get_red
color_get_green = colour_get_green
color_get_blue = colour_get_blue
# from hb-unicode.h:
# since: 1.9.0
UNICODE_MAX = 0x10FFFF
unicode_general_category_t = ct.c_uint
UNICODE_GENERAL_CATEGORY_CONTROL = 0 # Cc
UNICODE_GENERAL_CATEGORY_FORMAT = 1 # Cf
UNICODE_GENERAL_CATEGORY_UNASSIGNED = 2 # Cn
UNICODE_GENERAL_CATEGORY_PRIVATE_USE = 3 # Co
UNICODE_GENERAL_CATEGORY_SURROGATE = 4 # Cs
UNICODE_GENERAL_CATEGORY_LOWERCASE_LETTER = 5 # Ll
UNICODE_GENERAL_CATEGORY_MODIFIER_LETTER = 6 # Lm
UNICODE_GENERAL_CATEGORY_OTHER_LETTER = 7 # Lo
UNICODE_GENERAL_CATEGORY_TITLECASE_LETTER = 8 # Lt
UNICODE_GENERAL_CATEGORY_UPPERCASE_LETTER = 9 # Lu
UNICODE_GENERAL_CATEGORY_SPACING_MARK = 10 # Mc
UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK = 11 # Me
UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK = 12 # Mn
UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER = 13 # Nd
UNICODE_GENERAL_CATEGORY_LETTER_NUMBER = 14 # Nl
UNICODE_GENERAL_CATEGORY_OTHER_NUMBER = 15 # No
UNICODE_GENERAL_CATEGORY_CONNECT_PUNCTUATION = 16 # Pc
UNICODE_GENERAL_CATEGORY_DASH_PUNCTUATION = 17 # Pd
UNICODE_GENERAL_CATEGORY_CLOSE_PUNCTUATION = 18 # Pe
UNICODE_GENERAL_CATEGORY_FINAL_PUNCTUATION = 19 # Pf
UNICODE_GENERAL_CATEGORY_INITIAL_PUNCTUATION = 20 # Pi
UNICODE_GENERAL_CATEGORY_OTHER_PUNCTUATION = 21 # Po
UNICODE_GENERAL_CATEGORY_OPEN_PUNCTUATION = 22 # Ps
UNICODE_GENERAL_CATEGORY_CURRENCY_SYMBOL = 23 # Sc
UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL = 24 # Sk
UNICODE_GENERAL_CATEGORY_MATH_SYMBOL = 25 # Sm
UNICODE_GENERAL_CATEGORY_OTHER_SYMBOL = 26 # So
UNICODE_GENERAL_CATEGORY_LINE_SEPARATOR = 27 # Zl
UNICODE_GENERAL_CATEGORY_PARAGRAPH_SEPARATOR = 28 # Zp
UNICODE_GENERAL_CATEGORY_SPACE_SEPARATOR = 29 # Zs
# hb_unicode_combining_class_t
# Note: newer versions of Unicode may add new values. Clients should be ready to handle
# any value in the 0..254 range being returned from hb_unicode_combining_class().
# Unicode Character Database property: Canonical_Combining_Class (ccc)
unicode_combining_class_t = ct.c_uint
UNICODE_COMBINING_CLASS_NOT_REORDERED = 0
UNICODE_COMBINING_CLASS_OVERLAY = 1
UNICODE_COMBINING_CLASS_NUKTA = 7
UNICODE_COMBINING_CLASS_KANA_VOICING = 8
UNICODE_COMBINING_CLASS_VIRAMA = 9
# Hebrew
UNICODE_COMBINING_CLASS_CCC10 = 10
UNICODE_COMBINING_CLASS_CCC11 = 11
UNICODE_COMBINING_CLASS_CCC12 = 12
UNICODE_COMBINING_CLASS_CCC13 = 13
UNICODE_COMBINING_CLASS_CCC14 = 14
UNICODE_COMBINING_CLASS_CCC15 = 15
UNICODE_COMBINING_CLASS_CCC16 = 16
UNICODE_COMBINING_CLASS_CCC17 = 17
UNICODE_COMBINING_CLASS_CCC18 = 18
UNICODE_COMBINING_CLASS_CCC19 = 19
UNICODE_COMBINING_CLASS_CCC20 = 20
UNICODE_COMBINING_CLASS_CCC21 = 21
UNICODE_COMBINING_CLASS_CCC22 = 22
UNICODE_COMBINING_CLASS_CCC23 = 23
UNICODE_COMBINING_CLASS_CCC24 = 24
UNICODE_COMBINING_CLASS_CCC25 = 25
UNICODE_COMBINING_CLASS_CCC26 = 26
# Arabic
UNICODE_COMBINING_CLASS_CCC27 = 27
UNICODE_COMBINING_CLASS_CCC28 = 28
UNICODE_COMBINING_CLASS_CCC29 = 29
UNICODE_COMBINING_CLASS_CCC30 = 30
UNICODE_COMBINING_CLASS_CCC31 = 31
UNICODE_COMBINING_CLASS_CCC32 = 32
UNICODE_COMBINING_CLASS_CCC33 = 33
UNICODE_COMBINING_CLASS_CCC34 = 34
UNICODE_COMBINING_CLASS_CCC35 = 35
# Syriac
UNICODE_COMBINING_CLASS_CCC36 = 36
# Telugu
UNICODE_COMBINING_CLASS_CCC84 = 84
UNICODE_COMBINING_CLASS_CCC91 = 91
# Thai
UNICODE_COMBINING_CLASS_CCC103 = 103
UNICODE_COMBINING_CLASS_CCC107 = 107
# Lao
UNICODE_COMBINING_CLASS_CCC118 = 118
UNICODE_COMBINING_CLASS_CCC122 = 122
# Tibetan
UNICODE_COMBINING_CLASS_CCC129 = 129
UNICODE_COMBINING_CLASS_CCC130 = 130
UNICODE_COMBINING_CLASS_CCC133 = 132
UNICODE_COMBINING_CLASS_ATTACHED_BELOW_LEFT = 200
UNICODE_COMBINING_CLASS_ATTACHED_BELOW = 202
UNICODE_COMBINING_CLASS_ATTACHED_ABOVE = 214
UNICODE_COMBINING_CLASS_ATTACHED_ABOVE_RIGHT = 216
UNICODE_COMBINING_CLASS_BELOW_LEFT = 218
UNICODE_COMBINING_CLASS_BELOW = 220
UNICODE_COMBINING_CLASS_BELOW_RIGHT = 222
UNICODE_COMBINING_CLASS_LEFT = 224
UNICODE_COMBINING_CLASS_RIGHT = 226
UNICODE_COMBINING_CLASS_ABOVE_LEFT = 228
UNICODE_COMBINING_CLASS_ABOVE = 230
UNICODE_COMBINING_CLASS_ABOVE_RIGHT = 232
UNICODE_COMBINING_CLASS_DOUBLE_BELOW = 233
UNICODE_COMBINING_CLASS_DOUBLE_ABOVE = 234
UNICODE_COMBINING_CLASS_IOTA_SUBSCRIPT = 240
UNICODE_COMBINING_CLASS_INVALID = 255
# Since: 0.9.2
unicode_combining_class_func_t = \
ct.CFUNCTYPE(unicode_combining_class_t, ct.c_void_p, codepoint_t, ct.c_void_p)
unicode_general_category_func_t = \
ct.CFUNCTYPE(unicode_general_category_t, ct.c_void_p, codepoint_t, ct.c_void_p)
unicode_mirroring_func_t = \
ct.CFUNCTYPE(codepoint_t, ct.c_void_p, codepoint_t, ct.c_void_p)
unicode_script_func_t = \
ct.CFUNCTYPE(script_t, ct.c_void_p, codepoint_t, ct.c_void_p)
unicode_compose_func_t = \
ct.CFUNCTYPE(bool_t, ct.c_void_p, codepoint_t, codepoint_t, ct.POINTER(codepoint_t), ct.c_void_p)
unicode_decompose_func_t = \
ct.CFUNCTYPE(bool_t, ct.c_void_p, codepoint_t, ct.POINTER(codepoint_t), ct.POINTER(codepoint_t), ct.c_void_p)
UNICODE_MAX_DECOMPOSITION_LEN = 18 + 1 # codepoints
# deprecated since 2.0.0
# from hb-blob.h:
memory_mode = ct.c_uint
MEMORY_MODE_DUPLICATE = 0
# blob is to get its own copy of data; its mode becomes MEMORY_MODE_WRITABLE
MEMORY_MODE_READONLY = 1
# passed data area is to be assumed to be read-only, so any
# attempt to get writable access will cause it to be copied
# to a new area and the mode changed to MEMORY_MODE_WRITABLE
MEMORY_MODE_WRITABLE = 2 # passed data area is to be assumed to be writable
MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE = 3
# passed data area is to be assumed to be initially read-only, but
# may be made writable in-place
# from hb-buffer.h:
# since: 1.5.0
GLYPH_FLAG_UNSAFE_TO_BREAK = 0x00000001
GLYPH_FLAG_DEFINED = 0x00000001 # mask of all defined flags
glyph_flags_t = ct.c_uint
glyph_info_get_glyph_flags = lambda info : info.mask & GLYPH_FLAG_DEFINED
buffer_content_type_t = ct.c_uint
BUFFER_CONTENT_TYPE_INVALID = 0
BUFFER_CONTENT_TYPE_UNICODE = 1
BUFFER_CONTENT_TYPE_GLYPHS = 2
# since: 0.9.20
buffer_flags_t = ct.c_uint
BUFFER_FLAG_DEFAULT = 0x00000000
BUFFER_FLAG_BOT = 0x00000001 # Beginning-of-text
BUFFER_FLAG_EOT = 0x00000002 # End-of-text
BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES = 0x00000004
BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES = 0x00000008 # since: 1.8.0
# since: 0.9.42
buffer_cluster_level_t = ct.c_uint
BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES = 0
BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS = 1
BUFFER_CLUSTER_LEVEL_CHARACTERS = 2
BUFFER_CLUSTER_LEVEL_DEFAULT = BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES
# since: 0.9.31
# The default code point for replacing invalid characters in a given encoding
BUFFER_REPLACEMENT_CODEPOINT_DEFAULT = 0xFFFD
class segment_properties_t(ct.Structure) :
pass
segment_properties_t._fields_ = \
[
("direction", direction_t),
("script", script_t),
("language", ct.c_void_p), # language_t
# private
("reserved1", ct.c_void_p),
("reserved2", ct.c_void_p),
]
#end segment_properties_t
SEGMENT_PROPERTIES_DEFAULT = \
segment_properties_t \
(
DIRECTION_INVALID,
SCRIPT_INVALID,
None, # Language.INVALID
None,
None,
)
class glyph_info_t(ct.Structure) :
pass
glyph_info_t._fields_ = \
[
("codepoint", codepoint_t),
("mask", mask_t),
("cluster", ct.c_uint),
# private
("var1", var_int_t),
("var2", var_int_t),
]
#end glyph_info_t
class glyph_position_t(ct.Structure) :
pass
glyph_position_t._fields_ = \
[
("x_advance", position_t),
("y_advance", position_t),
("x_offset", position_t),
("y_offset", position_t),
# private
("var", var_int_t),
]
#end glyph_position_t
buffer_message_func_t = ct.CFUNCTYPE(bool_t, ct.c_void_p, ct.c_void_p, ct.c_char_p, ct.c_void_p)
# since: 0.9.20
buffer_serialize_flags_t = ct.c_uint
BUFFER_SERIALIZE_FLAG_DEFAULT = 0x00000000
BUFFER_SERIALIZE_FLAG_NO_CLUSTERS = 0x00000001
BUFFER_SERIALIZE_FLAG_NO_POSITIONS = 0x00000002
BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES = 0x00000004
BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS = 0x00000008
BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS = 0x00000010 # since: 1.5.0
BUFFER_SERIALIZE_FLAG_NO_ADVANCES = 0x00000020 # since: 1.8.0
# since: 0.9.2
buffer_serialize_format_t = ct.c_uint
BUFFER_SERIALIZE_FORMAT_TEXT = TAG(b'TEXT')
BUFFER_SERIALIZE_FORMAT_JSON = TAG(b'JSON')
BUFFER_SERIALIZE_FORMAT_INVALID = TAG_NONE
buffer_diff_flags_t = ct.c_uint
BUFFER_DIFF_FLAG_EQUAL = 0x0000
BUFFER_DIFF_FLAG_CONTENT_TYPE_MISMATCH = 0x0001
# cannot be meaningfully compared in any further detail
BUFFER_DIFF_FLAG_LENGTH_MISMATCH = 0x0002
# but dotted circle and .notdef still checked for
BUFFER_DIFF_FLAG_NOTDEF_PRESENT = 0x0004
BUFFER_DIFF_FLAG_DOTTED_CIRCLE_PRESENT = 0x0008
# further things checked for when lengths are the same
BUFFER_DIFF_FLAG_CODEPOINT_MISMATCH = 0x0010
BUFFER_DIFF_FLAG_CLUSTER_MISMATCH = 0x0020
BUFFER_DIFF_FLAG_GLYPH_FLAGS_MISMATCH = 0x0040
BUFFER_DIFF_FLAG_POSITION_MISMATCH = 0x0080
# from hb-face.h:
reference_table_func_t = ct.CFUNCTYPE(ct.c_void_p, ct.c_void_p, tag_t, ct.c_void_p)
# from hb-font.h:
class font_extents_t(ct.Structure) :
pass
# Note that typically ascender is positive and descender negative in
# coordinate systems that grow up.
font_extents_t._fields_ = \
[
("ascender", position_t), # typographic ascender.
("descender", position_t), # typographic descender.
("line_gap", position_t), # suggested line spacing gap.
# private
("reserved9", position_t),
("reserved8", position_t),
("reserved7", position_t),
("reserved6", position_t),
("reserved5", position_t),
("reserved4", position_t),
("reserved3", position_t),
("reserved2", position_t),
("reserved1", position_t),
]
#end font_extents_t
# Note that height is negative in coordinate systems that grow up.
class glyph_extents_t(ct.Structure) :
pass
glyph_extents_t._fields_ = \
[
("x_bearing", position_t), # left side of glyph from origin.
("y_bearing", position_t), # top side of glyph from origin.
("width", position_t), # distance from left to right side.
("height", position_t), # distance from top to bottom side.
]
#end glyph_extents_t
font_get_font_extents_func_t = ct.CFUNCTYPE(bool_t, ct.c_void_p, ct.c_void_p, ct.POINTER(font_extents_t), ct.c_void_p)
font_get_font_h_extents_func_t = font_get_font_extents_func_t
font_get_font_v_extents_func_t = font_get_font_extents_func_t
font_get_nominal_glyph_func_t = ct.CFUNCTYPE(bool_t, ct.c_void_p, ct.c_void_p, codepoint_t, ct.POINTER(codepoint_t), ct.c_void_p)
font_get_variation_glyph_func_t = ct.CFUNCTYPE(bool_t, ct.c_void_p, ct.c_void_p, codepoint_t, codepoint_t, ct.POINTER(codepoint_t), ct.c_void_p)
font_get_nominal_glyphs_func_t = ct.CFUNCTYPE(ct.c_uint, ct.c_void_p, ct.c_void_p, ct.c_uint, ct.POINTER(codepoint_t), ct.c_uint, ct.POINTER(codepoint_t), ct.c_uint, ct.c_void_p)
font_get_glyph_advance_func_t = ct.CFUNCTYPE(position_t, ct.c_void_p, ct.c_void_p, codepoint_t, ct.c_void_p)
font_get_glyph_h_advance_func_t = font_get_glyph_advance_func_t
font_get_glyph_v_advance_func_t = font_get_glyph_advance_func_t
font_get_glyph_advances_func_t = ct.CFUNCTYPE(None, ct.c_void_p, ct.c_void_p, ct.c_uint, ct.POINTER(codepoint_t), ct.c_uint, ct.POINTER(codepoint_t), ct.c_uint, ct.c_void_p)
font_get_glyph_h_advances_func_t = font_get_glyph_advances_func_t
font_get_glyph_v_advances_func_t = font_get_glyph_advances_func_t
font_get_glyph_origin_func_t = ct.CFUNCTYPE(bool_t, ct.c_void_p, ct.c_void_p, codepoint_t, ct.POINTER(position_t), ct.POINTER(position_t), ct.c_void_p)
font_get_glyph_h_origin_func_t = font_get_glyph_origin_func_t
font_get_glyph_v_origin_func_t = font_get_glyph_origin_func_t
# font_get_glyph_kerning_func_t, font_get_glyph_{h,v}_kerning_func_t deprecated since 2.0.0
font_get_glyph_kerning_func_t = ct.CFUNCTYPE(position_t, ct.c_void_p, ct.c_void_p, codepoint_t, codepoint_t, ct.c_void_p)
font_get_glyph_h_kerning_func_t = font_get_glyph_kerning_func_t
font_get_glyph_v_kerning_func_t = font_get_glyph_kerning_func_t
font_get_glyph_extents_func_t = ct.CFUNCTYPE(bool_t, ct.c_void_p, ct.c_void_p, codepoint_t, ct.POINTER(glyph_extents_t), ct.c_void_p)
font_get_glyph_contour_point_func_t = ct.CFUNCTYPE(bool_t, ct.c_void_p, ct.c_void_p, codepoint_t, ct.c_uint, ct.POINTER(position_t), ct.POINTER(position_t), ct.c_void_p)
font_get_glyph_name_func_t = ct.CFUNCTYPE(bool_t, ct.c_void_p, ct.c_void_p, codepoint_t, ct.POINTER(ct.c_char), ct.c_uint, ct.c_void_p)
font_get_glyph_from_name_func_t = ct.CFUNCTYPE(bool_t, ct.c_void_p, ct.c_void_p, ct.POINTER(ct.c_char), ct.c_int, ct.POINTER(codepoint_t), ct.c_void_p)
# from hb-set.h:
SET_VALUE_INVALID = 0xffffffff
# NYI: hb-map.h
# probably not important, since it seems to be just a utility class
# providing functions that Python already has built-in.
# from hb-ot-name.h:
# Since: 2.0.0
ot_name_id_t = ct.c_uint # representing an OpenType 'name' table identifier
OT_NAME_ID_COPYRIGHT = 0
OT_NAME_ID_FONT_FAMILY = 1
OT_NAME_ID_FONT_SUBFAMILY = 2
OT_NAME_ID_UNIQUE_ID = 3
OT_NAME_ID_FULL_NAME = 4
OT_NAME_ID_VERSION_STRING = 5
OT_NAME_ID_POSTSCRIPT_NAME = 6
OT_NAME_ID_TRADEMARK = 7
OT_NAME_ID_MANUFACTURER = 8
OT_NAME_ID_DESIGNER = 9
OT_NAME_ID_DESCRIPTION = 10
OT_NAME_ID_VENDOR_URL = 11
OT_NAME_ID_DESIGNER_URL = 12
OT_NAME_ID_LICENSE = 13
OT_NAME_ID_LICENSE_URL = 14
# OT_NAME_ID_RESERVED = 15
OT_NAME_ID_TYPOGRAPHIC_FAMILY = 16
OT_NAME_ID_TYPOGRAPHIC_SUBFAMILY = 17
OT_NAME_ID_MAC_FULL_NAME = 18
OT_NAME_ID_SAMPLE_TEXT = 19
OT_NAME_ID_CID_FINDFONT_NAME = 20
OT_NAME_ID_WWS_FAMILY = 21
OT_NAME_ID_WWS_SUBFAMILY = 22
OT_NAME_ID_LIGHT_BACKGROUND = 23
OT_NAME_ID_DARK_BACKGROUND = 24
OT_NAME_ID_VARIATIONS_PS_PREFIX = 25
OT_NAME_ID_INVALID = 0xFFFF # for nonexistent name ID
class ot_name_entry_t(ct.Structure) :
pass
ot_name_entry_t._fields_ = \
[
("name_id", ot_name_id_t),
# private
("var", var_int_t),
# public
("language", ct.c_void_p), # language_t
]
#end ot_name_entry_t
# from hb-ot-layout.h:
OT_TAG_BASE = TAG(b'BASE')
OT_TAG_GDEF = TAG(b'GDEF')
OT_TAG_GSUB = TAG(b'GSUB')
OT_TAG_GPOS = TAG(b'GPOS')
OT_TAG_JSTF = TAG(b'JSTF')
OT_TAG_DEFAULT_SCRIPT = TAG(b'DFLT')
OT_TAG_DEFAULT_LANGUAGE = TAG(b'dflt')
ot_layout_glyph_class_t = ct.c_uint
OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED = 0
OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH = 1
OT_LAYOUT_GLYPH_CLASS_LIGATURE = 2
OT_LAYOUT_GLYPH_CLASS_MARK = 3
OT_LAYOUT_GLYPH_CLASS_COMPONENT = 4
OT_LAYOUT_NO_SCRIPT_INDEX = 0xFFFF
OT_LAYOUT_NO_FEATURE_INDEX = 0xFFFF
OT_LAYOUT_DEFAULT_LANGUAGE_INDEX = 0xFFFF
OT_LAYOUT_NO_VARIATIONS_INDEX = 0xFFFFFFFF
# from hb-ot-math.h (since 1.3.3):
OT_TAG_MATH = TAG(b'MATH')
OT_MATH_SCRIPT = TAG(b'math')
ot_math_constant_t = ct.c_uint
# values for ot_math_constant_t:
OT_MATH_CONSTANT_SCRIPT_PERCENT_SCALE_DOWN = 0
OT_MATH_CONSTANT_SCRIPT_SCRIPT_PERCENT_SCALE_DOWN = 1
OT_MATH_CONSTANT_DELIMITED_SUB_FORMULA_MIN_HEIGHT = 2
OT_MATH_CONSTANT_DISPLAY_OPERATOR_MIN_HEIGHT = 3
OT_MATH_CONSTANT_MATH_LEADING = 4
OT_MATH_CONSTANT_AXIS_HEIGHT = 5
OT_MATH_CONSTANT_ACCENT_BASE_HEIGHT = 6
OT_MATH_CONSTANT_FLATTENED_ACCENT_BASE_HEIGHT = 7
OT_MATH_CONSTANT_SUBSCRIPT_SHIFT_DOWN = 8
OT_MATH_CONSTANT_SUBSCRIPT_TOP_MAX = 9
OT_MATH_CONSTANT_SUBSCRIPT_BASELINE_DROP_MIN = 10
OT_MATH_CONSTANT_SUPERSCRIPT_SHIFT_UP = 11
OT_MATH_CONSTANT_SUPERSCRIPT_SHIFT_UP_CRAMPED = 12
OT_MATH_CONSTANT_SUPERSCRIPT_BOTTOM_MIN = 13
OT_MATH_CONSTANT_SUPERSCRIPT_BASELINE_DROP_MAX = 14
OT_MATH_CONSTANT_SUB_SUPERSCRIPT_GAP_MIN = 15
OT_MATH_CONSTANT_SUPERSCRIPT_BOTTOM_MAX_WITH_SUBSCRIPT = 16
OT_MATH_CONSTANT_SPACE_AFTER_SCRIPT = 17
OT_MATH_CONSTANT_UPPER_LIMIT_GAP_MIN = 18
OT_MATH_CONSTANT_UPPER_LIMIT_BASELINE_RISE_MIN = 19
OT_MATH_CONSTANT_LOWER_LIMIT_GAP_MIN = 20
OT_MATH_CONSTANT_LOWER_LIMIT_BASELINE_DROP_MIN = 21
OT_MATH_CONSTANT_STACK_TOP_SHIFT_UP = 22
OT_MATH_CONSTANT_STACK_TOP_DISPLAY_STYLE_SHIFT_UP = 23
OT_MATH_CONSTANT_STACK_BOTTOM_SHIFT_DOWN = 24
OT_MATH_CONSTANT_STACK_BOTTOM_DISPLAY_STYLE_SHIFT_DOWN = 25
OT_MATH_CONSTANT_STACK_GAP_MIN = 26
OT_MATH_CONSTANT_STACK_DISPLAY_STYLE_GAP_MIN = 27
OT_MATH_CONSTANT_STRETCH_STACK_TOP_SHIFT_UP = 28
OT_MATH_CONSTANT_STRETCH_STACK_BOTTOM_SHIFT_DOWN = 29
OT_MATH_CONSTANT_STRETCH_STACK_GAP_ABOVE_MIN = 30
OT_MATH_CONSTANT_STRETCH_STACK_GAP_BELOW_MIN = 31
OT_MATH_CONSTANT_FRACTION_NUMERATOR_SHIFT_UP = 32
OT_MATH_CONSTANT_FRACTION_NUMERATOR_DISPLAY_STYLE_SHIFT_UP = 33
OT_MATH_CONSTANT_FRACTION_DENOMINATOR_SHIFT_DOWN = 34
OT_MATH_CONSTANT_FRACTION_DENOMINATOR_DISPLAY_STYLE_SHIFT_DOWN = 35
OT_MATH_CONSTANT_FRACTION_NUMERATOR_GAP_MIN = 36
OT_MATH_CONSTANT_FRACTION_NUM_DISPLAY_STYLE_GAP_MIN = 37
OT_MATH_CONSTANT_FRACTION_RULE_THICKNESS = 38
OT_MATH_CONSTANT_FRACTION_DENOMINATOR_GAP_MIN = 39
OT_MATH_CONSTANT_FRACTION_DENOM_DISPLAY_STYLE_GAP_MIN = 40
OT_MATH_CONSTANT_SKEWED_FRACTION_HORIZONTAL_GAP = 41
OT_MATH_CONSTANT_SKEWED_FRACTION_VERTICAL_GAP = 42
OT_MATH_CONSTANT_OVERBAR_VERTICAL_GAP = 43
OT_MATH_CONSTANT_OVERBAR_RULE_THICKNESS = 44
OT_MATH_CONSTANT_OVERBAR_EXTRA_ASCENDER = 45
OT_MATH_CONSTANT_UNDERBAR_VERTICAL_GAP = 46
OT_MATH_CONSTANT_UNDERBAR_RULE_THICKNESS = 47
OT_MATH_CONSTANT_UNDERBAR_EXTRA_DESCENDER = 48
OT_MATH_CONSTANT_RADICAL_VERTICAL_GAP = 49
OT_MATH_CONSTANT_RADICAL_DISPLAY_STYLE_VERTICAL_GAP = 50
OT_MATH_CONSTANT_RADICAL_RULE_THICKNESS = 51
OT_MATH_CONSTANT_RADICAL_EXTRA_ASCENDER = 52
OT_MATH_CONSTANT_RADICAL_KERN_BEFORE_DEGREE = 53
OT_MATH_CONSTANT_RADICAL_KERN_AFTER_DEGREE = 54
OT_MATH_CONSTANT_RADICAL_DEGREE_BOTTOM_RAISE_PERCENT = 55
ot_math_kern_t = ct.c_uint
# values for ot_math_kern_t:
OT_MATH_KERN_TOP_RIGHT = 0
OT_MATH_KERN_TOP_LEFT = 1
OT_MATH_KERN_BOTTOM_RIGHT = 2
OT_MATH_KERN_BOTTOM_LEFT = 3
class ot_math_glyph_variant_t(ct.Structure) :
pass
ot_math_glyph_variant_t._fields_ = \
[
("glyph", codepoint_t),
("advance", position_t),
]
#end ot_math_glyph_variant_t
ot_math_glyph_part_flags_t = ct.c_uint
# values for ot_math_glyph_part_flags_t:
MATH_GLYPH_PART_FLAG_EXTENDER = 0x00000001
class ot_math_glyph_part_t(ct.Structure) :
pass
ot_math_glyph_part_t._fields_ = \
[
("glyph", codepoint_t),
("start_connector_length", position_t),
("end_connector_length", position_t),
("full_advance", position_t),
("flags", ot_math_glyph_part_flags_t),
]
#end ot_math_glyph_part_t
# from hb-ot-var.h:
# Since: 1.4.2
OT_TAG_VAR_AXIS_ITALIC = TAG(b'ital')
OT_TAG_VAR_AXIS_OPTICAL_SIZE = TAG(b'opsz')
OT_TAG_VAR_AXIS_SLANT = TAG(b'slnt')
OT_TAG_VAR_AXIS_WIDTH = TAG(b'wdth')
OT_TAG_VAR_AXIS_WEIGHT = TAG(b'wght')
# Since: 2.2.0
ot_var_axis_flags_t = ct.c_uint
OT_VAR_AXIS_FLAG_HIDDEN = 0x00000001
OT_VAR_AXIS_FLAG_MAX_VALUE = 0x7FFFFFFF
# Since: 2.2.0
class ot_var_axis_info_t(ct.Structure) :
pass
ot_var_axis_info_t._fields_ = \
[
("axis_index", ct.c_uint),
("tag", tag_t),
("name_id", ot_name_id_t),
("flags", ot_var_axis_flags_t),
("min_value", ct.c_float),
("default_value", ct.c_float),
("max_value", ct.c_float),
# private
("reserved", ct.c_uint),
]
#end ot_var_axis_info_t
class ot_var_axis_t(ct.Structure) :
# deprecated since 2.2.0.
pass
ot_var_axis_t._fields_ = \
[
("tag", tag_t),
("name_id", ct.c_uint),
("min_value", ct.c_float),
("default_value", ct.c_float),
("max_value", ct.c_float),
]
#end ot_var_axis_t
OT_VAR_NO_AXIS_INDEX = 0xFFFFFFFF
# returned from hb_ot_var_find_axis if not found
# Deprecated since 2.2.0.
# from hb-deprecated.h:
# Since: 0.9.2
# Deprecated: 2.0.0
unicode_eastasian_width_func_t = \
ct.CFUNCTYPE(ct.c_uint, ct.c_void_p, codepoint_t, ct.c_void_p)
# Deprecated: 2.0.0
unicode_decompose_compatibility_func_t = \
ct.CFUNCTYPE(ct.c_uint, ct.c_void_p, codepoint_t, ct.POINTER(codepoint_t), ct.c_void_p)
# NYI skip for now:
# hb-icu.h, hb-glib.h, hb-gobject-enums.h, hb-gobject.h, hb-gobject-structs.h,