1 /*
2    GSFontInfo.h
3 
4    Private class for handling font info
5 
6    Copyright (C) 2000 Free Software Foundation, Inc.
7 
8    Author: Adam Fedor <fedor@gnu.org>
9    Date: Mar 2000
10 
11    This file is part of the GNUstep.
12 
13    This library is free software; you can redistribute it and/or
14    modify it under the terms of the GNU Lesser General Public
15    License as published by the Free Software Foundation; either
16    version 2 of the License, or (at your option) any later version.
17 
18    This library is distributed in the hope that it will be useful,
19    but WITHOUT ANY WARRANTY; without even the implied warranty of
20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
21    Lesser General Public License for more details.
22 
23    You should have received a copy of the GNU Lesser General Public
24    License along with this library; see the file COPYING.LIB.
25    If not, see <http://www.gnu.org/licenses/> or write to the
26    Free Software Foundation, 51 Franklin Street, Fifth Floor,
27    Boston, MA 02110-1301, USA.
28 */
29 
30 #ifndef __GSFontInfo_h_INCLUDE_
31 #define __GSFontInfo_h_INCLUDE_
32 
33 #import <AppKit/NSFont.h>
34 #import <AppKit/NSFontManager.h>
35 
36 @class NSMutableDictionary;
37 @class NSArray;
38 @class NSBezierPath;
39 @class NSFontDescriptor;
40 
41 @interface GSFontEnumerator : NSObject
42 {
43   NSArray *allFontNames;
44   NSMutableDictionary *allFontFamilies;
45   NSArray *allFontDescriptors;
46 }
47 
48 + (void) setDefaultClass: (Class)defaultClass;
49 + (GSFontEnumerator*) sharedEnumerator;
50 - (void) enumerateFontsAndFamilies;
51 - (NSArray*) availableFonts;
52 - (NSArray*) availableFontFamilies;
53 - (NSArray*) availableMembersOfFontFamily: (NSString*)family;
54 - (NSArray*) availableFontDescriptors;
55 - (NSArray *) availableFontNamesMatchingFontDescriptor: (NSFontDescriptor *)descriptor;
56 - (NSArray *) matchingFontDescriptorsFor: (NSDictionary *)attributes;
57 - (NSArray *) matchingDescriptorsForFamily: (NSString *)family
58                                    options: (NSDictionary *)options
59                                  inclusion: (NSArray *)queryDescriptors
60                                  exculsion: (NSArray *)exclusionDescriptors;
61 
62 /* Note that these are only called once. NSFont will remember the returned
63 values. Backends may override these. */
64 - (NSString *) defaultSystemFontName;
65 - (NSString *) defaultBoldSystemFontName;
66 - (NSString *) defaultFixedPitchFontName;
67 @end
68 
69 @interface GSFontInfo : NSObject <NSCopying, NSMutableCopying>
70 {
71   NSMutableDictionary* fontDictionary;
72 
73   // metrics of the font
74   NSString *fontName;
75   NSString *familyName;
76   CGFloat matrix[6];
77   CGFloat italicAngle;
78   CGFloat underlinePosition;
79   CGFloat underlineThickness;
80   CGFloat capHeight;
81   CGFloat xHeight;
82   CGFloat descender;
83   CGFloat ascender;
84   NSSize maximumAdvancement;
85   NSSize minimumAdvancement;
86   NSString *encodingScheme;
87   NSStringEncoding mostCompatibleStringEncoding;
88   NSRect fontBBox;
89   BOOL isFixedPitch;
90   BOOL isBaseFont;
91   int weight;
92   NSFontTraitMask traits;
93   unsigned numberOfGlyphs;
94   NSCharacterSet *coveredCharacterSet;
95   NSFontDescriptor *fontDescriptor;
96 }
97 
98 + (GSFontInfo*) fontInfoForFontName: (NSString*)fontName
99                              matrix: (const CGFloat*)fmatrix
100 			 screenFont: (BOOL)screenFont;
101 + (void) setDefaultClass: (Class)defaultClass;
102 + (NSString*) stringForWeight: (int)weight;
103 + (int) weightForString: (NSString*)weightString;
104 
105 - (NSSize) advancementForGlyph: (NSGlyph)aGlyph;
106 - (NSDictionary*) afmDictionary;
107 - (NSString*) afmFileContents;
108 - (void) appendBezierPathWithGlyphs: (NSGlyph*)glyphs
109 			      count: (int)count
110 		       toBezierPath: (NSBezierPath*)path;
111 - (CGFloat) ascender;
112 - (NSRect) boundingRectForGlyph: (NSGlyph)aGlyph;
113 - (NSRect) boundingRectForFont;
114 - (CGFloat) capHeight;
115 - (NSCharacterSet*) coveredCharacterSet;
116 - (CGFloat) defaultLineHeightForFont;
117 - (CGFloat) descender;
118 - (NSString *) displayName;
119 - (NSString *) encodingScheme;
120 - (NSString *) familyName;
121 - (NSString *) fontName;
122 - (BOOL) glyphIsEncoded: (NSGlyph)aGlyph;
123 - (NSMultibyteGlyphPacking) glyphPacking;
124 - (NSGlyph) glyphWithName: (NSString*)glyphName;
125 - (BOOL) isFixedPitch;
126 - (BOOL) isBaseFont;
127 - (CGFloat) italicAngle;
128 - (const CGFloat*) matrix;
129 - (NSSize) maximumAdvancement;
130 - (NSSize) minimumAdvancement;
131 - (NSStringEncoding) mostCompatibleStringEncoding;
132 - (NSUInteger) numberOfGlyphs;
133 - (NSPoint) positionOfGlyph: (NSGlyph)aGlyph
134                forCharacter: (unichar)aChar
135              struckOverRect: (NSRect)aRect;
136 - (NSPoint) positionOfGlyph: (NSGlyph)curGlyph
137 	    precededByGlyph: (NSGlyph)prevGlyph
138 		  isNominal: (BOOL*)nominal;
139 - (NSPoint) positionOfGlyph: (NSGlyph)aGlyph
140 	    struckOverGlyph: (NSGlyph)baseGlyph
141 	       metricsExist: (BOOL *)flag;
142 - (NSPoint) positionOfGlyph: (NSGlyph)aGlyph
143 	     struckOverRect: (NSRect)aRect
144 	       metricsExist: (BOOL *)flag;
145 - (NSPoint) positionOfGlyph: (NSGlyph)aGlyph
146 	       withRelation: (NSGlyphRelation)relation
147 		toBaseGlyph: (NSGlyph)baseGlyph
148 	   totalAdvancement: (NSSize *)offset
149 	       metricsExist: (BOOL *)flag;
150 - (NSFontTraitMask) traits;
151 - (CGFloat) underlinePosition;
152 - (CGFloat) underlineThickness;
153 - (int) weight;
154 - (CGFloat) widthOfString: (NSString*)string;
155 - (CGFloat) xHeight;
156 - (NSGlyph) glyphForCharacter: (unichar)theChar;
157 - (NSFontDescriptor*) fontDescriptor;
158 
159 @end
160 
161 #endif /* __GSFontInfo_h_INCLUDE_ */
162