1 /*
2    NSFontDescriptor.h
3 
4    Holds an image to use as a cursor
5 
6    Copyright (C) 2007 Free Software Foundation, Inc.
7 
8    Author:  Dr. H. Nikolaus Schaller <hns@computer.org>
9    Date: 2006
10 
11    This file is part of the GNUstep GUI Library.
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 
31 #ifndef _GNUstep_H_NSFontDescriptor
32 #define _GNUstep_H_NSFontDescriptor
33 #import <GNUstepBase/GSVersionMacros.h>
34 
35 #import <Foundation/NSObject.h>
36 #import <AppKit/AppKitDefines.h>
37 
38 #if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
39 
40 @class NSArray;
41 @class NSCoder;
42 @class NSDictionary;
43 @class NSSet;
44 @class NSString;
45 @class NSAffineTransform;
46 
47 #if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
48 typedef uint32_t NSFontSymbolicTraits;
49 
50 typedef enum _NSFontFamilyClass
51 {
52   NSFontUnknownClass = 0 << 28,
53   NSFontOldStyleSerifsClass = 1U << 28,
54   NSFontTransitionalSerifsClass = 2U << 28,
55   NSFontModernSerifsClass = 3U << 28,
56   NSFontClarendonSerifsClass = 4U << 28,
57   NSFontSlabSerifsClass = 5U << 28,
58   NSFontFreeformSerifsClass = 7U << 28,
59   NSFontSansSerifClass = 8U << 28,
60   NSFontOrnamentalsClass = 9U << 28,
61   NSFontScriptsClass = 10U << 28,
62   NSFontSymbolicClass = 12U << 28
63 } NSFontFamilyClass;
64 
65 enum _NSFontFamilyClassMask {
66     NSFontFamilyClassMask = 0xF0000000
67 };
68 
69 enum _NSFontTrait
70 {
71   NSFontItalicTrait = 0x0001,
72   NSFontBoldTrait = 0x0002,
73   NSFontExpandedTrait = 0x0020,
74   NSFontCondensedTrait = 0x0040,
75   NSFontMonoSpaceTrait = 0x0400,
76   NSFontVerticalTrait = 0x0800,
77   NSFontUIOptimizedTrait = 0x1000
78 };
79 
80 #endif
81 
82 APPKIT_EXPORT NSString *NSFontFamilyAttribute;
83 APPKIT_EXPORT NSString *NSFontNameAttribute;
84 APPKIT_EXPORT NSString *NSFontFaceAttribute;
85 APPKIT_EXPORT NSString *NSFontSizeAttribute;
86 APPKIT_EXPORT NSString *NSFontVisibleNameAttribute;
87 APPKIT_EXPORT NSString *NSFontColorAttribute;
88 APPKIT_EXPORT NSString *NSFontMatrixAttribute;
89 APPKIT_EXPORT NSString *NSFontVariationAttribute;
90 APPKIT_EXPORT NSString *NSFontCharacterSetAttribute;
91 APPKIT_EXPORT NSString *NSFontCascadeListAttribute;
92 APPKIT_EXPORT NSString *NSFontTraitsAttribute;
93 APPKIT_EXPORT NSString *NSFontFixedAdvanceAttribute;
94 
95 APPKIT_EXPORT NSString *NSFontSymbolicTrait;
96 APPKIT_EXPORT NSString *NSFontWeightTrait;
97 APPKIT_EXPORT NSString *NSFontWidthTrait;
98 APPKIT_EXPORT NSString *NSFontSlantTrait;
99 
100 APPKIT_EXPORT NSString *NSFontVariationAxisIdentifierKey;
101 APPKIT_EXPORT NSString *NSFontVariationAxisMinimumValueKey;
102 APPKIT_EXPORT NSString *NSFontVariationAxisMaximumValueKey;
103 APPKIT_EXPORT NSString *NSFontVariationAxisDefaultValueKey;
104 APPKIT_EXPORT NSString *NSFontVariationAxisNameKey;
105 
106 @interface NSFontDescriptor : NSObject <NSCoding, NSCopying>
107 {
108   NSDictionary *_attributes;
109 }
110 
111 + (id) fontDescriptorWithFontAttributes: (NSDictionary *)attributes;
112 + (id) fontDescriptorWithName: (NSString *)name
113                          size: (CGFloat)size;
114 #if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
115 + (id) fontDescriptorWithName: (NSString *)name
116                        matrix: (NSAffineTransform *)matrix;
117 #endif
118 
119 - (NSDictionary *) fontAttributes;
120 - (id) initWithFontAttributes: (NSDictionary *)attributes;
121 
122 #if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
123 - (NSFontDescriptor *) fontDescriptorByAddingAttributes:
124   (NSDictionary *)attributes;
125 - (NSFontDescriptor *) fontDescriptorWithFace: (NSString *)face;
126 - (NSFontDescriptor *) fontDescriptorWithFamily: (NSString *)family;
127 - (NSFontDescriptor *) fontDescriptorWithMatrix: (NSAffineTransform *)matrix;
128 - (NSFontDescriptor *) fontDescriptorWithSize: (CGFloat)size;
129 - (NSFontDescriptor *) fontDescriptorWithSymbolicTraits:
130   (NSFontSymbolicTraits)traits;
131 - (NSArray *) matchingFontDescriptorsWithMandatoryKeys: (NSSet *)keys;
132 
133 - (id) objectForKey: (NSString *)attribute;
134 - (NSAffineTransform *) matrix;
135 - (CGFloat) pointSize;
136 - (NSString *) postscriptName;
137 - (NSFontSymbolicTraits) symbolicTraits;
138 #endif
139 #if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
140 - (NSFontDescriptor *) matchingFontDescriptorWithMandatoryKeys: (NSSet *)keys;
141 #endif
142 
143 @end
144 
145 #endif /* OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST) */
146 
147 #endif /* _GNUstep_H_NSFontDescriptor */
148