Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/fontTools/config/__init__.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-07 06:33 +0000

1""" 

2Define all configuration options that can affect the working of fontTools 

3modules. E.g. optimization levels of varLib IUP, otlLib GPOS compression level, 

4etc. If this file gets too big, split it into smaller files per-module. 

5 

6An instance of the Config class can be attached to a TTFont object, so that 

7the various modules can access their configuration options from it. 

8""" 

9from textwrap import dedent 

10 

11from fontTools.misc.configTools import * 

12 

13 

14class Config(AbstractConfig): 

15 options = Options() 

16 

17 

18OPTIONS = Config.options 

19 

20 

21Config.register_option( 

22 name="fontTools.otlLib.optimize.gpos:COMPRESSION_LEVEL", 

23 help=dedent( 

24 """\ 

25 GPOS Lookup type 2 (PairPos) compression level: 

26 0 = do not attempt to compact PairPos lookups; 

27 1 to 8 = create at most 1 to 8 new subtables for each existing 

28 subtable, provided that it would yield a 50%% file size saving; 

29 9 = create as many new subtables as needed to yield a file size saving. 

30 Default: 0. 

31 

32 This compaction aims to save file size, by splitting large class 

33 kerning subtables (Format 2) that contain many zero values into 

34 smaller and denser subtables. It's a trade-off between the overhead 

35 of several subtables versus the sparseness of one big subtable. 

36 

37 See the pull request: https://github.com/fonttools/fonttools/pull/2326 

38 """ 

39 ), 

40 default=0, 

41 parse=int, 

42 validate=lambda v: v in range(10), 

43) 

44 

45Config.register_option( 

46 name="fontTools.ttLib.tables.otBase:USE_HARFBUZZ_REPACKER", 

47 help=dedent( 

48 """\ 

49 FontTools tries to use the HarfBuzz Repacker to serialize GPOS/GSUB tables 

50 if the uharfbuzz python bindings are importable, otherwise falls back to its 

51 slower, less efficient serializer. Set to False to always use the latter. 

52 Set to True to explicitly request the HarfBuzz Repacker (will raise an 

53 error if uharfbuzz cannot be imported). 

54 """ 

55 ), 

56 default=None, 

57 parse=Option.parse_optional_bool, 

58 validate=Option.validate_optional_bool, 

59) 

60 

61Config.register_option( 

62 name="fontTools.otlLib.builder:WRITE_GPOS7", 

63 help=dedent( 

64 """\ 

65 macOS before 13.2 didn’t support GPOS LookupType 7 (non-chaining 

66 ContextPos lookups), so FontTools.otlLib.builder disables a file size 

67 optimisation that would use LookupType 7 instead of 8 when there is no 

68 chaining (no prefix or suffix). Set to True to enable the optimization. 

69 """ 

70 ), 

71 default=False, 

72 parse=Option.parse_optional_bool, 

73 validate=Option.validate_optional_bool, 

74)