home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: SysTools / SysTools.zip / ft-beta.zip / freetype / lib / tttables.h < prev    next >
C/C++ Source or Header  |  1997-10-06  |  7KB  |  310 lines

  1. /*******************************************************************
  2.  *
  3.  *  tttables.h                                                  1.1
  4.  *
  5.  *    TrueType Tables structures and handling (specification).
  6.  *
  7.  *  Copyright 1996, 1997 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. #ifndef TTTABLES_H
  19. #define TTTABLES_H
  20.  
  21. #include "tttypes.h"
  22.  
  23.   #ifdef __cplusplus
  24.   extern "C" {
  25.   #endif
  26.  
  27.   /***********************************************************************/
  28.   /*                                                                     */
  29.   /*                      TrueType Table Types                           */
  30.   /*                                                                     */
  31.   /***********************************************************************/
  32.  
  33.   /* TrueType Collection Header */
  34.  
  35.   typedef struct  _TTTCHeader
  36.   {
  37.     Long      Tag;
  38.     TT_Fixed  version;
  39.     ULong     DirCount;
  40.     PULong    TableDirectory;
  41.   } TTTCHeader;
  42.  
  43.   typedef TTTCHeader*  PTTCHeader;
  44.  
  45.   /* TrueType Table Directory type */
  46.  
  47.   typedef struct  _TTableDir
  48.   {
  49.     TT_Fixed  version;      /* should be 0x10000 */
  50.     UShort    numTables;    /* number of tables  */
  51.  
  52.     UShort  searchRange;    /* These parameters are only used  */
  53.     UShort  entrySelector;  /* for a dichotomy search in the   */
  54.     UShort  rangeShift;     /* directory. We ignore them.      */
  55.   } TTableDir;
  56.  
  57.   typedef TTableDir*  PTableDir;
  58.  
  59.   /* The 'TableDir' is followed by 'numTables' TableDirEntries */
  60.  
  61.   typedef struct  _TTableDirEntry
  62.   {
  63.     Long  Tag;        /*        table type */
  64.     Long  CheckSum;   /*    table checksum */
  65.     Long  Offset;     /* table file offset */
  66.     Long  Length;     /*      table length */
  67.   } TTableDirEntry;
  68.  
  69.   typedef TTableDirEntry*  PTableDirEntry;
  70.  
  71.   /* 'cmap' tables */
  72.  
  73.   typedef struct  _TCMapDir
  74.   {
  75.     UShort  tableVersionNumber;
  76.     UShort  numCMaps;
  77.   } TCMapDir;
  78.  
  79.   typedef TCMapDir*  PCMapDir;
  80.  
  81.   typedef struct  _TCMapDirEntry
  82.   {
  83.     UShort  platformID;
  84.     UShort  platformEncodingID;
  85.     Long    offset;
  86.   } TCMapDirEntry;
  87.  
  88.   typedef TCMapDirEntry*  PCMapDirEntries;
  89.  
  90.  
  91.   /* 'maxp' Maximum Profiles table */
  92.  
  93.   typedef struct  _TMaxProfile
  94.   {
  95.     TT_Fixed  version;
  96.     UShort    numGlyphs,
  97.               maxPoints,
  98.               maxContours,
  99.               maxCompositePoints,
  100.               maxCompositeContours,
  101.               maxZones,
  102.               maxTwilightPoints,
  103.               maxStorage,
  104.               maxFunctionDefs,
  105.               maxInstructionDefs,
  106.               maxStackElements,
  107.               maxSizeOfInstructions,
  108.               maxComponentElements,
  109.               maxComponentDepth;
  110.   } TMaxProfile;
  111.  
  112.   typedef TMaxProfile*  PMaxProfile;
  113.  
  114.  
  115.   /* table "gasp" */
  116.  
  117.   #define GASP_GRIDFIT  0x01
  118.   #define GASP_DOGRAY   0x02
  119.  
  120.   typedef struct  _GaspRange
  121.   {
  122.     UShort  maxPPEM;
  123.     UShort  gaspFlag;
  124.   } GaspRange;
  125.  
  126.   typedef struct  _TGasp
  127.   {
  128.     UShort      version;
  129.     UShort      numRanges;
  130.     GaspRange*  gaspRanges;
  131.   } TGasp;
  132.  
  133.  
  134.   /* table "head" - now defined in freetype.h */
  135.  
  136.   /*
  137.   typedef struct  _TLongDateTime
  138.   {
  139.     Long  l1;
  140.     Long  l2;
  141.   } TLongDateTime;
  142.  
  143.   typedef struct  _THeader
  144.   {
  145.     TT_Fixed  Table_Version;
  146.     TT_Fixed  Font_Revision;
  147.  
  148.     Long      CheckSum_Adjust;
  149.     Long      Magic_Number;
  150.  
  151.     UShort    Flags;
  152.     UShort    Units_Per_EM;
  153.  
  154.     TLongDateTime  Created, Modified;
  155.  
  156.     Short     xMin;
  157.     Short     yMin;
  158.     Short     xMax;
  159.     Short     yMax;
  160.  
  161.     UShort    Mac_Style;
  162.     UShort    Lowest_Rec_PPEM;
  163.  
  164.     Short     Font_Direction;
  165.     Short     Index_To_Loc_Format;
  166.     Short     Glyph_Data_Format;
  167.   } THeader;
  168.   */
  169.  
  170.   /* table "hhea" - now defined in freetype.h */
  171.  
  172.   /*
  173.   typedef struct _THorizontalHeader
  174.   {
  175.     Fixed   Version;
  176.     Short   Ascender;
  177.     Short   Descender;
  178.     Short   Line_Gap;
  179.  
  180.     UShort  advance_Width_Max;
  181.  
  182.     Short   min_Left_Side_Bearing;
  183.     Short   min_Right_Side_Bearing;
  184.     Short   xMax_Extent;
  185.     Short   caret_Slope_Rise;
  186.     Short   caret_Slope_Run;
  187.  
  188.     Short   Reserved[5];
  189.  
  190.     Short   metric_Data_Format;
  191.     UShort  number_Of_HMetrics;
  192.   } THorizontalHeader;
  193.   */
  194.  
  195.   /* table "HMTX" */
  196.  
  197.   typedef struct  _TLongHorMetric
  198.   {
  199.     UShort  advance_Width;
  200.     Short   lsb;
  201.   } TLongHorMetric;
  202.  
  203.   typedef TLongHorMetric*  PTableHorMetrics;
  204.  
  205.  
  206.   /* 'OS/2' table - now defined in freetype.h */
  207.  
  208.   /*
  209.   typedef struct _TOS2_Table
  210.   {
  211.     UShort  version;               
  212.     Short   xAvgCharWidth;
  213.     UShort  usWeightClass;
  214.     UShort  usWidthClass;
  215.     Short   fsType;
  216.     Short   ySubscriptXSize;
  217.     Short   ySubscriptYSize;
  218.     Short   ySubscriptXOffset;
  219.     Short   ySubscriptYOffset;
  220.     Short   ySuperscriptXSize;
  221.     Short   ySuperscriptYSize;
  222.     Short   ySuperscriptXOffset;
  223.     Short   ySuperscriptYOffset;
  224.     Short   yStrikeoutSize;
  225.     Short   yStrikeoutPosition;
  226.     Short   sFamilyClass;
  227.     Byte    panose[10];
  228.     ULong   ulUnicodeRange1;       
  229.     ULong   ulUnicodeRange2;       
  230.     ULong   ulUnicodeRange3;       
  231.     ULong   ulUnicodeRange4;       
  232.     Byte    achVendID[4];
  233.     UShort  fsSelection;
  234.     UShort  usFirstCharIndex;
  235.     UShort  usLastCharIndex;
  236.     UShort  sTypoAscender;
  237.     UShort  sTypoDescender;
  238.     UShort  sTypoLineGap;
  239.     UShort  usWinAscent;
  240.     UShort  usWinDescent;
  241.  
  242.     ULong   ulCodePageRange1;      
  243.     ULong   ulCodePageRange2;      
  244.   } TOS2_Table;
  245.  
  246.   typedef TOS2_Table *  POS2_Table;
  247.   */
  248.  
  249.   /* "post" table - now defined in freetype.h */
  250.  
  251.   /*
  252.   typedef struct _TPostscript
  253.   {
  254.     TT_Fixed  FormatType;
  255.     TT_Fixed  italicAngle;
  256.     Short     underlinePosition;
  257.     Short     underlineThickness;
  258.     ULong     isFixedPitch;
  259.     ULong     minMemType42;
  260.     ULong     maxMemType42;
  261.     ULong     minMemType1;
  262.     ULong     maxMemType1;
  263.   } TPostscript;
  264.  
  265.   typedef TPostscript  *PPostscript;
  266.   */
  267.  
  268.   /* 'loca' location table type */
  269.  
  270.   typedef struct _TLoca
  271.   {
  272.     UShort    Size;
  273.     PStorage  Table;
  274.   } TLoca;
  275.  
  276.   /* table "name" */
  277.  
  278.   typedef struct  _TNameRec
  279.   {
  280.     UShort  platformID;
  281.     UShort  encodingID;
  282.     UShort  languageID;
  283.     UShort  nameID;
  284.     UShort  stringLength;
  285.     UShort  stringOffset;
  286.  
  287.     /* this last field is not defined in the spec */
  288.     /* but used by the FreeType engine            */
  289.  
  290.     PByte   string;
  291.   } TNameRec;
  292.  
  293.   typedef struct  _TName_Table
  294.   {
  295.     UShort     format;
  296.     UShort     numNameRecords;
  297.     UShort     storageOffset;
  298.     TNameRec*  names;
  299.     PByte      storage;
  300.   } TName_Table;
  301.  
  302.  
  303.   #ifdef __cplusplus
  304.   }
  305.   #endif
  306.  
  307. #endif /* TTTABLES_H */
  308.  
  309. /* End */
  310.