• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2  *
3  * sfnt.h
4  *
5  *   High-level 'sfnt' driver interface (specification).
6  *
7  * Copyright (C) 1996-2023 by
8  * David Turner, Robert Wilhelm, and Werner Lemberg.
9  *
10  * This file is part of the FreeType project, and may only be used,
11  * modified, and distributed under the terms of the FreeType project
12  * license, LICENSE.TXT.  By continuing to use, modify, or distribute
13  * this file you indicate that you have read the license and
14  * understand and accept it fully.
15  *
16  */
17 
18 
19 #ifndef SFNT_H_
20 #define SFNT_H_
21 
22 
23 #include <freetype/internal/ftdrv.h>
24 #include <freetype/internal/tttypes.h>
25 #include <freetype/internal/wofftypes.h>
26 
27 
28 FT_BEGIN_HEADER
29 
30 
31   /**************************************************************************
32    *
33    * @functype:
34    *   TT_Init_Face_Func
35    *
36    * @description:
37    *   First part of the SFNT face object initialization.  This finds the
38    *   face in a SFNT file or collection, and load its format tag in
39    *   face->format_tag.
40    *
41    * @input:
42    *   stream ::
43    *     The input stream.
44    *
45    *   face ::
46    *     A handle to the target face object.
47    *
48    *   face_index ::
49    *     The index of the TrueType font, if we are opening a collection, in
50    *     bits 0-15.  The numbered instance index~+~1 of a GX (sub)font, if
51    *     applicable, in bits 16-30.
52    *
53    *   num_params ::
54    *     The number of additional parameters.
55    *
56    *   params ::
57    *     Optional additional parameters.
58    *
59    * @return:
60    *   FreeType error code.  0 means success.
61    *
62    * @note:
63    *   The stream cursor must be at the font file's origin.
64    *
65    *   This function recognizes fonts embedded in a 'TrueType collection'.
66    *
67    *   Once the format tag has been validated by the font driver, it should
68    *   then call the TT_Load_Face_Func() callback to read the rest of the
69    *   SFNT tables in the object.
70    */
71   typedef FT_Error
72   (*TT_Init_Face_Func)( FT_Stream      stream,
73                         TT_Face        face,
74                         FT_Int         face_index,
75                         FT_Int         num_params,
76                         FT_Parameter*  params );
77 
78 
79   /**************************************************************************
80    *
81    * @functype:
82    *   TT_Load_Face_Func
83    *
84    * @description:
85    *   Second part of the SFNT face object initialization.  This loads the
86    *   common SFNT tables (head, OS/2, maxp, metrics, etc.) in the face
87    *   object.
88    *
89    * @input:
90    *   stream ::
91    *     The input stream.
92    *
93    *   face ::
94    *     A handle to the target face object.
95    *
96    *   face_index ::
97    *     The index of the TrueType font, if we are opening a collection, in
98    *     bits 0-15.  The numbered instance index~+~1 of a GX (sub)font, if
99    *     applicable, in bits 16-30.
100    *
101    *   num_params ::
102    *     The number of additional parameters.
103    *
104    *   params ::
105    *     Optional additional parameters.
106    *
107    * @return:
108    *   FreeType error code.  0 means success.
109    *
110    * @note:
111    *   This function must be called after TT_Init_Face_Func().
112    */
113   typedef FT_Error
114   (*TT_Load_Face_Func)( FT_Stream      stream,
115                         TT_Face        face,
116                         FT_Int         face_index,
117                         FT_Int         num_params,
118                         FT_Parameter*  params );
119 
120 
121   /**************************************************************************
122    *
123    * @functype:
124    *   TT_Done_Face_Func
125    *
126    * @description:
127    *   A callback used to delete the common SFNT data from a face.
128    *
129    * @input:
130    *   face ::
131    *     A handle to the target face object.
132    *
133    * @note:
134    *   This function does NOT destroy the face object.
135    */
136   typedef void
137   (*TT_Done_Face_Func)( TT_Face  face );
138 
139 
140   /**************************************************************************
141    *
142    * @functype:
143    *   TT_Load_Any_Func
144    *
145    * @description:
146    *   Load any font table into client memory.
147    *
148    * @input:
149    *   face ::
150    *     The face object to look for.
151    *
152    *   tag ::
153    *     The tag of table to load.  Use the value 0 if you want to access the
154    *     whole font file, else set this parameter to a valid TrueType table
155    *     tag that you can forge with the MAKE_TT_TAG macro.
156    *
157    *   offset ::
158    *     The starting offset in the table (or the file if tag == 0).
159    *
160    *   length ::
161    *     The address of the decision variable:
162    *
163    *     If `length == NULL`: Loads the whole table.  Returns an error if
164    *     'offset' == 0!
165    *
166    *     If `*length == 0`: Exits immediately; returning the length of the
167    *     given table or of the font file, depending on the value of 'tag'.
168    *
169    *     If `*length != 0`: Loads the next 'length' bytes of table or font,
170    *     starting at offset 'offset' (in table or font too).
171    *
172    * @output:
173    *   buffer ::
174    *     The address of target buffer.
175    *
176    * @return:
177    *   TrueType error code.  0 means success.
178    */
179   typedef FT_Error
180   (*TT_Load_Any_Func)( TT_Face    face,
181                        FT_ULong   tag,
182                        FT_Long    offset,
183                        FT_Byte   *buffer,
184                        FT_ULong*  length );
185 
186 
187   /**************************************************************************
188    *
189    * @functype:
190    *   TT_Find_SBit_Image_Func
191    *
192    * @description:
193    *   Check whether an embedded bitmap (an 'sbit') exists for a given glyph,
194    *   at a given strike.
195    *
196    * @input:
197    *   face ::
198    *     The target face object.
199    *
200    *   glyph_index ::
201    *     The glyph index.
202    *
203    *   strike_index ::
204    *     The current strike index.
205    *
206    * @output:
207    *   arange ::
208    *     The SBit range containing the glyph index.
209    *
210    *   astrike ::
211    *     The SBit strike containing the glyph index.
212    *
213    *   aglyph_offset ::
214    *     The offset of the glyph data in 'EBDT' table.
215    *
216    * @return:
217    *   FreeType error code.  0 means success.  Returns
218    *   SFNT_Err_Invalid_Argument if no sbit exists for the requested glyph.
219    */
220   typedef FT_Error
221   (*TT_Find_SBit_Image_Func)( TT_Face          face,
222                               FT_UInt          glyph_index,
223                               FT_ULong         strike_index,
224                               TT_SBit_Range   *arange,
225                               TT_SBit_Strike  *astrike,
226                               FT_ULong        *aglyph_offset );
227 
228 
229   /**************************************************************************
230    *
231    * @functype:
232    *   TT_Load_SBit_Metrics_Func
233    *
234    * @description:
235    *   Get the big metrics for a given embedded bitmap.
236    *
237    * @input:
238    *   stream ::
239    *     The input stream.
240    *
241    *   range ::
242    *     The SBit range containing the glyph.
243    *
244    * @output:
245    *   big_metrics ::
246    *     A big SBit metrics structure for the glyph.
247    *
248    * @return:
249    *   FreeType error code.  0 means success.
250    *
251    * @note:
252    *   The stream cursor must be positioned at the glyph's offset within the
253    *   'EBDT' table before the call.
254    *
255    *   If the image format uses variable metrics, the stream cursor is
256    *   positioned just after the metrics header in the 'EBDT' table on
257    *   function exit.
258    */
259   typedef FT_Error
260   (*TT_Load_SBit_Metrics_Func)( FT_Stream        stream,
261                                 TT_SBit_Range    range,
262                                 TT_SBit_Metrics  metrics );
263 
264 
265   /**************************************************************************
266    *
267    * @functype:
268    *   TT_Load_SBit_Image_Func
269    *
270    * @description:
271    *   Load a given glyph sbit image from the font resource.  This also
272    *   returns its metrics.
273    *
274    * @input:
275    *   face ::
276    *     The target face object.
277    *
278    *   strike_index ::
279    *     The strike index.
280    *
281    *   glyph_index ::
282    *     The current glyph index.
283    *
284    *   load_flags ::
285    *     The current load flags.
286    *
287    *   stream ::
288    *     The input stream.
289    *
290    * @output:
291    *   amap ::
292    *     The target pixmap.
293    *
294    *   ametrics ::
295    *     A big sbit metrics structure for the glyph image.
296    *
297    * @return:
298    *   FreeType error code.  0 means success.  Returns an error if no glyph
299    *   sbit exists for the index.
300    *
301    * @note:
302    *   The `map.buffer` field is always freed before the glyph is loaded.
303    */
304   typedef FT_Error
305   (*TT_Load_SBit_Image_Func)( TT_Face              face,
306                               FT_ULong             strike_index,
307                               FT_UInt              glyph_index,
308                               FT_UInt              load_flags,
309                               FT_Stream            stream,
310                               FT_Bitmap           *amap,
311                               TT_SBit_MetricsRec  *ametrics );
312 
313 
314   /**************************************************************************
315    *
316    * @functype:
317    *   TT_Load_Svg_Doc_Func
318    *
319    * @description:
320    *   Scan the SVG document list to find the document containing the glyph
321    *   that has the ID 'glyph*XXX*', where *XXX* is the value of
322    *   `glyph_index` as a decimal integer.
323    *
324    * @inout:
325    *   glyph ::
326    *     The glyph slot from which pointers to the SVG document list is to be
327    *     grabbed.  The results are stored back in the slot.
328    *
329    * @input:
330    *   glyph_index ::
331    *     The index of the glyph that is to be looked up.
332    *
333    * @return:
334    *   FreeType error code.  0 means success.
335    */
336   typedef FT_Error
337   (*TT_Load_Svg_Doc_Func)( FT_GlyphSlot  glyph,
338                            FT_UInt       glyph_index );
339 
340 
341   /**************************************************************************
342    *
343    * @functype:
344    *   TT_Set_SBit_Strike_Func
345    *
346    * @description:
347    *   Select an sbit strike for a given size request.
348    *
349    * @input:
350    *   face ::
351    *     The target face object.
352    *
353    *   req ::
354    *     The size request.
355    *
356    * @output:
357    *   astrike_index ::
358    *     The index of the sbit strike.
359    *
360    * @return:
361    *   FreeType error code.  0 means success.  Returns an error if no sbit
362    *   strike exists for the selected ppem values.
363    */
364   typedef FT_Error
365   (*TT_Set_SBit_Strike_Func)( TT_Face          face,
366                               FT_Size_Request  req,
367                               FT_ULong*        astrike_index );
368 
369 
370   /**************************************************************************
371    *
372    * @functype:
373    *   TT_Load_Strike_Metrics_Func
374    *
375    * @description:
376    *   Load the metrics of a given strike.
377    *
378    * @input:
379    *   face ::
380    *     The target face object.
381    *
382    *   strike_index ::
383    *     The strike index.
384    *
385    * @output:
386    *   metrics ::
387    *     the metrics of the strike.
388    *
389    * @return:
390    *   FreeType error code.  0 means success.  Returns an error if no such
391    *   sbit strike exists.
392    */
393   typedef FT_Error
394   (*TT_Load_Strike_Metrics_Func)( TT_Face           face,
395                                   FT_ULong          strike_index,
396                                   FT_Size_Metrics*  metrics );
397 
398 
399   /**************************************************************************
400    *
401    * @functype:
402    *   TT_Get_PS_Name_Func
403    *
404    * @description:
405    *   Get the PostScript glyph name of a glyph.
406    *
407    * @input:
408    *   idx ::
409    *     The glyph index.
410    *
411    *   PSname ::
412    *     The address of a string pointer.  Will be `NULL` in case of error,
413    *     otherwise it is a pointer to the glyph name.
414    *
415    *     You must not modify the returned string!
416    *
417    * @output:
418    *   FreeType error code.  0 means success.
419    */
420   typedef FT_Error
421   (*TT_Get_PS_Name_Func)( TT_Face      face,
422                           FT_UInt      idx,
423                           FT_String**  PSname );
424 
425 
426   /**************************************************************************
427    *
428    * @functype:
429    *   TT_Load_Metrics_Func
430    *
431    * @description:
432    *   Load a metrics table, which is a table with a horizontal and a
433    *   vertical version.
434    *
435    * @input:
436    *   face ::
437    *     A handle to the target face object.
438    *
439    *   stream ::
440    *     The input stream.
441    *
442    *   vertical ::
443    *     A boolean flag.  If set, load the vertical one.
444    *
445    * @return:
446    *   FreeType error code.  0 means success.
447    */
448   typedef FT_Error
449   (*TT_Load_Metrics_Func)( TT_Face    face,
450                            FT_Stream  stream,
451                            FT_Bool    vertical );
452 
453 
454   /**************************************************************************
455    *
456    * @functype:
457    *   TT_Get_Metrics_Func
458    *
459    * @description:
460    *   Load the horizontal or vertical header in a face object.
461    *
462    * @input:
463    *   face ::
464    *     A handle to the target face object.
465    *
466    *   vertical ::
467    *     A boolean flag.  If set, load vertical metrics.
468    *
469    *   gindex ::
470    *     The glyph index.
471    *
472    * @output:
473    *   abearing ::
474    *     The horizontal (or vertical) bearing.  Set to zero in case of error.
475    *
476    *   aadvance ::
477    *     The horizontal (or vertical) advance.  Set to zero in case of error.
478    */
479   typedef void
480   (*TT_Get_Metrics_Func)( TT_Face     face,
481                           FT_Bool     vertical,
482                           FT_UInt     gindex,
483                           FT_Short*   abearing,
484                           FT_UShort*  aadvance );
485 
486 
487   /**************************************************************************
488    *
489    * @functype:
490    *   TT_Set_Palette_Func
491    *
492    * @description:
493    *   Load the colors into `face->palette` for a given palette index.
494    *
495    * @input:
496    *   face ::
497    *     The target face object.
498    *
499    *   idx ::
500    *     The palette index.
501    *
502    * @return:
503    *   FreeType error code.  0 means success.
504    */
505   typedef FT_Error
506   (*TT_Set_Palette_Func)( TT_Face  face,
507                           FT_UInt  idx );
508 
509 
510   /**************************************************************************
511    *
512    * @functype:
513    *   TT_Get_Colr_Layer_Func
514    *
515    * @description:
516    *   Iteratively get the color layer data of a given glyph index.
517    *
518    * @input:
519    *   face ::
520    *     The target face object.
521    *
522    *   base_glyph ::
523    *     The glyph index the colored glyph layers are associated with.
524    *
525    * @inout:
526    *   iterator ::
527    *     An @FT_LayerIterator object.  For the first call you should set
528    *     `iterator->p` to `NULL`.  For all following calls, simply use the
529    *     same object again.
530    *
531    * @output:
532    *   aglyph_index ::
533    *     The glyph index of the current layer.
534    *
535    *   acolor_index ::
536    *     The color index into the font face's color palette of the current
537    *     layer.  The value 0xFFFF is special; it doesn't reference a palette
538    *     entry but indicates that the text foreground color should be used
539    *     instead (to be set up by the application outside of FreeType).
540    *
541    * @return:
542    *   Value~1 if everything is OK.  If there are no more layers (or if there
543    *   are no layers at all), value~0 gets returned.  In case of an error,
544    *   value~0 is returned also.
545    */
546   typedef FT_Bool
547   (*TT_Get_Colr_Layer_Func)( TT_Face            face,
548                              FT_UInt            base_glyph,
549                              FT_UInt           *aglyph_index,
550                              FT_UInt           *acolor_index,
551                              FT_LayerIterator*  iterator );
552 
553 
554   /**************************************************************************
555    *
556    * @functype:
557    *   TT_Get_Color_Glyph_Paint_Func
558    *
559    * @description:
560    *   Find the root @FT_OpaquePaint object for a given glyph ID.
561    *
562    * @input:
563    *   face ::
564    *     The target face object.
565    *
566    *   base_glyph ::
567    *     The glyph index the colored glyph layers are associated with.
568    *
569    * @output:
570    *   paint ::
571    *     The root @FT_OpaquePaint object.
572    *
573    * @return:
574    *   Value~1 if everything is OK.  If no color glyph is found, or the root
575    *   paint could not be retrieved, value~0 gets returned.  In case of an
576    *   error, value~0 is returned also.
577    */
578   typedef FT_Bool
579   ( *TT_Get_Color_Glyph_Paint_Func )( TT_Face                   face,
580                                       FT_UInt                   base_glyph,
581                                       FT_Color_Root_Transform   root_transform,
582                                       FT_OpaquePaint           *paint );
583 
584 
585   /**************************************************************************
586    *
587    * @functype:
588    *   TT_Get_Color_Glyph_ClipBox_Func
589    *
590    * @description:
591    *   Search for a 'COLR' v1 clip box for the specified `base_glyph` and
592    *   fill the `clip_box` parameter with the 'COLR' v1 'ClipBox' information
593    *   if one is found.
594    *
595    * @input:
596    *   face ::
597    *     A handle to the parent face object.
598    *
599    *   base_glyph ::
600    *     The glyph index for which to retrieve the clip box.
601    *
602    * @output:
603    *   clip_box ::
604    *     The clip box for the requested `base_glyph` if one is found.  The
605    *     clip box is computed taking scale and transformations configured on
606    *     the @FT_Face into account.  @FT_ClipBox contains @FT_Vector values
607    *     in 26.6 format.
608    *
609    * @note:
610    *     To retrieve the clip box in font units, reset scale to units-per-em
611    *     and remove transforms configured using @FT_Set_Transform.
612    *
613    * @return:
614    *   Value~1 if a ClipBox is found.  If no clip box is found or an
615    *   error occured, value~0 is returned.
616    */
617   typedef FT_Bool
618   ( *TT_Get_Color_Glyph_ClipBox_Func )( TT_Face      face,
619                                         FT_UInt      base_glyph,
620                                         FT_ClipBox*  clip_box );
621 
622 
623   /**************************************************************************
624    *
625    * @functype:
626    *   TT_Get_Paint_Layers_Func
627    *
628    * @description:
629    *   Access the layers of a `PaintColrLayers` table.
630    *
631    * @input:
632    *   face ::
633    *     The target face object.
634    *
635    * @inout:
636    *   iterator ::
637    *     The @FT_LayerIterator from an @FT_PaintColrLayers object, for which
638    *     the layers are to be retrieved.  The internal state of the iterator
639    *     is incremented after one call to this function for retrieving one
640    *     layer.
641    *
642    * @output:
643    *   paint ::
644    *     The root @FT_OpaquePaint object referencing the actual paint table.
645    *
646    * @return:
647    *   Value~1 if everything is OK.  Value~0 gets returned when the paint
648    *   object can not be retrieved or any other error occurs.
649    */
650   typedef FT_Bool
651   ( *TT_Get_Paint_Layers_Func )( TT_Face            face,
652                                  FT_LayerIterator*  iterator,
653                                  FT_OpaquePaint    *paint );
654 
655 
656   /**************************************************************************
657    *
658    * @functype:
659    *   TT_Get_Colorline_Stops_Func
660    *
661    * @description:
662    *   Get the gradient and solid fill information for a given glyph.
663    *
664    * @input:
665    *   face ::
666    *     The target face object.
667    *
668    * @inout:
669    *   iterator ::
670    *     An @FT_ColorStopIterator object.  For the first call you should set
671    *     `iterator->p` to `NULL`.  For all following calls, simply use the
672    *     same object again.
673    *
674    * @output:
675    *   color_stop ::
676    *     Color index and alpha value for the retrieved color stop.
677    *
678    * @return:
679    *   Value~1 if everything is OK.  If there are no more color stops,
680    *   value~0 gets returned.  In case of an error, value~0 is returned
681    *   also.
682    */
683   typedef FT_Bool
684   ( *TT_Get_Colorline_Stops_Func )( TT_Face                face,
685                                     FT_ColorStop          *color_stop,
686                                     FT_ColorStopIterator*  iterator );
687 
688 
689   /**************************************************************************
690    *
691    * @functype:
692    *   TT_Get_Paint_Func
693    *
694    * @description:
695    *   Get the paint details for a given @FT_OpaquePaint object.
696    *
697    * @input:
698    *   face ::
699    *     The target face object.
700    *
701    *   opaque_paint ::
702    *     The @FT_OpaquePaint object.
703    *
704    * @output:
705    *   paint ::
706    *     An @FT_COLR_Paint object holding the details on `opaque_paint`.
707    *
708    * @return:
709    *   Value~1 if everything is OK.  Value~0 if no details can be found for
710    *   this paint or any other error occured.
711    */
712   typedef FT_Bool
713   ( *TT_Get_Paint_Func )( TT_Face         face,
714                           FT_OpaquePaint  opaque_paint,
715                           FT_COLR_Paint  *paint );
716 
717 
718   /**************************************************************************
719    *
720    * @functype:
721    *   TT_Blend_Colr_Func
722    *
723    * @description:
724    *   Blend the bitmap in `new_glyph` into `base_glyph` using the color
725    *   specified by `color_index`.  If `color_index` is 0xFFFF, use
726    *   `face->foreground_color` if `face->have_foreground_color` is set.
727    *   Otherwise check `face->palette_data.palette_flags`: If present and
728    *   @FT_PALETTE_FOR_DARK_BACKGROUND is set, use BGRA value 0xFFFFFFFF
729    *   (white opaque).  Otherwise use BGRA value 0x000000FF (black opaque).
730    *
731    * @input:
732    *   face ::
733    *     The target face object.
734    *
735    *   color_index ::
736    *     Color index from the COLR table.
737    *
738    *   base_glyph ::
739    *     Slot for bitmap to be merged into.  The underlying bitmap may get
740    *     reallocated.
741    *
742    *   new_glyph ::
743    *     Slot to be incooperated into `base_glyph`.
744    *
745    * @return:
746    *   FreeType error code.  0 means success.  Returns an error if
747    *   color_index is invalid or reallocation fails.
748    */
749   typedef FT_Error
750   (*TT_Blend_Colr_Func)( TT_Face       face,
751                          FT_UInt       color_index,
752                          FT_GlyphSlot  base_glyph,
753                          FT_GlyphSlot  new_glyph );
754 
755 
756   /**************************************************************************
757    *
758    * @functype:
759    *   TT_Get_Name_Func
760    *
761    * @description:
762    *   From the 'name' table, return a given ENGLISH name record in ASCII.
763    *
764    * @input:
765    *   face ::
766    *     A handle to the source face object.
767    *
768    *   nameid ::
769    *     The name id of the name record to return.
770    *
771    * @inout:
772    *   name ::
773    *     The address of an allocated string pointer.  `NULL` if no name is
774    *     present.
775    *
776    * @return:
777    *   FreeType error code.  0 means success.
778    */
779   typedef FT_Error
780   (*TT_Get_Name_Func)( TT_Face      face,
781                        FT_UShort    nameid,
782                        FT_String**  name );
783 
784 
785   /**************************************************************************
786    *
787    * @functype:
788    *   TT_Get_Name_ID_Func
789    *
790    * @description:
791    *   Search whether an ENGLISH version for a given name ID is in the 'name'
792    *   table.
793    *
794    * @input:
795    *   face ::
796    *     A handle to the source face object.
797    *
798    *   nameid ::
799    *     The name id of the name record to return.
800    *
801    * @output:
802    *   win ::
803    *     If non-negative, an index into the 'name' table with the
804    *     corresponding (3,1) or (3,0) Windows entry.
805    *
806    *   apple ::
807    *     If non-negative, an index into the 'name' table with the
808    *     corresponding (1,0) Apple entry.
809    *
810    * @return:
811    *   1 if there is either a win or apple entry (or both), 0 otheriwse.
812    */
813   typedef FT_Bool
814   (*TT_Get_Name_ID_Func)( TT_Face    face,
815                           FT_UShort  nameid,
816                           FT_Int    *win,
817                           FT_Int    *apple );
818 
819 
820   /**************************************************************************
821    *
822    * @functype:
823    *   TT_Load_Table_Func
824    *
825    * @description:
826    *   Load a given TrueType table.
827    *
828    * @input:
829    *   face ::
830    *     A handle to the target face object.
831    *
832    *   stream ::
833    *     The input stream.
834    *
835    * @return:
836    *   FreeType error code.  0 means success.
837    *
838    * @note:
839    *   The function uses `face->goto_table` to seek the stream to the start
840    *   of the table, except while loading the font directory.
841    */
842   typedef FT_Error
843   (*TT_Load_Table_Func)( TT_Face    face,
844                          FT_Stream  stream );
845 
846 
847   /**************************************************************************
848    *
849    * @functype:
850    *   TT_Free_Table_Func
851    *
852    * @description:
853    *   Free a given TrueType table.
854    *
855    * @input:
856    *   face ::
857    *     A handle to the target face object.
858    */
859   typedef void
860   (*TT_Free_Table_Func)( TT_Face  face );
861 
862 
863   /*
864    * @functype:
865    *    TT_Face_GetKerningFunc
866    *
867    * @description:
868    *    Return the horizontal kerning value between two glyphs.
869    *
870    * @input:
871    *    face ::
872    *      A handle to the source face object.
873    *
874    *    left_glyph ::
875    *      The left glyph index.
876    *
877    *    right_glyph ::
878    *      The right glyph index.
879    *
880    * @return:
881    *    The kerning value in font units.
882    */
883   typedef FT_Int
884   (*TT_Face_GetKerningFunc)( TT_Face  face,
885                              FT_UInt  left_glyph,
886                              FT_UInt  right_glyph );
887 
888 
889   /**************************************************************************
890    *
891    * @struct:
892    *   SFNT_Interface
893    *
894    * @description:
895    *   This structure holds pointers to the functions used to load and free
896    *   the basic tables that are required in a 'sfnt' font file.
897    *
898    * @fields:
899    *   Check the various xxx_Func() descriptions for details.
900    */
901   typedef struct  SFNT_Interface_
902   {
903     TT_Loader_GotoTableFunc  goto_table;
904 
905     TT_Init_Face_Func    init_face;
906     TT_Load_Face_Func    load_face;
907     TT_Done_Face_Func    done_face;
908     FT_Module_Requester  get_interface;
909 
910     TT_Load_Any_Func  load_any;
911 
912     /* these functions are called by `load_face' but they can also  */
913     /* be called from external modules, if there is a need to do so */
914     TT_Load_Table_Func    load_head;
915     TT_Load_Metrics_Func  load_hhea;
916     TT_Load_Table_Func    load_cmap;
917     TT_Load_Table_Func    load_maxp;
918     TT_Load_Table_Func    load_os2;
919     TT_Load_Table_Func    load_post;
920 
921     TT_Load_Table_Func  load_name;
922     TT_Free_Table_Func  free_name;
923 
924     /* this field was called `load_kerning' up to version 2.1.10 */
925     TT_Load_Table_Func  load_kern;
926 
927     TT_Load_Table_Func  load_gasp;
928     TT_Load_Table_Func  load_pclt;
929 
930     /* see `ttload.h'; this field was called `load_bitmap_header' up to */
931     /* version 2.1.10                                                   */
932     TT_Load_Table_Func  load_bhed;
933 
934     TT_Load_SBit_Image_Func  load_sbit_image;
935 
936     /* see `ttpost.h' */
937     TT_Get_PS_Name_Func  get_psname;
938     TT_Free_Table_Func   free_psnames;
939 
940     /* starting here, the structure differs from version 2.1.7 */
941 
942     /* this field was introduced in version 2.1.8, named `get_psname' */
943     TT_Face_GetKerningFunc  get_kerning;
944 
945     /* new elements introduced after version 2.1.10 */
946 
947     /* load the font directory, i.e., the offset table and */
948     /* the table directory                                 */
949     TT_Load_Table_Func    load_font_dir;
950     TT_Load_Metrics_Func  load_hmtx;
951 
952     TT_Load_Table_Func  load_eblc;
953     TT_Free_Table_Func  free_eblc;
954 
955     TT_Set_SBit_Strike_Func      set_sbit_strike;
956     TT_Load_Strike_Metrics_Func  load_strike_metrics;
957 
958     TT_Load_Table_Func               load_cpal;
959     TT_Load_Table_Func               load_colr;
960     TT_Free_Table_Func               free_cpal;
961     TT_Free_Table_Func               free_colr;
962     TT_Set_Palette_Func              set_palette;
963     TT_Get_Colr_Layer_Func           get_colr_layer;
964     TT_Get_Color_Glyph_Paint_Func    get_colr_glyph_paint;
965     TT_Get_Color_Glyph_ClipBox_Func  get_color_glyph_clipbox;
966     TT_Get_Paint_Layers_Func         get_paint_layers;
967     TT_Get_Colorline_Stops_Func      get_colorline_stops;
968     TT_Get_Paint_Func                get_paint;
969     TT_Blend_Colr_Func               colr_blend;
970 
971     TT_Get_Metrics_Func  get_metrics;
972 
973     TT_Get_Name_Func     get_name;
974     TT_Get_Name_ID_Func  get_name_id;
975 
976     /* OpenType SVG Support */
977     TT_Load_Table_Func    load_svg;
978     TT_Free_Table_Func    free_svg;
979     TT_Load_Svg_Doc_Func  load_svg_doc;
980 
981   } SFNT_Interface;
982 
983 
984   /* transitional */
985   typedef SFNT_Interface*   SFNT_Service;
986 
987 
988 #define FT_DEFINE_SFNT_INTERFACE(        \
989           class_,                        \
990           goto_table_,                   \
991           init_face_,                    \
992           load_face_,                    \
993           done_face_,                    \
994           get_interface_,                \
995           load_any_,                     \
996           load_head_,                    \
997           load_hhea_,                    \
998           load_cmap_,                    \
999           load_maxp_,                    \
1000           load_os2_,                     \
1001           load_post_,                    \
1002           load_name_,                    \
1003           free_name_,                    \
1004           load_kern_,                    \
1005           load_gasp_,                    \
1006           load_pclt_,                    \
1007           load_bhed_,                    \
1008           load_sbit_image_,              \
1009           get_psname_,                   \
1010           free_psnames_,                 \
1011           get_kerning_,                  \
1012           load_font_dir_,                \
1013           load_hmtx_,                    \
1014           load_eblc_,                    \
1015           free_eblc_,                    \
1016           set_sbit_strike_,              \
1017           load_strike_metrics_,          \
1018           load_cpal_,                    \
1019           load_colr_,                    \
1020           free_cpal_,                    \
1021           free_colr_,                    \
1022           set_palette_,                  \
1023           get_colr_layer_,               \
1024           get_colr_glyph_paint_,         \
1025           get_color_glyph_clipbox,       \
1026           get_paint_layers_,             \
1027           get_colorline_stops_,          \
1028           get_paint_,                    \
1029           colr_blend_,                   \
1030           get_metrics_,                  \
1031           get_name_,                     \
1032           get_name_id_,                  \
1033           load_svg_,                     \
1034           free_svg_,                     \
1035           load_svg_doc_ )                \
1036   static const SFNT_Interface  class_ =  \
1037   {                                      \
1038     goto_table_,                         \
1039     init_face_,                          \
1040     load_face_,                          \
1041     done_face_,                          \
1042     get_interface_,                      \
1043     load_any_,                           \
1044     load_head_,                          \
1045     load_hhea_,                          \
1046     load_cmap_,                          \
1047     load_maxp_,                          \
1048     load_os2_,                           \
1049     load_post_,                          \
1050     load_name_,                          \
1051     free_name_,                          \
1052     load_kern_,                          \
1053     load_gasp_,                          \
1054     load_pclt_,                          \
1055     load_bhed_,                          \
1056     load_sbit_image_,                    \
1057     get_psname_,                         \
1058     free_psnames_,                       \
1059     get_kerning_,                        \
1060     load_font_dir_,                      \
1061     load_hmtx_,                          \
1062     load_eblc_,                          \
1063     free_eblc_,                          \
1064     set_sbit_strike_,                    \
1065     load_strike_metrics_,                \
1066     load_cpal_,                          \
1067     load_colr_,                          \
1068     free_cpal_,                          \
1069     free_colr_,                          \
1070     set_palette_,                        \
1071     get_colr_layer_,                     \
1072     get_colr_glyph_paint_,               \
1073     get_color_glyph_clipbox,             \
1074     get_paint_layers_,                   \
1075     get_colorline_stops_,                \
1076     get_paint_,                          \
1077     colr_blend_,                         \
1078     get_metrics_,                        \
1079     get_name_,                           \
1080     get_name_id_,                        \
1081     load_svg_,                           \
1082     free_svg_,                           \
1083     load_svg_doc_                        \
1084   };
1085 
1086 
1087 FT_END_HEADER
1088 
1089 #endif /* SFNT_H_ */
1090 
1091 
1092 /* END */
1093