2 * Copyright © 2002, 2003 Sun Microsystems, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of Sun Microsystems, Inc. nor the names of
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
20 * This software is provided "AS IS," without a warranty of any kind.
22 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
23 * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
24 * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
25 * SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES OR
26 * LIABILITIES SUFFERED BY LICENSEE AS A RESULT OF OR RELATING TO USE,
27 * MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR ITS DERIVATIVES.
28 * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE,
29 * PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
30 * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE
31 * THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE
32 * SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
37 /* @(#)sft.h 1.17 03/01/08 SMI */
41 * @brief Sun Font Tools
42 * @author Alexander Gelfenbain <adg@sun.com>
47 * If NO_MAPPERS is defined, MapChar() and MapString() and consequently GetTTSimpleCharMetrics()
48 * don't get compiled in. This is done to avoid including a large chunk of code (TranslateXY() from
49 * xlat.c in the projects that don't require it.
51 * If NO_TYPE3 is defined CreateT3FromTTGlyphs() does not get compiled in.
52 * If NO_TYPE42 is defined Type42-related code is excluded
53 * If NO_TTCR is defined TrueType creation related code is excluded\
54 * If NO_LIST is defined list.h and piblic functions that use it don't get compiled
55 * If USE_GSUB is *not* defined Philipp's GSUB code does not get included
57 * When STSF is defined several data types are defined elsewhere
61 * Generated fonts contain an XUID entry in the form of:
65 * 103 - Sun's Adobe assigned XUID number. Contact person: Alexander Gelfenbain <gelf@eng.sun.com>
67 * T - font type. 0: Type 3, 1: Type 42
68 * C1 - CRC-32 of the entire source TrueType font
69 * N - number of glyphs in the subset
70 * C2 - CRC-32 of the array of glyph IDs used to generate the subset
71 * C3 - CRC-32 of the array of encoding numbers used to generate the subset
78 #include <sys/types.h>
95 #if 0 /* Use glib's G_BYTE_ORDER == G_BIG_ENDIAN instead */
102 #if defined(__powerpc__) || defined(POWERPC)
109 #ifndef G_LITTLE_ENDIAN
110 #define G_LITTLE_ENDIAN
120 #ifdef __BIG_ENDIAN__
124 #ifdef __LITTLE_ENDIAN__
125 #define G_LITTLE_ENDIAN
128 #if !defined(G_BIG_ENDIAN) && !defined(G_LITTLE_ENDIAN)
129 #error "Either G_BIG_ENDIAN or G_LITTLE_ENDIAN should be defined."
132 #if defined(G_BIG_ENDIAN) && defined(G_LITTLE_ENDIAN)
133 #error "This is bizarre"
137 #if 0 /* These should be defined in the makefile */
138 #define DEBUG /* Generate debugging output */
139 #define DEBUG2 /* More detailed debugging output */
140 #define DEBUG3 /* Dump of TrueType outlines */
147 #define false 0 /**< standard false value */
148 #define true 1 /**< standard true value */
152 /* glib already deals with different compilers */
153 #include <glibconfig.h>
156 typedef gint16 F2Dot14; /**< fixed: 2.14 */
157 typedef gint32 F16Dot16; /**< fixed: 16.16 */
166 /** Return value of OpenTTFont() and CreateT3FromTTGlyphs() */
168 SF_OK, /**< no error */
169 SF_BADFILE, /**< file not found */
170 SF_FILEIO, /**< file I/O error */
171 SF_MEMORY, /**< memory allocation error */
172 SF_GLYPHNUM, /**< incorrect number of glyphs */
173 SF_BADARG, /**< incorrect arguments */
174 SF_TTFORMAT, /**< incorrect TrueType font format */
175 SF_TABLEFORMAT, /**< incorrect format of a TrueType table */
176 SF_FONTNO /**< incorrect logical font number of a TTC font */
179 #ifndef FW_THIN /* WIN32 compilation would conflict */
180 /** Value of the weight member of the TTGlobalFontInfo struct */
182 FW_THIN = 100, /**< Thin */
183 FW_EXTRALIGHT = 200, /**< Extra-light (Ultra-light) */
184 FW_LIGHT = 300, /**< Light */
185 FW_NORMAL = 400, /**< Normal (Regular) */
186 FW_MEDIUM = 500, /**< Medium */
187 FW_SEMIBOLD = 600, /**< Semi-bold (Demi-bold) */
188 FW_BOLD = 700, /**< Bold */
189 FW_EXTRABOLD = 800, /**< Extra-bold (Ultra-bold) */
190 FW_BLACK = 900 /**< Black (Heavy) */
193 /** Value of the width member of the TTGlobalFontInfo struct */
195 FWIDTH_ULTRA_CONDENSED = 1, /**< 50% of normal */
196 FWIDTH_EXTRA_CONDENSED = 2, /**< 62.5% of normal */
197 FWIDTH_CONDENSED = 3, /**< 75% of normal */
198 FWIDTH_SEMI_CONDENSED = 4, /**< 87.5% of normal */
199 FWIDTH_NORMAL = 5, /**< Medium, 100% */
200 FWIDTH_SEMI_EXPANDED = 6, /**< 112.5% of normal */
201 FWIDTH_EXPANDED = 7, /**< 125% of normal */
202 FWIDTH_EXTRA_EXPANDED = 8, /**< 150% of normal */
203 FWIDTH_ULTRA_EXPANDED = 9 /**< 200% of normal */
207 /** Type of the 'kern' table, stored in _TrueTypeFont::kerntype */
210 KT_NONE = 0, /**< no kern table */
211 KT_APPLE_NEW = 1, /**< new Apple kern table */
212 KT_MICROSOFT = 2 /**< Microsoft table */
215 /* Composite glyph flags definition */
216 enum CompositeFlags {
217 ARG_1_AND_2_ARE_WORDS = 1,
218 ARGS_ARE_XY_VALUES = 1<<1,
219 ROUND_XY_TO_GRID = 1<<2,
220 WE_HAVE_A_SCALE = 1<<3,
221 MORE_COMPONENTS = 1<<5,
222 WE_HAVE_AN_X_AND_Y_SCALE = 1<<6,
223 WE_HAVE_A_TWO_BY_TWO = 1<<7,
224 WE_HAVE_INSTRUCTIONS = 1<<8,
225 USE_MY_METRICS = 1<<9,
226 OVERLAP_COMPOUND = 1<<10
230 /** Flags for TrueType generation */
231 enum TTCreationFlags {
232 TTCF_AutoName = 1, /**< Automatically generate a compact 'name' table.
233 If this flag is not set, name table is generated
234 either from an array of NameRecord structs passed as
235 arguments or if the array is NULL, 'name' table
236 of the generated TrueType file will be a copy
237 of the name table of the original file.
238 If this flag is set the array of NameRecord structs
239 is ignored and a very compact 'name' table is automatically
242 TTCF_IncludeOS2 = 2 /** If this flag is set OS/2 table from the original font will be
243 copied to the subset */
247 /** Structure used by GetTTGlyphMetrics() */
248 /*- In horisontal writing mode right sidebearing is calculated using this formula
249 *- rsb = aw - (lsb + xMax - xMin) -*/
255 guint16 aw; /*- Advance Width (horisontal writing mode) */
256 gint16 lsb; /*- Left sidebearing (horisontal writing mode) */
257 guint16 ah; /*- advance height (vertical writing mode) */
258 gint16 tsb; /*- top sidebearing (vertical writing mode) */
262 /** Structure used by GetTTSimpleGlyphMetrics() and GetTTSimpleCharMetrics() functions */
264 guint16 adv; /**< advance width or height */
265 gint16 sb; /**< left or top sidebearing */
266 } TTSimpleGlyphMetrics;
268 /** Structure returned by ReadGlyphMetrics() */
272 } TTFullSimpleGlyphMetrics;
275 /** Structure used by the TrueType Creator and GetRawGlyphData() */
278 guint32 glyphID; /**< glyph ID */
279 guint16 nbytes; /**< number of bytes in glyph data */
280 guint8 *ptr; /**< pointer to glyph data */
281 guint16 aw; /**< advance width */
282 gint16 lsb; /**< left sidebearing */
283 guint16 compflag; /**< 0- if non-composite, 1- otherwise */
284 guint16 npoints; /**< number of points */
285 guint16 ncontours; /**< number of contours */
287 guint32 newID; /**< used internally by the TTCR */
292 /* STSF defines NameRecord and FUnitBBox structures in its own include file sttypes.h */
301 /** Structure used by the TrueType Creator and CreateTTFromTTGlyphs() */
303 guint16 platformID; /**< Platform ID */
304 guint16 encodingID; /**< Platform-specific encoding ID */
305 guint16 languageID; /**< Language ID */
306 guint16 nameID; /**< Name ID */
307 guint16 slen; /**< String length in bytes */
308 guint8 *sptr; /**< Pointer to string data (not zero-terminated!) */
314 /** Return value of GetTTGlobalFontInfo() */
317 char *family; /**< family name */
318 guint16 *ufamily; /**< family name UCS2 */
319 char *subfamily; /**< subfamily name */
320 char *psname; /**< PostScript name */
321 int weight; /**< value of WeightClass or 0 if can't be determined */
322 int width; /**< value of WidthClass or 0 if can't be determined */
323 int pitch; /**< 0: proportianal font, otherwise: monospaced */
324 int italicAngle; /**< in counter-clockwise degrees * 65536 */
325 guint16 fsSelection; /**< fsSelection field of OS/2 table */
326 int xMin; /**< global bounding box: xMin */
327 int yMin; /**< global bounding box: yMin */
328 int xMax; /**< global bounding box: xMax */
329 int yMax; /**< global bounding box: yMax */
330 int ascender; /**< typographic ascent. */
331 int descender; /**< typographic descent. */
332 int linegap; /**< typographic line gap.\ Negative values are treated as
333 zero in Win 3.1, System 6 and System 7. */
334 int vascent; /**< typographic ascent for vertical writing mode */
335 int vdescent; /**< typographic descent for vertical writing mode */
336 int typoAscender; /**< OS/2 portable typographic ascender */
337 int typoDescender; /**< OS/2 portable typographic descender */
338 int typoLineGap; /**< OS/2 portable typographc line gap */
339 int winAscent; /**< ascender metric for Windows */
340 int winDescent; /**< descender metric for Windows */
341 int symbolEncoded; /**< 1: MS symbol encoded 0: not symbol encoded */
342 int rangeFlag; /**< if set to 1 Unicode Range flags are applicable */
343 guint32 ur1; /**< bits 0 - 31 of Unicode Range flags */
344 guint32 ur2; /**< bits 32 - 63 of Unicode Range flags */
345 guint32 ur3; /**< bits 64 - 95 of Unicode Range flags */
346 guint32 ur4; /**< bits 96 - 127 of Unicode Range flags */
347 guint8 panose[10]; /**< PANOSE classification number */
348 guint16 typeFlags; /**< type flags (copyright information) */
351 /** Structure used by KernGlyphs() */
353 int x; /**< positive: right, negative: left */
354 int y; /**< positive: up, negative: down */
358 /** ControlPoint structure used by GetTTGlyphPoints() */
360 guint32 flags; /**< 00000000 00000000 e0000000 bbbbbbbb */
361 /**< b - guint8 flags from the glyf array */
362 /**< e == 0 - regular point */
363 /**< e == 1 - end contour */
364 gint16 x; /**< X coordinate in EmSquare units */
365 gint16 y; /**< Y coordinate in EmSquare units */
368 typedef struct _TrueTypeFont TrueTypeFont;
371 * @defgroup sft Sun Font Tools Exported Functions
376 * Get the number of fonts contained in a TrueType collection
377 * @param fname - file name
378 * @return number of fonts or zero, if file is not a TTC file.
381 int CountTTCFonts(const char* fname);
385 * TrueTypeFont constructor.
386 * Reads the font file and allocates the memory for the structure.
387 * @param facenum - logical font number within a TTC file. This value is ignored
389 * @return value of SFErrCodes enum
392 int OpenTTFont(const char *fname, guint32 facenum, TrueTypeFont**);
395 * TrueTypeFont destructor. Deallocates the memory.
398 void CloseTTFont(TrueTypeFont *);
401 * Extracts TrueType control points, and stores them in an allocated array pointed to
402 * by *pointArray. This function returns the number of extracted points.
404 * @param ttf pointer to the TrueTypeFont structure
405 * @param glyphID Glyph ID
406 * @param pointArray Return value - address of the pointer to the first element of the array
407 * of points allocated by the function
408 * @return Returns the number of points in *pointArray or -1 if glyphID is
413 int GetTTGlyphPoints(TrueTypeFont *ttf, guint32 glyphID, ControlPoint **pointArray);
416 * Extracts bounding boxes in normalized FUnits (1000/em) for all glyphs in the
417 * font and allocates an array of FUnitBBox structures. There are ttf->nglyphs
418 * elements in the array.
420 * @param ttf pointer to the TrueTypeFont structure
422 * @return an array of FUnitBBox structures with values normalized to 1000 UPEm
426 FUnitBBox *GetTTGlyphBoundingBoxes(TrueTypeFont *ttf);
429 * Extracts raw glyph data from the 'glyf' table and returns it in an allocated
430 * GlyphData structure.
432 * @param ttf pointer to the TrueTypeFont structure
433 * @param glyphID Glyph ID
435 * @return pointer to an allocated GlyphData structure or NULL if
436 * glyphID is not present in the font
440 GlyphData *GetTTRawGlyphData(TrueTypeFont *ttf, guint32 glyphID);
444 * For a specified glyph adds all component glyphs IDs to the list and
445 * return their number. If the glyph is a single glyph it has one component
446 * glyph (which is added to the list) and the function returns 1.
447 * For a composite glyphs it returns the number of component glyphs
448 * and adds all of them to the list.
450 * @param ttf pointer to the TrueTypeFont structure
451 * @param glyphID Glyph ID
452 * @param glyphlist list of glyphs
454 * @return number of component glyphs
458 int GetTTGlyphComponents(TrueTypeFont *ttf, guint32 glyphID, list glyphlist);
462 * Extracts all Name Records from the font and stores them in an allocated
463 * array of NameRecord structs
465 * @param ttf pointer to the TrueTypeFont struct
466 * @param nr pointer to the array of NameRecord structs
468 * @return number of NameRecord structs
472 int GetTTNameRecords(TrueTypeFont *ttf, NameRecord **nr);
475 * Deallocates previously allocated array of NameRecords.
477 * @param nr array of NameRecord structs
478 * @param n number of elements in the array
482 void DisposeNameRecords(NameRecord* nr, int n);
487 * Generates a new PostScript Type 3 font and dumps it to <b>outf</b> file.
488 * This functions subsititues glyph 0 for all glyphIDs that are not found in the font.
489 * @param ttf pointer to the TrueTypeFont structure
490 * @param outf the resulting font is written to this stream
491 * @param fname font name for the new font. If it is NULL the PostScript name of the
492 * original font will be used
493 * @param glyphArray pointer to an array of glyphs that are to be extracted from ttf
494 * @param encoding array of encoding values. encoding[i] specifies the position of the glyph
495 * glyphArray[i] in the encoding vector of the resulting Type3 font
496 * @param nGlyphs number of glyph IDs in glyphArray and encoding values in encoding
497 * @param wmode writing mode for the output file: 0 - horizontal, 1 - vertical
498 * @return return the value of SFErrCodes enum
503 int CreateT3FromTTGlyphs(TrueTypeFont *ttf, FILE *outf, const char *fname, guint16 *glyphArray, guint8 *encoding, int nGlyphs, int wmode);
508 * Generates a new TrueType font and dumps it to <b>outf</b> file.
509 * This functions subsititues glyph 0 for all glyphIDs that are not found in the font.
510 * @param ttf pointer to the TrueTypeFont structure
511 * @param fname file name for the output TrueType font file
512 * @param glyphArray pointer to an array of glyphs that are to be extracted from ttf. The first
513 * element of this array has to be glyph 0 (default glyph)
514 * @param encoding array of encoding values. encoding[i] specifies character code for
515 * the glyphID glyphArray[i]. Character code 0 usually points to a default
517 * @param nGlyphs number of glyph IDs in glyphArray and encoding values in encoding
518 * @param nNameRecs number of NameRecords for the font, if 0 the name table from the
519 * original font will be used
520 * @param nr array of NameRecords
521 * @param flags or'ed TTCreationFlags
522 * @return return the value of SFErrCodes enum
527 int CreateTTFromTTGlyphs(TrueTypeFont *ttf,
536 // the same, but to memory (output to out_buf, out_len)
537 int CreateTTFromTTGlyphs_tomemory
552 * Generates a new PostScript Type42 font and dumps it to <b>outf</b> file.
553 * This functions subsititues glyph 0 for all glyphIDs that are not found in the font.
554 * @param ttf pointer to the TrueTypeFont structure
555 * @param outf output stream for a resulting font
556 * @param psname PostScript name of the resulting font
557 * @param glyphArray pointer to an array of glyphs that are to be extracted from ttf. The first
558 * element of this array has to be glyph 0 (default glyph)
559 * @param encoding array of encoding values. encoding[i] specifies character code for
560 * the glyphID glyphArray[i]. Character code 0 usually points to a default
562 * @param nGlyphs number of glyph IDs in glyphArray and encoding values in encoding
563 * @return SF_OK - no errors
564 * SF_GLYPHNUM - too many glyphs (> 255)
565 * SF_TTFORMAT - corrupted TrueType fonts
571 int CreateT42FromTTGlyphs(TrueTypeFont *ttf,
580 * Queries full glyph metrics for one glyph
582 void GetTTGlyphMetrics(TrueTypeFont *ttf, guint32 glyphID, TTGlyphMetrics *metrics);
586 * Queries glyph metrics. Allocates an array of TTSimpleGlyphMetrics structs and returns it.
588 * @param ttf pointer to the TrueTypeFont structure
589 * @param glyphArray pointer to an array of glyphs that are to be extracted from ttf
590 * @param nGlyphs number of glyph IDs in glyphArray and encoding values in encoding
591 * @param mode writing mode: 0 - horizontal, 1 - vertical
595 TTSimpleGlyphMetrics *GetTTSimpleGlyphMetrics(TrueTypeFont *ttf, guint16 *glyphArray, int nGlyphs, int mode);
599 * Queries character metrics. Allocates an array of TTSimpleGlyphMetrics structs and returns it.
600 * This function behaves just like GetTTSimpleGlyphMetrics() but it takes a range of Unicode
601 * characters instead of an array of glyphs.
603 * @param ttf pointer to the TrueTypeFont structure
604 * @param firstChar Unicode value of the first character in the range
605 * @param nChars number of Unicode characters in the range
606 * @param mode writing mode: 0 - horizontal, 1 - vertical
608 * @see GetTTSimpleGlyphMetrics
612 TTSimpleGlyphMetrics *GetTTSimpleCharMetrics(TrueTypeFont *ttf, guint16 firstChar, int nChars, int mode);
615 * Maps a Unicode (UCS-2) string to a glyph array. Returns the number of glyphs in the array,
616 * which for TrueType fonts is always the same as the number of input characters.
618 * @param ttf pointer to the TrueTypeFont structure
619 * @param str pointer to a UCS-2 string
620 * @param nchars number of characters in <b>str</b>
621 * @param glyphArray pointer to the glyph array where glyph IDs are to be recorded.
623 * @return MapString() returns -1 if the TrueType font has no usable 'cmap' tables.
624 * Otherwise it returns the number of characters processed: <b>nChars</b>
626 * glyphIDs of TrueType fonts are 2 guint8 positive numbers. glyphID of 0 denotes a missing
627 * glyph and traditionally defaults to an empty square.
628 * glyphArray should be at least sizeof(guint16) * nchars bytes long. If glyphArray is NULL
629 * MapString() replaces the UCS-2 characters in str with glyphIDs.
633 int MapString(TrueTypeFont *ttf, guint16 *str, int nchars, guint16 *glyphArray, int bvertical);
635 int MapString(TrueTypeFont *ttf, guint16 *str, int nchars, guint16 *glyphArray);
639 * Maps a Unicode (UCS-2) character to a glyph ID and returns it. Missing glyph has
640 * a glyphID of 0 so this function can be used to test if a character is encoded in the font.
642 * @param ttf pointer to the TrueTypeFont structure
643 * @param ch Unicode (UCS-2) character
644 * @return glyph ID, if the character is missing in the font, the return value is 0.
648 guint16 MapChar(TrueTypeFont *ttf, guint16 ch, int bvertical);
650 guint16 MapChar(TrueTypeFont *ttf, guint16 ch);
655 * Returns global font information about the TrueType font.
656 * @see TTGlobalFontInfo
658 * @param ttf pointer to a TrueTypeFont structure
659 * @param info pointer to a TTGlobalFontInfo structure
663 void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info);
666 * Returns kerning information for an array of glyphs.
667 * Kerning is not cumulative.
668 * kern[i] contains kerning information for a pair of glyphs at positions i and i+1
670 * @param ttf pointer to a TrueTypeFont structure
671 * @param glyphs array of source glyphs
672 * @param nglyphs number of glyphs in the array
673 * @param wmode writing mode: 0 - horizontal, 1 - vertical
674 * @param kern array of KernData structures. It should contain nglyphs-1 elements
679 void KernGlyphs(TrueTypeFont *ttf, guint16 *glyphs, int nglyphs, int wmode, KernData *kern);
682 * Returns nonzero if font is a symbol encoded font
684 int CheckSymbolEncoding(TrueTypeFont* ttf);
687 * Extracts a 'cmap' table from a font, allocates memory for it and returns a pointer to it.
688 * DEPRECATED - use ExtractTable instead
691 guint8 *ExtractCmap(TrueTypeFont *ttf);
695 * Extracts a table from a font, allocates memort for it and returns a pointer to it.
697 guint8 *ExtractTable(TrueTypeFont *ttf, guint32 tag);
700 * Returns a pointer to the table but does not allocate memory for it.
702 const guint8 *GetTable(TrueTypeFont *ttf, guint32 tag);
705 * Functions that do not use TrueTypeFont structure
706 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
710 * Reads full (vertical and horisontal) glyph metrics for an array of glyphs from hmtx and vmtx tables
712 * @param hmtx TrueType hmtx table
713 * @param vmtx TrueType vmtx table
714 * @param hcount numberOfHMetrics value
715 * @param vcount numOfLongVerMetrics value
716 * @param gcount total number of glyphs in the font
717 * @param UPEm units per Em value
718 * @param glyphArray array of source glyph IDs
719 * @param nGlyphs number of glyphs in the glyphArray array
721 * @return array of TTFullSimpleGlyphMetrics data structures
725 TTFullSimpleGlyphMetrics *ReadGlyphMetrics(guint8 *hmtx, guint8 *vmtx, int hcount, int vcount, int gcount, int UPEm, guint16 *glyphArray, int nGlyphs);
727 void ReadSingleGlyphMetrics(guint8 *hmtx, guint8 *vmtx, int hcount, int vcount, int gcount, int UPEm, guint16 glyphID, TTFullSimpleGlyphMetrics *metrics);
731 * Returns the length of the 'kern' subtable
733 * @param kern pointer to the 'kern' subtable
735 * @return number of bytes in it
737 guint32 GetKernSubtableLength(guint8 *kern);
740 * Kerns a pair of glyphs.
742 * @param kerntype type of the kern table
743 * @param nkern number of kern subtables
744 * @param kern array of pointers to kern subtables
745 * @pram unitsPerEm units per Em value
746 * @param wmode writing mode: 0 - horizontal, 1 - vertical
747 * @param a ID of the first glyoh
748 * @param b ID of the second glyoh
749 * @param x X-axis kerning value is returned here
750 * @param y Y-axis kerning value is returned here
752 void KernGlyphPair(int kerntype, guint32 nkern, guint8 **kern, int unitsPerEm, int wmode, guint32 a, guint32 b, int *x, int *y);
756 /*- private definitions */ /*FOLD00*/
758 struct _TrueTypeFont {
771 guint32 tdoffset; /* offset to the table directory (!= 0 for TrueType collections) */
775 int numberOfHMetrics;
776 int numOfLongVerMetrics; /* if this number is not 0, font has vertical metrics information */
779 guint16 (*mapper)(const guint8 *, guint16); /* character to glyphID translation function */
780 void **tables; /* array of pointers to tables */
781 guint32 *tlens; /* array of table lengths */
782 int kerntype; /* Defined in the KernType enum */
783 guint32 nkern; /* number of kern subtables */
784 guint8 **kerntables; /* array of pointers to kern subtables */
786 void *pGSubstitution; /* info provided by GSUB for UseGSUB() */
794 #endif /* __SUBFONT_H */