ftp.nice.ch/pub/next/developer/languages/c/gcc.2.7.2.2.I.b.tar.gz#/lib/gcc-lib/i386-next-nextstep3/2.7.2.2.f.2/include/appkit/afm.h

This is afm.h in view mode; [Download] [Up]

/*
	afm.h
	Application Kit, Release 3.1
	Copyright (c) 1988, 1989, 1990, NeXT, Inc.  All rights reserved. 
*/

#ifndef AFM_H
#define AFM_H

/* font attributes to ask the server for */

#define NX_FONTHEADER		1
#define NX_FONTMETRICS		2
#define NX_FONTWIDTHS		4
#define NX_FONTCHARDATA		8
#define NX_FONTKERNING		16
#define NX_FONTCOMPOSITES	32

#ifdef KANJI
#define NX_BASEFONTMAPPING  -1
#define NX_88MAPPING         2
#define NX_ESCAPEMAPPING     3	/* not implemented */
#define NX_17MAPPING         4
#define NX_97MAPPING         5
#define NX_SUBSVECTORMAPPING 6	/* not implemented */

/* The following defines are for EUC Japanese encodings.*/
/* The "GR" encoding may change after the Alpha version.*/
#define NX_SS2 (0x8e)
#define NX_GR (0xa0)
/* The following macro computes character width from character code & font metrics information.*/
#define NX_WCHARWIDTH(fm,code) \
        ( fm->isBaseFont ? \
        (fm->widths[(code)&0xff]) + ((code)&0xFF00 ? fm->widths[((code)>>8)&0xff] : 0.0) : \
        ((!((code)&0xff00)&&((code)&0x80)) ? \
        (fm->widths[(fm->widthsIndex[NX_GR]<<8)|((code)&0xff)]) : \
        (fm->widths[(fm->widthsIndex[((code)>>8)&0xff]<<8)|((code)&0xff)])))
#endif

typedef struct {	/* per character info */
    short charCode;		/* character code, -1 if unencoded */
    unsigned char numKernPairs;	/* #kern pairs starting with this char */
    unsigned char reserved;
    float xWidth;		/* width in X of this character */
    int name;			/* name - an index into stringTable */
    float bbox[4];		/* character bbox */
    int kernPairIndex;		/* index into NXFontMetrics.kerns array */
} NXCharMetrics;


typedef struct {	/* elements of the ligature array */
	/* all ligatures go here, regardless of if the chars are encoded */
    int firstCharIndex;		/* index into NXFontMetrics.charMetrics */
    int secondCharIndex;	/* index into NXFontMetrics.charMetrics */
    int ligatureIndex;		/* index into NXFontMetrics.charMetrics */
} NXLigature;


typedef struct {	/* elements of the encoded ligature array */
	/* ligatures only go here if all three chars are encoded */
    unsigned char firstChar;		/* char encoding of first char */
    unsigned char secondChar;		/* char encoding of second char */
    unsigned char ligatureChar;		/* char encoding of ligature */
    unsigned char reserved;
} NXEncodedLigature;


typedef struct {	/* elements of the kern pair array */
    int secondCharIndex;	/* index into NXFontMetrics.charMetrics */
    float dx;			/* displacement relative to first char */
    float dy;
} NXKernPair;


typedef struct {	/* elements of the kern X pair array */
    int secondCharIndex;	/* index into NXFontMetrics.charMetrics */
    float dx;			/* X displacement relative to first char */
				/* Y displacement is implicitly 0 for these */
} NXKernXPair;


typedef struct {	/* elements of the track kern array */
    int degree;			/* degree of tightness */
    float minPointSize;		/* parameters for this track */
    float minKernAmount;
    float maxPointSize;
    float maxKernAmount;
} NXTrackKern;


typedef struct {	/* a composite char */
    int compCharIndex;		/* index into NXFontMetrics.charMetrics */
    int numParts;		/* number of parts making up this char */
    int firstPartIndex;		/* index of first part in */
				/* NXFontMetrics.compositeCharParts */
} NXCompositeChar;


typedef struct {	/* elements of the composite char array */
    int partIndex;		/* index into NXFontMetrics.charMetrics */
    float dx;			/* displacement of part */
    float dy;
} NXCompositeCharPart;


/*
 * Font information from Adobe Font Metrics file
 *
 * Do NOT embed this structure in your data structures, length may change.
 */

typedef struct _NXFontMetrics {
    char *formatVersion;	/* version of afm file format */
    char *name;			/* name of font for findfont */
    char *fullName;		/* full name of font */
    char *familyName;		/* "font family" name */
    char *weight;		/* weight of font */
    float italicAngle;		/* degrees ccw from vertical */
    char isFixedPitch;		/* is the font mono-spaced? */
    char isScreenFont;		/* is the font a screen font? */
    short screenFontSize;	/* If it is, how big is it? */
    float fontBBox[4];		/* bounding box (llx lly urx ury) */
    float underlinePosition;	/* dist from basline for underlines */
    float underlineThickness;	/* thickness of underline stroke */
    char *version;		/* version identifier */
    char *notice;		/* trademark or copyright */
    char *encodingScheme;	/* default encoding vector */
    float capHeight;		/* top of 'H' */
    float xHeight;		/* top of 'x' */
    float ascender;		/* top of 'd' */
    float descender;		/* bottom of 'p' */
#ifdef __m68k__
    short hasYWidths;		/* do any chars have non-0 y width? */
#endif
    float *widths;		/* character widths in x */
    unsigned int widthsLength;
    char *strings;		/* table of strings and other info */
    unsigned int stringsLength;
#ifndef __m68k__
    short hasYWidths;
#endif
    char hasXYKerns;		/* Do any of the kern pairs have nonzero dy? */
    char reserved;
    short *encoding;		/* 256 offsets into charMetrics */
    float *yWidths;		/* character widths in y.  NOT in encoding */
		/* order, but a parallel array to the charMetrics array */
    NXCharMetrics *charMetrics;		/* array of NXCharMetrics */
    int numCharMetrics;			/* num elements */
    NXLigature *ligatures;		/* array of NXLigatures */
    int numLigatures;			/* num elements */
    NXEncodedLigature *encLigatures;	/* array of NXEncodedLigatures */
    int numEncLigatures;		/* num elements */
    union {
	NXKernPair *kernPairs;		/* array of NXKernPairs */
	NXKernXPair *kernXPairs;	/* array of NXKernXPairs */
    } kerns;
    int numKernPairs;			/* num elements */
    NXTrackKern *trackKerns;		/* array of NXTrackKerns */
    int numTrackKerns;			/* num elements */
    NXCompositeChar *compositeChars;	/* array of NXCompositeChar */
    int numCompositeChars;		/* num elements */
    NXCompositeCharPart *compositeCharParts; /* array of NXCompositeCharPart */
    int numCompositeCharParts;		/* num elements */
#ifdef KANJI
    char isBaseFont;			/* true if base font */
#ifndef __m68k__
    char hasCharWidth;
#endif
    int mappingScheme;			/* for composite font only */
    int metricsSet;			/* for vertical writing */
    int characters;			/* number of character defined */
    float charWidth[2];			/* fixed pitch font width */
#ifdef __m68k__
    char hasCharWidth;
#endif
    char *characterSet;			/* font specific/ Do not refer */
    unsigned char widthsIndex[256];	/* index for widths */
    unsigned char maxIndex;		/* maximum index */
    short cfFlags;			/* flags for composite font */
    void *_compositeFontInfo;
    int _reserved[4];			/* for future use */
#endif
} NXFontMetrics;

#endif

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.