Main Page   Modules   Alphabetical List   Compound List   File List   Compound Members   File Members  

fontmetric.h

Go to the documentation of this file.
00001 /*  $Id: fontmetric.h,v 1.6 2000/12/02 07:26:03 dbryson Exp $
00002 **
00003 **  Copyright (c) 2000 Derry Bryson <derry@techass.com>
00004 **
00005 **  Description:
00006 **  
00007 **    Postscript Library
00008 **
00009 **
00010 **  License:
00011 **
00012 **    This library is free software; you can redistribute it and/or
00013 **    modify it under the terms of the GNU Lesser General Public
00014 **    License as published by the Free Software Foundation; either
00015 **    version 2.1 of the License, or (at your option) any later version.
00016 **
00017 **    This library is distributed in the hope that it will be useful,
00018 **    but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 **    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020 **    Lesser General Public License for more details.
00021 **
00022 **    You should have received a copy of the GNU Lesser General Public
00023 **    License along with this library; if not, write to the Free Software
00024 **    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 **
00026 **
00027 **  Contact:
00028 **
00029 **      Mail:
00030 **
00031 **        Technology Associates, Inc.
00032 **        LIBPS Project
00033 **        1455 Deming Way #11
00034 **        Sparks, NV  89431
00035 **        USA
00036 **
00037 **      Email:
00038 **
00039 **        libps@techass.com
00040 **
00041 **      See our website at:
00042 **
00043 **        libps.sourceforge.net
00044 **
00045 */
00046 
00050 #ifndef INCLUDE_FONTMETRIC
00051 #define INCLUDE_FONTMETRIC
00052 
00053 #ifdef __cplusplus
00054 extern "C" {
00055 #endif
00056 
00057 /******************************************************************************
00058 ****  DEFINES  ****************************************************************
00059 ******************************************************************************/
00060 
00061 #ifdef PSCOMPILINGLIB
00062 
00063 /*
00064 **  AFM keys
00065 */
00066 #define PSAFM_COMMENT                   "Comment"
00067 #define PSAFM_STARTFONTMETRICS          "StartFontMetrics"
00068 #define PSAFM_ENDFONTMETRICS            "EndFontMetrics"
00069 #define PSAFM_METRICSETS                "MetricSets"
00070 #define PSAFM_FONTNAME                  "FontName"
00071 #define PSAFM_FULLNAME                  "FullName"
00072 #define PSAFM_FAMILYNAME                "FamilyName"
00073 #define PSAFM_WEIGHT                    "Weight"
00074 #define PSAFM_FONTBBOX                  "FontBBox"
00075 #define PSAFM_VERSION                   "Version"
00076 #define PSAFM_NOTICE                    "Notice"
00077 #define PSAFM_ENCODINGSCHEME            "EncodingScheme"
00078 #define PSAFM_MAPPINGSCHEME             "MappingScheme"
00079 #define PSAFM_ESCCHAR                   "EscChar"
00080 #define PSAFM_CHARACTERSET              "CharacterSet"
00081 #define PSAFM_CHARACTERS                "Characters"
00082 #define PSAFM_ISBASEFONT                "IsBaseFont"
00083 #define PSAFM_VVECTOR                   "VVector"
00084 #define PSAFM_ISFIXEDV                  "IsFixedV"
00085 #define PSAFM_CAPHEIGHT                 "CapHeight"
00086 #define PSAFM_XHEIGHT                   "XHeight"
00087 #define PSAFM_ASCENDER                  "Ascender"
00088 #define PSAFM_DESCENDER                 "Descender"
00089 #define PSAFM_STARTDIRECTION            "StartDirection"
00090 #define PSAFM_ENDDIRECTION              "EndDirection"
00091 #define PSAFM_UNDERLINEPOSITION         "UnderlinePosition"
00092 #define PSAFM_UNDERLINETHICKNESS        "UnderlineThickness"
00093 #define PSAFM_ITALICANGLE               "ItalicAngle"
00094 #define PSAFM_CHARWIDTH                 "CharWidth"
00095 #define PSAFM_ISFIXEDPITCH              "IsFixedPitch"
00096 #define PSAFM_STARTCHARMETRICS          "StartCharMetrics"
00097 #define PSAFM_ENDCHARMETRICS            "EndCharMetrics"
00098 #define PSAFM_STARTKERNINGDATA          "StartKernData"
00099 #define PSAFM_STARTKERNPAIRS            "StartKernPairs"
00100 #define PSAFM_ENDKERNPAIRS              "EndKernPairs"
00101 #define PSAFM_STARTKERNPAIRS0           "StartKernPairs0"
00102 #define PSAFM_STARTKERNPAIRS1           "StartKernPairs1"
00103 #define PSAFM_ENDKERNINGDATA            "EndKernData"
00104 #define PSAFM_STARTTRACKKERN            "StartTrackKern"
00105 #define PSAFM_ENDTRACKKERN              "EndTrackKern"
00106 #define PSAFM_STARTCOMPOSITES           "StartComposites"
00107 #define PSAFM_ENDCOMPOSITES             "EndComposites"
00108 #define PSAFM_STARTCOMPFONTMETRICS      "StartCompFontMetrics"
00109 #define PSAFM_ENDCOMPFONTMETRICS        "EndCompFontMetrics"
00110 #define PSAFM_DESCENDENTS               "Descendents"
00111 #define PSAFM_STARTDESCENDENT           "StartDescendent"
00112 #define PSAFM_ENDDESCENDENT             "EndDescendent"
00113 #define PSAFM_STARTMASTERFONTMETRICS    "StartMasterFontMetrics"
00114 #define PSAFM_ENDMASTERFONTMETRICS      "EndMasterFontMetrics"
00115 #define PSAFM_MASTERS                   "Masters"
00116 #define PSAFM_AXES                      "Axes"
00117 #define PSAFM_WEIGHTVECTOR              "WeightVector"
00118 #define PSAFM_BLENDDESIGNPOSITIONS      "BlendDesignPositions"
00119 #define PSAFM_BLENDDESIGNMAP            "BlendDesignMap"
00120 #define PSAFM_BLENDAXISTYPES            "BlendAxisTypes"
00121 #define PSAFM_STARTAXIS                 "StartAxis"
00122 #define PSAFM_ENDAXIS                   "EndAxis"
00123 #define PSAFM_AXISTYPE                  "AxisType"
00124 #define PSAFM_AXISLABEL                 "AxisLabel"
00125 #define PSAFM_STARTMASTER               "StartMaster"
00126 #define PSAFM_ENDMASTER                 "EndMaster"
00127 #define PSAFM_STARTPRIMARYFONTS         "StartPrimaryFonts"
00128 #define PSAFM_ENDPRIMARYFONTS           "EndPrimaryFonts"
00129 
00130 #define PSAFM_TRUE                      "true"
00131 #define PSAFM_FALSE                     "false"
00132 
00133 /*
00134 **  Stuff for the AFM file parser
00135 */
00136 #define LINEBUFSIZE                     1024
00137 
00138 /*
00139 **  AFM Parser states
00140 */
00141 #define AFM_STATE_START                 0
00142 #define AFM_STATE_GLOBAL                1
00143 #define AFM_STATE_DIRECTION             2
00144 #define AFM_STATE_CHARMETRIC            3
00145 #define AFM_STATE_KERNING               4
00146 #define AFM_STATE_COMPOSITES            5
00147 #define AFM_STATE_DONE                  6
00148 
00149 #endif /* PSCOMPILINGLIB */
00150 
00151 /******************************************************************************
00152 ****  TYPEDEFS  ***************************************************************
00153 ******************************************************************************/
00154 
00159 typedef struct psAFMDirection
00160 {
00161   double
00162     underlinePosition,          
00163     underlineThickness,         
00164     italicAngle,                
00165     charWidth[2];               
00167   int
00168     isFixedPitch;               
00169 } PSAFMDirection;
00179 typedef struct psAFMCharMetric
00180 {
00181   //
00182   //  There is more stuff that maybe should be here, but we don't
00183   //  use it so leave it out to save space.
00184   //
00185   int
00186     code;                       
00188   char
00189     *name;                      
00191   double
00192     wx;                         
00193 } PSAFMCharMetric;
00203 typedef struct psAFM
00204 {
00205   char 
00206     *fontName,                  
00207     *fullName,                  
00208     *familyName,                
00209     *weight,                    
00210     *version,                   
00211     *notice,                    
00212     *encodingScheme,            
00213     *escChar,                   
00214     *characterSet;              
00216   int
00217     metricsSets,                
00218     mappingScheme,              
00219     characters,                 
00220     numCharMetrics,             
00221     isBaseFont,                 
00222     isFixedV;                   
00224   double
00225     fontBBox[4],                
00226     vVector[2],                 
00227     capHeight,                  
00228     xHeight,                    
00229     ascender,                   
00230     descender;                  
00232   PSAFMDirection
00233     directions[3];              
00235   PSAFMCharMetric
00236     *charMetrics;               
00237 } PSAFM;
00243 /******************************************************************************
00244 ****  FUNCTION PROTOTYPES  ****************************************************
00245 ******************************************************************************/
00246 
00247 /*
00248 **  PSAFMDirection (fontmetric.c)
00249 */
00250 int PSAFMDirectionSize(void);
00251 PSAFMDirection* psAFMDirectionAlloc(void);
00252 PSAFMDirection* psAFMDirectionCalloc(int count);
00253 void psAFMDirectionFree(PSAFMDirection* d);
00254 
00255 /*
00256 **  PSAFMCharMetric (fontmetric.c)
00257 */
00258 int PSAFMCharMetricSize(void);
00259 PSAFMCharMetric* psAFMCharMetricAlloc(void);
00260 PSAFMCharMetric* psAFMCharMetricCalloc(int count);
00261 void psAFMCharMetricFree(PSAFMCharMetric* cm);
00262 
00263 /*
00264 **  PSAFM (fontmetric.c)
00265 */
00266 int PSAFMSize(void);
00267 PSAFM* psAFMAlloc(void);
00268 PSAFM* psAFMCalloc(int count);
00269 void psAFMFree(PSAFM* fm);
00270 
00271 PSAFMCharMetric* psAFMLookupCharMetricByCode(PSAFM* fm, int code);
00272 PSAFMCharMetric* psAFMLookupCharMetricByName(PSAFM* fm, char *name);
00273 double psAFMGetTextWidth(PSAFM* fm, char* text);
00274 
00275 PSAFM* psAFMLoad(char *fileName);
00276 PSAFM* psAFMParse(PSStream* str);
00277 
00278 int psAFMGetPSWeight(PSAFM* fm);
00279 int psAFMGetPSWidth(PSAFM* fm);
00280 int psAFMGetPSItalic(PSAFM* fm);
00281 
00282 #ifdef __cplusplus
00283 }
00284 #endif
00285 
00286 #endif /* INCLUDE_FONTMETRIC */

Generated at Mon Dec 11 22:46:27 2000 for Postscript Utility Library by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000