pyglet 2.1.3__py3-none-any.whl → 2.1.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. pyglet/__init__.py +21 -9
  2. pyglet/__init__.pyi +3 -1
  3. pyglet/app/cocoa.py +6 -3
  4. pyglet/display/win32.py +14 -15
  5. pyglet/display/xlib_vidmoderestore.py +1 -1
  6. pyglet/extlibs/earcut.py +2 -2
  7. pyglet/font/__init__.py +3 -3
  8. pyglet/font/base.py +118 -51
  9. pyglet/font/dwrite/__init__.py +1381 -0
  10. pyglet/font/dwrite/d2d1_lib.py +637 -0
  11. pyglet/font/dwrite/d2d1_types_lib.py +60 -0
  12. pyglet/font/dwrite/dwrite_lib.py +1577 -0
  13. pyglet/font/fontconfig.py +79 -16
  14. pyglet/font/freetype.py +252 -77
  15. pyglet/font/freetype_lib.py +234 -125
  16. pyglet/font/harfbuzz/__init__.py +275 -0
  17. pyglet/font/harfbuzz/harfbuzz_lib.py +212 -0
  18. pyglet/font/quartz.py +432 -112
  19. pyglet/font/user.py +18 -11
  20. pyglet/font/win32.py +9 -1
  21. pyglet/gl/wgl.py +94 -87
  22. pyglet/gl/wglext_arb.py +472 -218
  23. pyglet/gl/wglext_nv.py +410 -188
  24. pyglet/gui/widgets.py +6 -1
  25. pyglet/image/codecs/bmp.py +3 -5
  26. pyglet/image/codecs/gdiplus.py +28 -9
  27. pyglet/image/codecs/wic.py +198 -489
  28. pyglet/image/codecs/wincodec_lib.py +413 -0
  29. pyglet/input/base.py +3 -2
  30. pyglet/input/macos/darwin_hid.py +28 -2
  31. pyglet/input/win32/directinput.py +2 -1
  32. pyglet/input/win32/xinput.py +10 -9
  33. pyglet/lib.py +14 -2
  34. pyglet/libs/darwin/cocoapy/cocoalibs.py +74 -3
  35. pyglet/libs/darwin/coreaudio.py +0 -2
  36. pyglet/libs/win32/__init__.py +4 -2
  37. pyglet/libs/win32/com.py +65 -12
  38. pyglet/libs/win32/constants.py +1 -0
  39. pyglet/libs/win32/dinput.py +1 -9
  40. pyglet/libs/win32/types.py +72 -8
  41. pyglet/media/codecs/coreaudio.py +1 -0
  42. pyglet/media/codecs/wmf.py +93 -72
  43. pyglet/media/devices/win32.py +5 -4
  44. pyglet/media/drivers/directsound/lib_dsound.py +4 -4
  45. pyglet/media/drivers/xaudio2/interface.py +21 -17
  46. pyglet/media/drivers/xaudio2/lib_xaudio2.py +42 -25
  47. pyglet/shapes.py +1 -1
  48. pyglet/text/document.py +7 -53
  49. pyglet/text/formats/attributed.py +3 -1
  50. pyglet/text/formats/plaintext.py +1 -1
  51. pyglet/text/formats/structured.py +1 -1
  52. pyglet/text/layout/base.py +76 -68
  53. pyglet/text/layout/incremental.py +38 -8
  54. pyglet/text/layout/scrolling.py +1 -1
  55. pyglet/text/runlist.py +2 -114
  56. pyglet/window/win32/__init__.py +1 -3
  57. {pyglet-2.1.3.dist-info → pyglet-2.1.4.dist-info}/METADATA +1 -1
  58. {pyglet-2.1.3.dist-info → pyglet-2.1.4.dist-info}/RECORD +60 -54
  59. pyglet/font/directwrite.py +0 -2798
  60. {pyglet-2.1.3.dist-info → pyglet-2.1.4.dist-info}/LICENSE +0 -0
  61. {pyglet-2.1.3.dist-info → pyglet-2.1.4.dist-info}/WHEEL +0 -0
