NeXTSTEP source code.
NeXTSTEP source code dump.
Font.h
Go to the documentation of this file.
1 /*
2  Font.h
3  Copyright 1988, NeXT, Inc.
4 */
5 
6 #ifndef FONT_H
7 #define FONT_H
8 
9 #import <objc/Object.h>
10 
11 #import <objc/typedstream.h>
12 
13 #define NX_IDENTITYMATRIX ((float *) 0)
14 #define NX_FLIPPEDMATRIX ((float *) -1)
15 
16 #define NX_FONTHEADER 1
17 #define NX_FONTMETRICS 2
18 #define NX_FONTWIDTHS 4
19 #define NX_FONTCHARDATA 8
20 #define NX_FONTKERNING 16
21 #define NX_FONTCOMPOSITES 32
22 
23 /* questions: unencoded characters???
24 */
25 
26 /*
27  * first pass at four additional space characters, whose ascii codes
28  * we have to talk to Adobe about. Figure is aka non-breaking space
29  */
30 
31 #define NX_FIGSPACE ((unsigned short)0x80)
32 #define NX_EMSPACE ((unsigned short)0x81)
33 #define NX_ENSPACE ((unsigned short)0x82)
34 #define NX_THINSPACE ((unsigned short)0x83)
35 
36 typedef struct _NXLigature { /* a ligature */
37  char *successor; /* char that follows current character */
38  char *result; /* the ligature char that results */
40 
41 typedef struct _NXCharData { /* character data besides widths */
42  char *name; /* name of character */
43  float charBBox[4]; /* bounding box (llx lly urx ury) */
44  short numLigatures; /* number of ligature pairs */
45  NXLigature *ligatures; /* the ligatures */
47 
48 typedef struct _NXKernTrack { /* a kerning track */
49  int degree; /* tightness of kerning */
50  float minSize; /* kerning amounts for a min and max */
51  float minAmount; /* point size. */
52  float maxSize;
53  float maxAmount;
55 
56 typedef struct _NXKernPair { /* a kerning pair */
57  char *name1; /* names of chars to kern */
58  char *name2;
59  float x, y; /* amount to move second character */
61 
62 typedef struct _NXCompositePart { /* part of a composite character */
63  char *name; /* name of char */
64  float dx, dy; /* displacement of part from char origin */
66 
67 typedef struct _NXCompositeChar { /* a composite character */
68  char *name; /* name of char */
69  short numParts; /* number of parts making up the char */
70  NXCompositePart *parts; /* var length array of parts */
72 
73 typedef struct _NXFontMetrics { /* data from a afm file */
74  char *formatVersion; /* version of afm file format */
75  char *name; /* name of font for findfont */
76  char *fullName; /* full name of font */
77  char *familyName; /* "font family" name */
78  char *weight; /* weight of font */
79  float italicAngle; /* degrees ccw from vertical */
80  char isFixedPitch; /* is the font mono-spaced? */
81  char isScreenFont; /* is the font a screen font? */
82  short screenFontSize; /* If it is, how big is it? */
83  float fontBBox[4]; /* bounding box (llx lly urx ury) */
84  float underlinePosition; /* dist from basline for underlines */
85  float underlineThickness; /* thickness of underline stroke */
86  char *version; /* version identifier */
87  char *notice; /* trademark or copyright */
88  char *encodingScheme; /* default encoding vector */
89  float capHeight; /* top of 'H' */
90  float xHeight; /* top of 'x' */
91  float ascender; /* top of 'd' */
92  float descender; /* bottom of 'p' */
93  short hasYWidths; /* do any chars have non-0 y width? */
94  float *widths; /* character widths in x */
95  float *yWidths; /* y components of width vector */
96  /* a NULL if widths are only in x */
97  NXCharData *charData; /* character data besides widths */
98  short numKTracks; /* number of kerning tracks */
99  NXKernTrack *kernTracks; /* the tracks */
100  short numKPairs; /* number of kerning pairs */
101  NXKernPair *kernPairs; /* the kerning pairs */
102  short numCompositeChars; /* number of composite characters */
103  NXCompositeChar *compositeChars; /* the composite chars */
104  short numBuffers; /* # of char buffers in following array */
105  char **buffers; /* buffers of characters, pointed into by */
106  /* all these (char *) name fields */
108 
109 typedef struct _NXFaceInfo {
110  NXFontMetrics fontMetrics;/* Information from afm file */
111  int flags; /* Which font info is present */
112  struct { /* Keeps track of font usage for Conforming PS */
113  unsigned int usedInDoc:1; /* has font been used in doc? */
114  unsigned int usedInPage:1; /* has font been used in page? */
115  unsigned int usedInSheet:1; /* has font been used in sheet? */
116  /* There can be more than one page printed on a sheet of paper */
117  unsigned int _PADDING:13;
119  struct _NXFaceInfo *nextFInfo; /* Next faceInfo in the list */
121 
122 
123 
124 extern char *NXSystemFont;
125 extern char *NXBoldSystemFont;
126 
127 
128 @interface Font : Object
129 {
130  char *name;
131  float size;
132  int style;
133  float *matrix;
134  int fontNum;
137  struct /*_fFlags*/ {
138  unsigned int usedByWS:1;
139  unsigned int usedByPrinter:1;
140  unsigned int isScreenFont:1;
141  unsigned int _PADDING:12;
142  unsigned int _hasStyle:1;
144  unsigned short _reservedFont2;
145  unsigned int _reservedFont3;
146 }
147 + initialize;
148 + newFont:(const char *)fontName size:(float )fontSize style:(int )fontStyle matrix:(float *)fontMatrix;
149 + newFont:(const char *)fontName size:(float )fontSize;
150 - awake;
151 - free;
152 -(float ) pointSize;
153 -(char *) name;
154 -(int ) fontNum;
155 -(int ) style;
156 -(float *) matrix;
157 -(NXFontMetrics *) metrics;
158 -(NXFontMetrics *) readMetrics:(int )flags;
159 -(BOOL ) hasMatrix;
160 - set;
161 -(float ) getWidthOf:(const char *)string;
162 - finishUnarchiving;
163 - screenFont;
164 - write:(NXTypedStream *) s;
165 - read:(NXTypedStream *) s;
166 
167 @end
168 
169 #endif FONT_H
170 
171 
172 
float pointSize
Definition: ButtonCell.m:83
struct _NXKernPair NXKernPair
struct _NXFontMetrics NXFontMetrics
char * NXBoldSystemFont
Definition: appkit_globals.m:32
struct _NXLigature NXLigature
char * NXSystemFont
Definition: appkit_globals.m:31
struct _NXKernTrack NXKernTrack
struct _NXFaceInfo NXFaceInfo
struct _NXCompositeChar NXCompositeChar
struct _NXCharData NXCharData
struct _NXCompositePart NXCompositePart
char BOOL
Definition: mode.h:44
#define free(ptr)
Definition: hostdict.c:30
register NXFontMetrics * metrics
Definition: afm.m:490
#define const
Definition: c-parse.tab.c:108
Definition: Font.h:129
unsigned int _hasStyle
Definition: Font.h:142
unsigned int usedByPrinter
Definition: Font.h:139
unsigned int usedByWS
Definition: Font.h:138
struct Font::@65 fFlags
NXFaceInfo * faceInfo
Definition: Font.h:135
unsigned int _PADDING
Definition: Font.h:141
float size
Definition: Font.h:131
unsigned int _reservedFont3
Definition: Font.h:145
unsigned int isScreenFont
Definition: Font.h:140
char * name
Definition: Font.h:130
unsigned short _reservedFont2
Definition: Font.h:144
id otherFont
Definition: Font.h:136
float * matrix
Definition: Font.h:133
int fontNum
Definition: Font.h:134
int style
Definition: Font.h:132
Definition: Object.h:15
#define read
Definition: kdbdefine.h:78
#define write
Definition: kdbdefine.h:106
FontMetrics * readMetrics(const char *file)
Definition: metrics.c:67
END int initialize() int i
Definition: ntp_proto.c:760
Definition: afm.h:71
Definition: afm.h:48
Definition: afm.h:31
Definition: Font.h:41
float charBBox[4]
Definition: Font.h:43
NXLigature * ligatures
Definition: Font.h:45
short numLigatures
Definition: Font.h:44
char * name
Definition: Font.h:42
Definition: Font.h:67
short numParts
Definition: Font.h:69
char * name
Definition: Font.h:68
NXCompositePart * parts
Definition: Font.h:70
Definition: Font.h:62
char * name
Definition: Font.h:63
float dx
Definition: Font.h:64
float dy
Definition: Font.h:64
Definition: Font.h:109
NXFontMetrics fontMetrics
Definition: Font.h:110
unsigned int usedInPage
Definition: Font.h:114
unsigned int usedInSheet
Definition: Font.h:115
struct _NXFaceInfo * nextFInfo
Definition: Font.h:119
int flags
Definition: Font.h:111
unsigned int usedInDoc
Definition: Font.h:113
struct _NXFaceInfo::@64 fontFlags
unsigned int _PADDING
Definition: Font.h:117
Definition: Font.h:73
char * encodingScheme
Definition: Font.h:88
char * version
Definition: Font.h:86
char * familyName
Definition: Font.h:77
NXCharData * charData
Definition: Font.h:97
char ** buffers
Definition: Font.h:105
char * fullName
Definition: Font.h:76
char * notice
Definition: Font.h:87
char * weight
Definition: Font.h:78
NXKernTrack * kernTracks
Definition: Font.h:99
float ascender
Definition: Font.h:91
float capHeight
Definition: Font.h:89
short numKPairs
Definition: Font.h:100
float underlineThickness
Definition: Font.h:85
NXCompositeChar * compositeChars
Definition: Font.h:103
float fontBBox[4]
Definition: Font.h:83
short numKTracks
Definition: Font.h:98
float underlinePosition
Definition: Font.h:84
NXKernPair * kernPairs
Definition: Font.h:101
char * formatVersion
Definition: Font.h:74
float italicAngle
Definition: Font.h:79
float * yWidths
Definition: Font.h:95
char isFixedPitch
Definition: Font.h:80
short hasYWidths
Definition: Font.h:93
short numCompositeChars
Definition: Font.h:102
short screenFontSize
Definition: Font.h:82
float * widths
Definition: Font.h:94
char isScreenFont
Definition: Font.h:81
float xHeight
Definition: Font.h:90
short numBuffers
Definition: Font.h:104
char * name
Definition: Font.h:75
float descender
Definition: Font.h:92
Definition: Font.h:56
float x
Definition: Font.h:59
float y
Definition: Font.h:59
char * name2
Definition: Font.h:58
char * name1
Definition: Font.h:57
Definition: Font.h:48
int degree
Definition: Font.h:49
float maxAmount
Definition: Font.h:53
float minAmount
Definition: Font.h:51
float minSize
Definition: Font.h:50
float maxSize
Definition: Font.h:52
Definition: Font.h:36
char * result
Definition: Font.h:38
char * successor
Definition: Font.h:37
Definition: dispextern.h:39
Definition: htable.h:20
Definition: cse.c:2745
int style
Definition: t0.c:27
void NXTypedStream
Definition: typedstream.h:24