Back to index

texmacs  1.0.7.15
tt_table.h
Go to the documentation of this file.
00001 /*  $Header: /home/cvsroot/dvipdfmx/src/tt_table.h,v 1.8 2008/11/30 21:12:27 matthias Exp $
00002     
00003     This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
00004 
00005     Copyright (C) 2007 by Jin-Hwan Cho and Shunsaku Hirata,
00006     the dvipdfmx project team <dvipdfmx@project.ktug.or.kr>
00007     
00008     This program is free software; you can redistribute it and/or modify
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or
00011     (at your option) any later version.
00012     
00013     This program is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016     GNU General Public License for more details.
00017     
00018     You should have received a copy of the GNU General Public License
00019     along with this program; if not, write to the Free Software
00020     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00021 */
00022 
00023 #ifndef _TT_TABLE_H_
00024 #define _TT_TABLE_H_
00025 
00026 #include "sfnt.h"
00027 
00028 #define TT_HEAD_TABLE_SIZE 54UL
00029 #define TT_MAXP_TABLE_SIZE 32UL
00030 #define TT_HHEA_TABLE_SIZE 36UL
00031 #define TT_VHEA_TABLE_SIZE 36UL
00032 
00033 struct tt_head_table
00034 {
00035   Fixed  version;
00036   Fixed  fontRevision;
00037   ULONG  checkSumAdjustment;
00038   ULONG  magicNumber;
00039   USHORT flags;
00040   USHORT unitsPerEm;
00041   BYTE   created[8];
00042   BYTE   modified[8];
00043   FWord  xMin, yMin, xMax, yMax;
00044   USHORT macStyle;
00045   USHORT lowestRecPPEM;
00046   SHORT  fontDirectionHint;
00047   SHORT  indexToLocFormat;
00048   SHORT  glyphDataFormat;
00049 };
00050 
00051 struct tt_hhea_table
00052 {
00053   Fixed  version;
00054   FWord  ascent;
00055   FWord  descent;
00056   FWord  lineGap;
00057   uFWord advanceWidthMax;
00058   FWord  minLeftSideBearing;
00059   FWord  minRightSideBearing;
00060   FWord  xMaxExtent;
00061   SHORT  caretSlopeRise;
00062   SHORT  caretSlopeRun;
00063   FWord  caretOffset;
00064   SHORT  reserved[4]; /* set to 0 */
00065   SHORT  metricDataFormat;
00066   USHORT numOfLongHorMetrics;
00067   USHORT numOfExSideBearings; /* extra information */
00068 };
00069 
00070 struct tt_vhea_table
00071 {
00072   Fixed  version;
00073   SHORT  vertTypoAscender;  /* v.1.1 name */
00074   SHORT  vertTypoDescender; /* v.1.1 name */
00075   SHORT  vertTypoLineGap;   /* v.1.1 name */ 
00076   SHORT  advanceHeightMax;
00077   SHORT  minTopSideBearing;
00078   SHORT  minBottomSideBearing;
00079   SHORT  yMaxExtent;
00080   SHORT  caretSlopeRise;
00081   SHORT  caretSlopeRun;
00082   SHORT  caretOffset;
00083   SHORT  reserved[4]; /* set to 0 */
00084   SHORT  metricDataFormat;
00085   USHORT numOfLongVerMetrics;
00086   USHORT numOfExSideBearings; /* extra information */
00087 };
00088 
00089 struct tt_maxp_table
00090 {
00091   Fixed  version;
00092   USHORT numGlyphs;
00093   USHORT maxPoints;
00094   USHORT maxContours;
00095   USHORT maxComponentPoints;
00096   USHORT maxComponentContours;
00097   USHORT maxZones;
00098   USHORT maxTwilightPoints;
00099   USHORT maxStorage;
00100   USHORT maxFunctionDefs;
00101   USHORT maxInstructionDefs;
00102   USHORT maxStackElements;
00103   USHORT maxSizeOfInstructions;
00104   USHORT maxComponentElements;
00105   USHORT maxComponentDepth;
00106 };
00107 
00108 struct tt_os2__table
00109 {
00110   USHORT  version; /* 0x0001 or 0x0002 */
00111   SHORT   xAvgCharWidth;  
00112   USHORT  usWeightClass;  
00113   USHORT  usWidthClass;   
00114   SHORT   fsType;  /* if (faType & 0x08) editable_embedding */
00115   SHORT   ySubscriptXSize;        
00116   SHORT   ySubscriptYSize;      
00117   SHORT   ySubscriptXOffset;
00118   SHORT   ySubscriptYOffset;      
00119   SHORT   ySuperscriptXSize;      
00120   SHORT   ySuperscriptYSize;      
00121   SHORT   ySuperscriptXOffset;    
00122   SHORT   ySuperscriptYOffset;    
00123   SHORT   yStrikeoutSize; 
00124   SHORT   yStrikeoutPosition;     
00125   SHORT   sFamilyClass;   
00126   BYTE    panose[10];
00127   ULONG   ulUnicodeRange1;
00128   ULONG   ulUnicodeRange2;
00129   ULONG   ulUnicodeRange3;
00130   ULONG   ulUnicodeRange4;
00131   CHAR    achVendID[4];   
00132   USHORT  fsSelection;    
00133   USHORT  usFirstCharIndex;
00134   USHORT  usLastCharIndex;
00135   SHORT   sTypoAscender;  /* TTF spec. from MS is wrong */
00136   SHORT   sTypoDescender; /* TTF spec. from MS is wrong */
00137   SHORT   sTypoLineGap;   /* TTF spec. from MS is wrong */
00138   USHORT  usWinAscent;   
00139   USHORT  usWinDescent;    
00140   ULONG   ulCodePageRange1;
00141   ULONG   ulCodePageRange2;
00142   /* version 0x0002 */
00143   SHORT   sxHeight;
00144   SHORT   sCapHeight;
00145   USHORT  usDefaultChar;
00146   USHORT  usBreakChar;
00147   USHORT  usMaxContext;
00148 };
00149 
00150 struct tt_vertOriginYMetrics {
00151   USHORT glyphIndex;
00152   SHORT  vertOriginY;
00153 };
00154 
00155 struct tt_VORG_table {
00156   SHORT  defaultVertOriginY;
00157   USHORT numVertOriginYMetrics;
00158   struct tt_vertOriginYMetrics *vertOriginYMetrics;
00159 };
00160 
00161 /* hmtx and vmtx */
00162 struct tt_longMetrics
00163 {
00164   USHORT advance;
00165   SHORT  sideBearing;
00166 };
00167 
00168 
00169 /* head, hhea, maxp */
00170 extern char  *tt_pack_head_table (struct tt_head_table *table);
00171 extern struct tt_head_table *tt_read_head_table (sfnt *sfont);
00172 extern char  *tt_pack_hhea_table (struct tt_hhea_table *table);
00173 extern struct tt_hhea_table *tt_read_hhea_table (sfnt *sfont);
00174 extern char  *tt_pack_maxp_table (struct tt_maxp_table *table);
00175 extern struct tt_maxp_table *tt_read_maxp_table (sfnt *sfont);
00176 
00177 /* vhea */
00178 #if 0
00179 extern char  *tt_pack_vhea_table (struct tt_vhea_table *table);
00180 #endif
00181 extern struct tt_vhea_table *tt_read_vhea_table (sfnt *sfont);
00182 
00183 /* VORG */
00184 extern struct tt_VORG_table *tt_read_VORG_table (sfnt *sfont);
00185 
00186 /* hmtx and vmtx */
00187 extern struct tt_longMetrics *tt_read_longMetrics (sfnt *sfont,
00188                                              USHORT numGlyphs, USHORT numLongMetrics, USHORT numExSideBearings);
00189 
00190 /* OS/2 table */
00191 extern struct tt_os2__table *tt_read_os2__table (sfnt *sfont);
00192 
00193 /* name table */
00194 extern USHORT tt_get_name (sfnt *sfont, char *dest, USHORT destlen,
00195                         USHORT plat_id, USHORT enco_id,
00196                         USHORT lang_id, USHORT name_id);
00197 extern USHORT tt_get_ps_fontname (sfnt *sfont, char *dest, USHORT destlen);
00198 
00199 #endif /* _TT_TABLE_H_ */