@@ -4,6 +4,7 @@ from ctypes import (
4
4
  CFUNCTYPE,
5
5
  POINTER,
6
6
  Structure,
7
+ Union,
7
8
  byref,
8
9
  c_byte,
9
10
  c_char,
@@ -24,7 +25,7 @@ from ctypes import (
24
25
  c_ushort,
25
26
  c_void_p,
26
27
  )
27
- from typing import Any, Callable, Iterable, NoReturn
28
+ from typing import Any, Callable, Iterable, Sequence
28
29
 
29
30
  import pyglet.lib
30
31
 
@@ -71,6 +72,42 @@ FT_Fixed = c_long
71
72
  FT_Pointer = c_void_p
72
73
  FT_Pos = c_long
73
74
 
75
+ class TT_OS2(Structure):
76
+ _fields_ = [
77
+ ("version", c_ushort),
78
+ ("xAvgCharWidth", c_short),
79
+ ("usWeightClass", c_ushort), # This is the key field
80
+ ("usWidthClass", c_ushort),
81
+ ("fsType", c_short),
82
+ ("ySubscriptXSize", c_short),
83
+ ("ySubscriptYSize", c_short),
84
+ ("ySubscriptXOffset", c_short),
85
+ ("ySubscriptYOffset", c_short),
86
+ ("ySuperscriptXSize", c_short),
87
+ ("ySuperscriptYSize", c_short),
88
+ ("ySuperscriptXOffset", c_short),
89
+ ("ySuperscriptYOffset", c_short),
90
+ ("yStrikeoutSize", c_short),
91
+ ("yStrikeoutPosition", c_short),
92
+ ("sFamilyClass", c_short),
93
+ ("panose", c_byte * 10),
94
+ ("ulUnicodeRange1", c_uint),
95
+ ("ulUnicodeRange2", c_uint),
96
+ ("ulUnicodeRange3", c_uint),
97
+ ("ulUnicodeRange4", c_uint),
98
+ ("achVendID", c_char * 4),
99
+ ("fsSelection", c_ushort),
100
+ ("usFirstCharIndex", c_ushort),
101
+ ("usLastCharIndex", c_ushort),
102
+ ("sTypoAscender", c_short),
103
+ ("sTypoDescender", c_short),
104
+ ("sTypoLineGap", c_short),
105
+ ("usWinAscent", c_ushort),
106
+ ("usWinDescent", c_ushort),
107
+ ("ulCodePageRange1", c_uint),
108
+ ("ulCodePageRange2", c_uint),
109
+ ]
110
+
74
111
 
75
112
  class FT_Vector(Structure):
76
113
  _fields_ = [
@@ -151,6 +188,10 @@ FT_PIXEL_MODE_LCD = 5
151
188
  FT_PIXEL_MODE_LCD_V = 6
152
189
  FT_PIXEL_MODE_BGRA = 7
153
190
 
191
+ FT_KERNING_DEFAULT = 0
192
+ FT_KERNING_UNFITTED = 1
193
+ FT_KERNING_UNSCALED = 2
194
+
154
195
 
155
196
  class FT_LibraryRec(Structure):
156
197
  _fields_ = [
@@ -289,6 +330,35 @@ class FT_SizeRec(Structure):
289
330
  ]
290
331
 
291
332
 
333
+ class FT_StreamDesc(Union):
334
+ _fields_ = [
335
+ ("pointer", c_void_p),
336
+ ("value", c_long)
337
+ ]
338
+
339
+
340
+ FT_Stream_IoFunc = CFUNCTYPE(c_ulong, c_void_p, c_ulong, c_void_p, c_ulong)
341
+ FT_Stream_CloseFunc = CFUNCTYPE(None, c_void_p)
342
+
343
+
344
+ class FT_StreamRec(Structure):
345
+ _fields_ = [
346
+ ("base", POINTER(c_ubyte)), # Pointer to raw font data
347
+ ("size", c_ulong), # Size of the stream
348
+ ("pos", c_ulong), # Current read position
349
+
350
+ ("descriptor", FT_StreamDesc), # File descriptor or user data
351
+ ("pathname", FT_StreamDesc), # Optional pathname
352
+
353
+ ("read", FT_Stream_IoFunc), # Read function
354
+ ("close", FT_Stream_CloseFunc), # Close function
355
+
356
+ ("memory", c_void_p), # FT_Memory pointer (memory management)
357
+ ("cursor", POINTER(c_ubyte)), # Current stream position
358
+ ("limit", POINTER(c_ubyte)), # End of stream data
359
+ ]
360
+
361
+ FT_Stream = FT_StreamRec
292
362
  FT_Size = POINTER(FT_SizeRec)
293
363
 
294
364
 
@@ -330,9 +400,10 @@ class FT_FaceRec(Structure):
330
400
  ("size", FT_Size),
331
401
  ("charmap", c_void_p),
332
402
 
403
+ # Internal
333
404
  ("driver", c_void_p),
334
405
  ("memory", c_void_p),
335
- ("stream", c_void_p),
406
+ ("stream", POINTER(FT_Stream)),
336
407
 
337
408
  ("sizes_list", c_void_p),
338
409
 
@@ -343,27 +414,31 @@ class FT_FaceRec(Structure):
343
414
 
344
415
  def dump(self) -> None:
345
416
  for (name, _) in self._fields_:
346
- print("FT_FaceRec", name, repr(getattr(self, name)))
347
-
348
- def has_kerning(self) -> bool:
349
- return self.face_flags & FT_FACE_FLAG_KERNING
417
+ print("FT_FaceRec", name, repr(getattr(self, name)))
350
418
 
351
419
 
352
420
  FT_Face = POINTER(FT_FaceRec)
353
421
 
354
422
  # face_flags values
355
- FT_FACE_FLAG_SCALABLE = 1 << 0
356
- FT_FACE_FLAG_FIXED_SIZES = 1 << 1
357
- FT_FACE_FLAG_FIXED_WIDTH = 1 << 2
358
- FT_FACE_FLAG_SFNT = 1 << 3
359
- FT_FACE_FLAG_HORIZONTAL = 1 << 4
360
- FT_FACE_FLAG_VERTICAL = 1 << 5
361
- FT_FACE_FLAG_KERNING = 1 << 6
362
- FT_FACE_FLAG_FAST_GLYPHS = 1 << 7
363
- FT_FACE_FLAG_MULTIPLE_MASTERS = 1 << 8
364
- FT_FACE_FLAG_GLYPH_NAMES = 1 << 9
365
- FT_FACE_FLAG_EXTERNAL_STREAM = 1 << 10
366
- FT_FACE_FLAG_HINTER = 1 << 11
423
+ FT_FACE_FLAG_SCALABLE = 1 << 0 # Vector-based (TTF/OTF
424
+ FT_FACE_FLAG_FIXED_SIZES = 1 << 1 # Has pre-rendered bitmap sizes
425
+ FT_FACE_FLAG_FIXED_WIDTH = 1 << 2 # Monospaced font
426
+ FT_FACE_FLAG_SFNT = 1 << 3 # SFNT-based (TrueType/OpenType/WOFF
427
+ FT_FACE_FLAG_HORIZONTAL = 1 << 4 # Has horizontal glyph metrics
428
+ FT_FACE_FLAG_VERTICAL = 1 << 5 # Has vertical glyph metrics
429
+ FT_FACE_FLAG_KERNING = 1 << 6 # Supports kerning
430
+ FT_FACE_FLAG_FAST_GLYPHS = 1 << 7 # Deprecated (No effect
431
+ FT_FACE_FLAG_MULTIPLE_MASTERS = 1 << 8 # Supports variable fonts (GX/AAT
432
+ FT_FACE_FLAG_GLYPH_NAMES = 1 << 9 # Has glyph names
433
+ FT_FACE_FLAG_EXTERNAL_STREAM = 1 << 10 # Uses external stream (not file-based
434
+ FT_FACE_FLAG_HINTER = 1 << 11 # Font has its own hinter
435
+ FT_FACE_FLAG_CID_KEYED = 1 << 12 # CID-keyed PostScript font
436
+ FT_FACE_FLAG_TRICKY = 1 << 13 # Requires special TrueType bytecode handling
437
+ FT_FACE_FLAG_COLOR = 1 << 14 # Color emoji font
438
+ FT_FACE_FLAG_VARIATION = 1 << 15 # OpenType Variable Fonts
439
+ FT_FACE_FLAG_SVG = 1 << 16 # SVG-based color glyphs
440
+ FT_FACE_FLAG_SBIX = 1 << 17 # sbix color glyphs
441
+ FT_FACE_FLAG_SBIX_OVERLAY = 1 << 18 # sbix overlay support
367
442
 
368
443
  FT_STYLE_FLAG_ITALIC = 1
369
444
  FT_STYLE_FLAG_BOLD = 2
@@ -402,118 +477,146 @@ def float_to_f26p6(value: float) -> float:
402
477
  return int(value * (1 << 6))
403
478
 
404
479
 
480
+
481
+ _ft_errors = {
482
+ 0x00: "no error",
483
+ 0x01: "cannot open resource",
484
+ 0x02: "unknown file format",
485
+ 0x03: "broken file",
486
+ 0x04: "invalid FreeType version",
487
+ 0x05: "module version is too low",
488
+ 0x06: "invalid argument",
489
+ 0x07: "unimplemented feature",
490
+ 0x08: "broken table",
491
+ 0x09: "broken offset within table",
492
+ 0x10: "invalid glyph index",
493
+ 0x11: "invalid character code",
494
+ 0x12: "unsupported glyph image format",
495
+ 0x13: "cannot render this glyph format",
496
+ 0x14: "invalid outline",
497
+ 0x15: "invalid composite glyph",
498
+ 0x16: "too many hints",
499
+ 0x17: "invalid pixel size",
500
+ 0x20: "invalid object handle",
501
+ 0x21: "invalid library handle",
502
+ 0x22: "invalid module handle",
503
+ 0x23: "invalid face handle",
504
+ 0x24: "invalid size handle",
505
+ 0x25: "invalid glyph slot handle",
506
+ 0x26: "invalid charmap handle",
507
+ 0x27: "invalid cache manager handle",
508
+ 0x28: "invalid stream handle",
509
+ 0x30: "too many modules",
510
+ 0x31: "too many extensions",
511
+ 0x40: "out of memory",
512
+ 0x41: "unlisted object",
513
+ 0x51: "cannot open stream",
514
+ 0x52: "invalid stream seek",
515
+ 0x53: "invalid stream skip",
516
+ 0x54: "invalid stream read",
517
+ 0x55: "invalid stream operation",
518
+ 0x56: "invalid frame operation",
519
+ 0x57: "nested frame access",
520
+ 0x58: "invalid frame read",
521
+ 0x60: "raster uninitialized",
522
+ 0x61: "raster corrupted",
523
+ 0x62: "raster overflow",
524
+ 0x63: "negative height while rastering",
525
+ 0x70: "too many registered caches",
526
+ 0x80: "invalid opcode",
527
+ 0x81: "too few arguments",
528
+ 0x82: "stack overflow",
529
+ 0x83: "code overflow",
530
+ 0x84: "bad argument",
531
+ 0x85: "division by zero",
532
+ 0x86: "invalid reference",
533
+ 0x87: "found debug opcode",
534
+ 0x88: "found ENDF opcode in execution stream",
535
+ 0x89: "nested DEFS",
536
+ 0x8A: "invalid code range",
537
+ 0x8B: "execution context too long",
538
+ 0x8C: "too many function definitions",
539
+ 0x8D: "too many instruction definitions",
540
+ 0x8E: "SFNT font table missing",
541
+ 0x8F: "horizontal header (hhea, table missing",
542
+ 0x90: "locations (loca, table missing",
543
+ 0x91: "name table missing",
544
+ 0x92: "character map (cmap, table missing",
545
+ 0x93: "horizontal metrics (hmtx, table missing",
546
+ 0x94: "PostScript (post, table missing",
547
+ 0x95: "invalid horizontal metrics",
548
+ 0x96: "invalid character map (cmap, format",
549
+ 0x97: "invalid ppem value",
550
+ 0x98: "invalid vertical metrics",
551
+ 0x99: "could not find context",
552
+ 0x9A: "invalid PostScript (post, table format",
553
+ 0x9B: "invalid PostScript (post, table",
554
+ 0xA0: "opcode syntax error",
555
+ 0xA1: "argument stack underflow",
556
+ 0xA2: "ignore",
557
+ 0xB0: "`STARTFONT' field missing",
558
+ 0xB1: "`FONT' field missing",
559
+ 0xB2: "`SIZE' field missing",
560
+ 0xB3: "`CHARS' field missing",
561
+ 0xB4: "`STARTCHAR' field missing",
562
+ 0xB5: "`ENCODING' field missing",
563
+ 0xB6: "`BBX' field missing",
564
+ 0xB7: "`BBX' too big",
565
+ }
566
+
567
+
405
568
  class FreeTypeError(FontException):
406
- def __init__(self, message: str | None, errcode: int) -> None:
569
+ def __init__(self, error_code, message):
570
+ self.errcode = error_code
407
571
  self.message = message
408
- self.errcode = errcode
409
-
410
- def __str__(self) -> str:
411
- return "{}: {} ({})".format(self.__class__.__name__, self.message,
412
- self._ft_errors.get(self.errcode, "unknown error"))
413
-
414
- @classmethod
415
- def check_and_raise_on_error(cls: type[FreeTypeError], errcode: int) -> NoReturn:
416
- if errcode != 0:
417
- raise cls(None, errcode)
418
-
419
- _ft_errors = {
420
- 0x00: "no error",
421
- 0x01: "cannot open resource",
422
- 0x02: "unknown file format",
423
- 0x03: "broken file",
424
- 0x04: "invalid FreeType version",
425
- 0x05: "module version is too low",
426
- 0x06: "invalid argument",
427
- 0x07: "unimplemented feature",
428
- 0x08: "broken table",
429
- 0x09: "broken offset within table",
430
- 0x10: "invalid glyph index",
431
- 0x11: "invalid character code",
432
- 0x12: "unsupported glyph image format",
433
- 0x13: "cannot render this glyph format",
434
- 0x14: "invalid outline",
435
- 0x15: "invalid composite glyph",
436
- 0x16: "too many hints",
437
- 0x17: "invalid pixel size",
438
- 0x20: "invalid object handle",
439
- 0x21: "invalid library handle",
440
- 0x22: "invalid module handle",
441
- 0x23: "invalid face handle",
442
- 0x24: "invalid size handle",
443
- 0x25: "invalid glyph slot handle",
444
- 0x26: "invalid charmap handle",
445
- 0x27: "invalid cache manager handle",
446
- 0x28: "invalid stream handle",
447
- 0x30: "too many modules",
448
- 0x31: "too many extensions",
449
- 0x40: "out of memory",
450
- 0x41: "unlisted object",
451
- 0x51: "cannot open stream",
452
- 0x52: "invalid stream seek",
453
- 0x53: "invalid stream skip",
454
- 0x54: "invalid stream read",
455
- 0x55: "invalid stream operation",
456
- 0x56: "invalid frame operation",
457
- 0x57: "nested frame access",
458
- 0x58: "invalid frame read",
459
- 0x60: "raster uninitialized",
460
- 0x61: "raster corrupted",
461
- 0x62: "raster overflow",
462
- 0x63: "negative height while rastering",
463
- 0x70: "too many registered caches",
464
- 0x80: "invalid opcode",
465
- 0x81: "too few arguments",
466
- 0x82: "stack overflow",
467
- 0x83: "code overflow",
468
- 0x84: "bad argument",
469
- 0x85: "division by zero",
470
- 0x86: "invalid reference",
471
- 0x87: "found debug opcode",
472
- 0x88: "found ENDF opcode in execution stream",
473
- 0x89: "nested DEFS",
474
- 0x8A: "invalid code range",
475
- 0x8B: "execution context too long",
476
- 0x8C: "too many function definitions",
477
- 0x8D: "too many instruction definitions",
478
- 0x8E: "SFNT font table missing",
479
- 0x8F: "horizontal header (hhea, table missing",
480
- 0x90: "locations (loca, table missing",
481
- 0x91: "name table missing",
482
- 0x92: "character map (cmap, table missing",
483
- 0x93: "horizontal metrics (hmtx, table missing",
484
- 0x94: "PostScript (post, table missing",
485
- 0x95: "invalid horizontal metrics",
486
- 0x96: "invalid character map (cmap, format",
487
- 0x97: "invalid ppem value",
488
- 0x98: "invalid vertical metrics",
489
- 0x99: "could not find context",
490
- 0x9A: "invalid PostScript (post, table format",
491
- 0x9B: "invalid PostScript (post, table",
492
- 0xA0: "opcode syntax error",
493
- 0xA1: "argument stack underflow",
494
- 0xA2: "ignore",
495
- 0xB0: "`STARTFONT' field missing",
496
- 0xB1: "`FONT' field missing",
497
- 0xB2: "`SIZE' field missing",
498
- 0xB3: "`CHARS' field missing",
499
- 0xB4: "`STARTCHAR' field missing",
500
- 0xB5: "`ENCODING' field missing",
501
- 0xB6: "`BBX' field missing",
502
- 0xB7: "`BBX' too big",
503
- }
504
572
 
505
573
 
574
+ def _errcheck(result: Any, func: Callable, arguments: Sequence) -> Any:
575
+ if result != 0:
576
+ raise FreeTypeError(result, _ft_errors.get(result, "Unknown."))
577
+
506
578
  def _get_function_with_error_handling(name: str, argtypes: Iterable[Any], rtype: Any) -> Callable:
507
579
  func = _get_function(name, argtypes, rtype)
580
+ func.errcheck = _errcheck
581
+ func.__name__ = name
582
+ return func
583
+
584
+
585
+ FT_LOAD_DEFAULT = 0x0 # Use default font loading behavior
586
+ FT_LOAD_NO_SCALE = (1 << 0) # Disable scaling; use unscaled native units
587
+ FT_LOAD_NO_HINTING = (1 << 1) # Disable font hinting (may cause blurriness at small sizes)
588
+ FT_LOAD_RENDER = (1 << 2) # Automatically render the glyph after loading
589
+ FT_LOAD_NO_BITMAP = (1 << 3) # Ignore bitmap strikes, force vector rendering
590
+ FT_LOAD_VERTICAL_LAYOUT = (1 << 4) # Load glyph with vertical metrics if available
591
+ FT_LOAD_FORCE_AUTOHINT = (1 << 5) # Force FreeType’s auto-hinter, ignoring native hints
592
+ FT_LOAD_CROP_BITMAP = (1 << 6) # Crop bitmaps to bounding box (removes empty padding)
593
+ FT_LOAD_PEDANTIC = (1 << 7) # Enable strict font parsing (useful for debugging malformed fonts)
594
+ FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH = (1 << 9) # Ignore font-wide advance width; use glyph-specific advance
595
+ FT_LOAD_NO_RECURSE = (1 << 10) # Load only composite glyphs, do not load sub-glyphs recursively
596
+ FT_LOAD_IGNORE_TRANSFORM = (1 << 11) # Disable any transformations with FT_Set_Transform()
597
+ FT_LOAD_MONOCHROME = (1 << 12) # Render glyphs in monochrome (1-bit, no anti-aliasing)
598
+ FT_LOAD_LINEAR_DESIGN = (1 << 13) # Use linear design metrics instead of transformed metrics
599
+ FT_LOAD_SBITS_ONLY = (1 << 14) # Load only embedded bitmap strikes (ignore vector outlines)
600
+ FT_LOAD_NO_AUTOHINT = (1 << 15) # Disable FreeType’s auto-hinter
601
+ FT_LOAD_COLOR = (1 << 20) # Load color emoji glyphs (e.g., sbix, CBDT/CBLC, SVG fonts)
602
+ FT_LOAD_COMPUTE_METRICS = (1 << 21) # Compute glyph metrics even if loading only a bitmap
603
+ FT_LOAD_BITMAP_METRICS_ONLY = (1 << 22) # Compute bitmap glyph metrics but do not load the glyph itself
604
+ FT_LOAD_NO_SVG = (1 << 24) # Disable loading of SVG glyphs (for fonts that contain both vector and SVG glyphs)
605
+
606
+ FT_Sfnt_Tag = c_int
607
+ class FT_Sfnt_Tags:
608
+ """SFNT table tags for use with FT_Get_Sfnt_Table."""
609
+ HEAD = 0
610
+ MAXP = 1
611
+ OS2 = 2
612
+ HHEA = 3
613
+ VHEA = 4
614
+ POST = 5
615
+ NAME = 6
616
+ CFF = 7
617
+ GASP = 8
618
+ PCLT = 9
508
619
 
509
- def _error_handling(*args, **kwargs) -> None: # noqa: ANN002, ANN003
510
- err = func(*args, **kwargs)
511
- FreeTypeError.check_and_raise_on_error(err)
512
-
513
- return _error_handling
514
-
515
-
516
- FT_LOAD_RENDER = 0x4
517
620
 
518
621
  FT_Init_FreeType = _get_function_with_error_handling("FT_Init_FreeType",
519
622
  [POINTER(FT_Library)], FT_Error)
@@ -536,13 +639,19 @@ FT_Set_Pixel_Sizes = _get_function_with_error_handling("FT_Set_Pixel_Sizes",
536
639
  [FT_Face, FT_UInt, FT_UInt], FT_Error)
537
640
  FT_Load_Glyph = _get_function_with_error_handling("FT_Load_Glyph",
538
641
  [FT_Face, FT_UInt, FT_Int32], FT_Error)
539
- FT_Get_Char_Index = _get_function_with_error_handling("FT_Get_Char_Index",
540
- [FT_Face, FT_ULong], FT_Error)
642
+ FT_Get_Char_Index = _get_function("FT_Get_Char_Index",
643
+ [FT_Face, FT_ULong], FT_UInt)
541
644
  FT_Load_Char = _get_function_with_error_handling("FT_Load_Char",
542
645
  [FT_Face, FT_ULong, FT_Int32], FT_Error)
543
646
  FT_Get_Kerning = _get_function_with_error_handling("FT_Get_Kerning",
544
647
  [FT_Face, FT_UInt, FT_UInt, FT_UInt, POINTER(FT_Vector)], FT_Error)
545
648
 
649
+ FT_Get_Sfnt_Table = _get_function("FT_Get_Sfnt_Table", [FT_Face, FT_Sfnt_Tag], c_void_p)
650
+
651
+ try:
652
+ FT_Select_Size = _get_function_with_error_handling("FT_Select_Size", [FT_Face, FT_Int], FT_Error)
653
+ except ImportError:
654
+ FT_Select_Size = None
546
655
 
547
656
  # SFNT interface
548
657