• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1######
2tables
3######
4
5This folder is a subpackage of :py:mod:`fontTools.ttLib`. Each module here is a
6specialized TT/OT table converter: they can convert raw data
7to Python objects and vice versa. Usually you don't need to
8use the modules directly: they are imported and used
9automatically when needed by :py:mod:`fontTools.ttLib`.
10
11If you are writing you own table converter the following is
12important.
13
14The modules here have pretty strange names: this is due to the
15fact that we need to map TT table tags (which are case sensitive)
16to filenames (which on Mac and Win aren't case sensitive) as well
17as to Python identifiers. The latter means it can only contain
18[A-Za-z0-9_] and cannot start with a number.
19
20:py:mod:`fontTools.ttLib` provides functions to expand a tag into the format used here::
21
22    >>> from fontTools import ttLib
23    >>> ttLib.tagToIdentifier("FOO ")
24    'F_O_O_'
25    >>> ttLib.tagToIdentifier("cvt ")
26    '_c_v_t'
27    >>> ttLib.tagToIdentifier("OS/2")
28    'O_S_2f_2'
29    >>> ttLib.tagToIdentifier("glyf")
30    '_g_l_y_f'
31    >>>
32
33And vice versa::
34
35    >>> ttLib.identifierToTag("F_O_O_")
36    'FOO '
37    >>> ttLib.identifierToTag("_c_v_t")
38    'cvt '
39    >>> ttLib.identifierToTag("O_S_2f_2")
40    'OS/2'
41    >>> ttLib.identifierToTag("_g_l_y_f")
42    'glyf'
43    >>>
44
45Eg. the 'glyf' table converter lives in a Python file called::
46
47	_g_l_y_f.py
48
49The converter itself is a class, named "table_" + expandedtag. Eg::
50
51
52	class table__g_l_y_f:
53		etc.
54
55
56Note that if you _do_ need to use such modules or classes manually,
57there are two convenient API functions that let you find them by tag::
58
59    >>> ttLib.getTableModule('glyf')
60    <module 'ttLib.tables._g_l_y_f'>
61    >>> ttLib.getTableClass('glyf')
62    <class ttLib.tables._g_l_y_f.table__g_l_y_f at 645f400>
63    >>
64
65You must subclass from :py:mod:`fontTools.ttLib.tables.DefaultTable.DefaultTable`. It provides some default
66behavior, as well as a constructor method (__init__) that you don't need to
67override.
68
69Your converter should minimally provide two methods::
70
71
72    class table_F_O_O_(DefaultTable.DefaultTable): # converter for table 'FOO '
73
74        def decompile(self, data, ttFont):
75            # 'data' is the raw table data. Unpack it into a
76            # Python data structure.
77            # 'ttFont' is a ttLib.TTfile instance, enabling you to
78            # refer to other tables. Do ***not*** keep a reference to
79            # it: it will cause a circular reference (ttFont saves
80            # a reference to us), and that means we'll be leaking
81            # memory. If you need to use it in other methods, just
82            # pass it around as a method argument.
83
84        def compile(self, ttFont):
85            # Return the raw data, as converted from the Python
86            # data structure.
87            # Again, 'ttFont' is there so you can access other tables.
88            # Same warning applies.
89
90
91If you want to support TTX import/export as well, you need to provide two
92additional methods::
93
94
95	def toXML(self, writer, ttFont):
96		# XXX
97
98	def fromXML(self, (name, attrs, content), ttFont):
99		# XXX
100
101
102
103.. automodule:: fontTools.ttLib.tables
104   :inherited-members:
105   :members:
106   :undoc-members:
107
108_a_n_k_r
109--------
110
111.. automodule:: fontTools.ttLib.tables._a_n_k_r
112   :inherited-members:
113   :members:
114   :undoc-members:
115
116_a_v_a_r
117--------
118
119.. automodule:: fontTools.ttLib.tables._a_v_a_r
120   :inherited-members:
121   :members:
122   :undoc-members:
123
124_b_s_l_n
125--------
126
127.. automodule:: fontTools.ttLib.tables._b_s_l_n
128   :inherited-members:
129   :members:
130   :undoc-members:
131
132_c_i_d_g
133--------
134
135.. automodule:: fontTools.ttLib.tables._c_i_d_g
136   :inherited-members:
137   :members:
138   :undoc-members:
139
140_c_m_a_p
141--------
142
143.. automodule:: fontTools.ttLib.tables._c_m_a_p
144   :inherited-members:
145   :members:
146   :undoc-members:
147
148_c_v_a_r
149--------
150
151.. automodule:: fontTools.ttLib.tables._c_v_a_r
152   :inherited-members:
153   :members:
154   :undoc-members:
155
156_c_v_t
157------
158
159.. automodule:: fontTools.ttLib.tables._c_v_t
160   :inherited-members:
161   :members:
162   :undoc-members:
163
164_f_e_a_t
165--------
166
167.. automodule:: fontTools.ttLib.tables._f_e_a_t
168   :inherited-members:
169   :members:
170   :undoc-members:
171
172_f_p_g_m
173--------
174
175.. automodule:: fontTools.ttLib.tables._f_p_g_m
176   :inherited-members:
177   :members:
178   :undoc-members:
179
180_f_v_a_r
181--------
182
183.. automodule:: fontTools.ttLib.tables._f_v_a_r
184   :inherited-members:
185   :members:
186   :undoc-members:
187
188_g_a_s_p
189--------
190
191.. automodule:: fontTools.ttLib.tables._g_a_s_p
192   :inherited-members:
193   :members:
194   :undoc-members:
195
196
197_g_c_i_d
198--------
199
200.. automodule:: fontTools.ttLib.tables._g_c_i_d
201   :inherited-members:
202   :members:
203   :undoc-members:
204
205_g_l_y_f
206--------
207
208.. automodule:: fontTools.ttLib.tables._g_l_y_f
209   :inherited-members:
210   :members:
211   :undoc-members:
212
213_g_v_a_r
214--------
215
216.. automodule:: fontTools.ttLib.tables._g_v_a_r
217   :inherited-members:
218   :members:
219   :undoc-members:
220
221_h_d_m_x
222--------
223
224.. automodule:: fontTools.ttLib.tables._h_d_m_x
225   :inherited-members:
226   :members:
227   :undoc-members:
228
229_h_e_a_d
230--------
231
232.. automodule:: fontTools.ttLib.tables._h_e_a_d
233   :inherited-members:
234   :members:
235   :undoc-members:
236
237_h_h_e_a
238--------
239
240.. automodule:: fontTools.ttLib.tables._h_h_e_a
241   :inherited-members:
242   :members:
243   :undoc-members:
244
245_h_m_t_x
246--------
247
248.. automodule:: fontTools.ttLib.tables._h_m_t_x
249   :inherited-members:
250   :members:
251   :undoc-members:
252
253_k_e_r_n
254--------
255
256.. automodule:: fontTools.ttLib.tables._k_e_r_n
257   :inherited-members:
258   :members:
259   :undoc-members:
260
261_l_c_a_r
262--------
263
264.. automodule:: fontTools.ttLib.tables._l_c_a_r
265   :inherited-members:
266   :members:
267   :undoc-members:
268
269_l_o_c_a
270--------
271
272.. automodule:: fontTools.ttLib.tables._l_o_c_a
273   :inherited-members:
274   :members:
275   :undoc-members:
276
277_l_t_a_g
278--------
279
280.. automodule:: fontTools.ttLib.tables._l_t_a_g
281   :inherited-members:
282   :members:
283   :undoc-members:
284
285_m_a_x_p
286--------
287
288.. automodule:: fontTools.ttLib.tables._m_a_x_p
289   :inherited-members:
290   :members:
291   :undoc-members:
292
293_m_e_t_a
294--------
295
296.. automodule:: fontTools.ttLib.tables._m_e_t_a
297   :inherited-members:
298   :members:
299   :undoc-members:
300
301_m_o_r_t
302--------
303
304.. automodule:: fontTools.ttLib.tables._m_o_r_t
305   :inherited-members:
306   :members:
307   :undoc-members:
308
309
310_m_o_r_x
311--------
312
313.. automodule:: fontTools.ttLib.tables._m_o_r_x
314   :inherited-members:
315   :members:
316   :undoc-members:
317
318_n_a_m_e
319--------
320
321.. automodule:: fontTools.ttLib.tables._n_a_m_e
322   :inherited-members:
323   :members:
324   :undoc-members:
325
326_o_p_b_d
327--------
328
329.. automodule:: fontTools.ttLib.tables._o_p_b_d
330   :inherited-members:
331   :members:
332   :undoc-members:
333
334_p_o_s_t
335--------
336
337.. automodule:: fontTools.ttLib.tables._p_o_s_t
338   :inherited-members:
339   :members:
340   :undoc-members:
341
342_p_r_e_p
343--------
344
345.. automodule:: fontTools.ttLib.tables._p_r_e_p
346   :inherited-members:
347   :members:
348   :undoc-members:
349
350
351_p_r_o_p
352--------
353
354.. automodule:: fontTools.ttLib.tables._p_r_o_p
355   :inherited-members:
356   :members:
357   :undoc-members:
358
359_s_b_i_x
360--------
361
362.. automodule:: fontTools.ttLib.tables._s_b_i_x
363   :inherited-members:
364   :members:
365   :undoc-members:
366
367_t_r_a_k
368--------
369
370.. automodule:: fontTools.ttLib.tables._t_r_a_k
371   :inherited-members:
372   :members:
373   :undoc-members:
374
375_v_h_e_a
376--------
377
378.. automodule:: fontTools.ttLib.tables._v_h_e_a
379   :inherited-members:
380   :members:
381   :undoc-members:
382
383_v_m_t_x
384--------
385
386.. automodule:: fontTools.ttLib.tables._v_m_t_x
387   :inherited-members:
388   :members:
389   :undoc-members:
390
391asciiTable
392----------
393
394.. automodule:: fontTools.ttLib.tables.asciiTable
395   :inherited-members:
396   :members:
397   :undoc-members:
398
399B_A_S_E_
400--------
401
402.. automodule:: fontTools.ttLib.tables.B_A_S_E_
403   :inherited-members:
404   :members:
405   :undoc-members:
406
407BitmapGlyphMetrics
408------------------
409
410.. automodule:: fontTools.ttLib.tables.BitmapGlyphMetrics
411   :inherited-members:
412   :members:
413   :undoc-members:
414
415C_B_D_T_
416--------
417
418.. automodule:: fontTools.ttLib.tables.C_B_D_T_
419   :inherited-members:
420   :members:
421   :undoc-members:
422
423C_B_L_C_
424--------
425
426.. automodule:: fontTools.ttLib.tables.C_B_L_C_
427   :inherited-members:
428   :members:
429   :undoc-members:
430
431C_F_F_
432------
433
434.. automodule:: fontTools.ttLib.tables.C_F_F_
435   :inherited-members:
436   :members:
437   :undoc-members:
438
439C_F_F__2
440--------
441
442.. automodule:: fontTools.ttLib.tables.C_F_F__2
443   :inherited-members:
444   :members:
445   :undoc-members:
446
447C_O_L_R_
448--------
449
450.. automodule:: fontTools.ttLib.tables.C_O_L_R_
451   :inherited-members:
452   :members:
453   :undoc-members:
454
455C_P_A_L_
456--------
457
458.. automodule:: fontTools.ttLib.tables.C_P_A_L_
459   :inherited-members:
460   :members:
461   :undoc-members:
462
463D_S_I_G_
464--------
465
466.. automodule:: fontTools.ttLib.tables.D_S_I_G_
467   :inherited-members:
468   :members:
469   :undoc-members:
470
471DefaultTable
472------------
473
474.. automodule:: fontTools.ttLib.tables.DefaultTable
475   :inherited-members:
476   :members:
477   :undoc-members:
478
479E_B_D_T_
480--------
481
482.. automodule:: fontTools.ttLib.tables.E_B_D_T_
483   :inherited-members:
484   :members:
485   :undoc-members:
486
487E_B_L_C_
488--------
489
490.. automodule:: fontTools.ttLib.tables.E_B_L_C_
491   :inherited-members:
492   :members:
493   :undoc-members:
494
495F__e_a_t
496--------
497
498.. automodule:: fontTools.ttLib.tables.F__e_a_t
499   :inherited-members:
500   :members:
501   :undoc-members:
502
503
504F_F_T_M_
505--------
506
507.. automodule:: fontTools.ttLib.tables.F_F_T_M_
508   :inherited-members:
509   :members:
510   :undoc-members:
511
512
513G__l_a_t
514--------
515
516.. automodule:: fontTools.ttLib.tables.G__l_a_t
517   :inherited-members:
518   :members:
519   :undoc-members:
520
521G__l_o_c
522--------
523
524.. automodule:: fontTools.ttLib.tables.G__l_o_c
525   :inherited-members:
526   :members:
527   :undoc-members:
528
529G_D_E_F_
530--------
531
532.. automodule:: fontTools.ttLib.tables.G_D_E_F_
533   :inherited-members:
534   :members:
535   :undoc-members:
536
537G_M_A_P_
538--------
539
540.. automodule:: fontTools.ttLib.tables.G_M_A_P_
541   :inherited-members:
542   :members:
543   :undoc-members:
544
545G_P_K_G_
546--------
547
548.. automodule:: fontTools.ttLib.tables.G_P_K_G_
549   :inherited-members:
550   :members:
551   :undoc-members:
552
553G_P_O_S_
554--------
555
556.. automodule:: fontTools.ttLib.tables.G_P_O_S_
557   :inherited-members:
558   :members:
559   :undoc-members:
560
561G_S_U_B_
562--------
563
564.. automodule:: fontTools.ttLib.tables.G_S_U_B_
565   :inherited-members:
566   :members:
567   :undoc-members:
568
569grUtils
570-------
571
572.. automodule:: fontTools.ttLib.tables.grUtils
573   :inherited-members:
574   :members:
575   :undoc-members:
576
577H_V_A_R_
578--------
579
580.. automodule:: fontTools.ttLib.tables.H_V_A_R_
581   :inherited-members:
582   :members:
583   :undoc-members:
584
585J_S_T_F_
586--------
587
588.. automodule:: fontTools.ttLib.tables.J_S_T_F_
589   :inherited-members:
590   :members:
591   :undoc-members:
592
593L_T_S_H_
594--------
595
596.. automodule:: fontTools.ttLib.tables.L_T_S_H_
597   :inherited-members:
598   :members:
599   :undoc-members:
600
601M_A_T_H_
602--------
603
604.. automodule:: fontTools.ttLib.tables.M_A_T_H_
605   :inherited-members:
606   :members:
607   :undoc-members:
608
609M_E_T_A_
610--------
611
612.. automodule:: fontTools.ttLib.tables.M_E_T_A_
613   :inherited-members:
614   :members:
615   :undoc-members:
616
617M_V_A_R_
618--------
619
620.. automodule:: fontTools.ttLib.tables.M_V_A_R_
621   :inherited-members:
622   :members:
623   :undoc-members:
624
625O_S_2f_2
626--------
627
628.. automodule:: fontTools.ttLib.tables.O_S_2f_2
629   :inherited-members:
630   :members:
631   :undoc-members:
632
633otBase
634------
635
636.. automodule:: fontTools.ttLib.tables.otBase
637   :inherited-members:
638   :members:
639   :undoc-members:
640
641otConverters
642------------
643
644.. automodule:: fontTools.ttLib.tables.otConverters
645   :inherited-members:
646   :members:
647   :undoc-members:
648
649otData
650------
651
652.. automodule:: fontTools.ttLib.tables.otData
653   :inherited-members:
654   :members:
655   :undoc-members:
656
657otTables
658--------
659
660.. automodule:: fontTools.ttLib.tables.otTables
661   :inherited-members:
662   :members:
663   :undoc-members:
664
665S__i_l_f
666--------
667
668.. automodule:: fontTools.ttLib.tables.S__i_l_f
669   :inherited-members:
670   :members:
671   :undoc-members:
672
673S__i_l_l
674--------
675
676.. automodule:: fontTools.ttLib.tables.S__i_l_l
677   :inherited-members:
678   :members:
679   :undoc-members:
680
681S_I_N_G_
682--------
683
684.. automodule:: fontTools.ttLib.tables.S_I_N_G_
685   :inherited-members:
686   :members:
687   :undoc-members:
688
689S_T_A_T_
690--------
691
692.. automodule:: fontTools.ttLib.tables.S_T_A_T_
693   :inherited-members:
694   :members:
695   :undoc-members:
696
697S_V_G_
698------
699
700.. automodule:: fontTools.ttLib.tables.S_V_G_
701   :inherited-members:
702   :members:
703   :undoc-members:
704
705sbixGlyph
706---------
707
708.. automodule:: fontTools.ttLib.tables.sbixGlyph
709   :inherited-members:
710   :members:
711   :undoc-members:
712
713sbixStrike
714----------
715
716.. automodule:: fontTools.ttLib.tables.sbixStrike
717   :inherited-members:
718   :members:
719   :undoc-members:
720
721T_S_I__0
722--------
723
724.. automodule:: fontTools.ttLib.tables.T_S_I__0
725   :inherited-members:
726   :members:
727   :undoc-members:
728
729T_S_I__1
730--------
731
732.. automodule:: fontTools.ttLib.tables.T_S_I__1
733   :inherited-members:
734   :members:
735   :undoc-members:
736
737T_S_I__2
738--------
739
740.. automodule:: fontTools.ttLib.tables.T_S_I__2
741   :inherited-members:
742   :members:
743   :undoc-members:
744
745T_S_I__3
746--------
747
748.. automodule:: fontTools.ttLib.tables.T_S_I__3
749   :inherited-members:
750   :members:
751   :undoc-members:
752
753T_S_I__5
754--------
755
756.. automodule:: fontTools.ttLib.tables.T_S_I__5
757   :inherited-members:
758   :members:
759   :undoc-members:
760
761T_S_I_B_
762--------
763
764.. automodule:: fontTools.ttLib.tables.T_S_I_B_
765   :inherited-members:
766   :members:
767   :undoc-members:
768
769T_S_I_C_
770--------
771
772.. automodule:: fontTools.ttLib.tables.T_S_I_C_
773   :inherited-members:
774   :members:
775   :undoc-members:
776
777T_S_I_D_
778--------
779
780.. automodule:: fontTools.ttLib.tables.T_S_I_D_
781   :inherited-members:
782   :members:
783   :undoc-members:
784
785T_S_I_J_
786--------
787
788.. automodule:: fontTools.ttLib.tables.T_S_I_J_
789   :inherited-members:
790   :members:
791   :undoc-members:
792
793T_S_I_P_
794--------
795
796.. automodule:: fontTools.ttLib.tables.T_S_I_P_
797   :inherited-members:
798   :members:
799   :undoc-members:
800
801T_S_I_S_
802--------
803
804.. automodule:: fontTools.ttLib.tables.T_S_I_S_
805   :inherited-members:
806   :members:
807   :undoc-members:
808
809T_S_I_V_
810--------
811
812.. automodule:: fontTools.ttLib.tables.T_S_I_V_
813   :inherited-members:
814   :members:
815   :undoc-members:
816
817T_T_F_A_
818--------
819
820.. automodule:: fontTools.ttLib.tables.T_T_F_A_
821   :inherited-members:
822   :members:
823   :undoc-members:
824
825ttProgram
826---------
827
828.. automodule:: fontTools.ttLib.tables.ttProgram
829   :inherited-members:
830   :members:
831   :undoc-members:
832
833TupleVariation
834--------------
835
836.. automodule:: fontTools.ttLib.tables.TupleVariation
837   :inherited-members:
838   :members:
839   :undoc-members:
840
841V_D_M_X_
842--------
843
844.. automodule:: fontTools.ttLib.tables.V_D_M_X_
845   :inherited-members:
846   :members:
847   :undoc-members:
848
849V_O_R_G_
850--------
851
852.. automodule:: fontTools.ttLib.tables.V_O_R_G_
853   :inherited-members:
854   :members:
855   :undoc-members:
856
857V_V_A_R_
858--------
859
860.. automodule:: fontTools.ttLib.tables.V_V_A_R_
861   :inherited-members:
862   :members:
863   :undoc-members:
864
865
866