comparison dstep/applicationservices/ats/ATSTypes.d @ 12:9f0b49a2f64e

Added the ApplicationServices frameworks: ATS, ColorSync and CoreGraphics
author Jacob Carlborg <doob@me.com>
date Mon, 03 Aug 2009 14:00:21 +0200
parents
children
comparison
equal deleted inserted replaced
11:07194b026fa4 12:9f0b49a2f64e
1 /**
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
3 * Authors: Jacob Carlborg
4 * Version: Initial created: Aug 1, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */
7 module dstep.applicationservices.ats.ATSTypes;
8
9 //import dstep.AvailabilityMacros;
10 import dstep.applicationservices.coregraphics.CGBase;
11 import dstep.applicationservices.coregraphics.CGGeometry;
12 import dstep.coreservices.CoreServices;
13 import dstep.objc.bridge.TypeEncoding;
14
15 alias CGPoint ATSPoint;
16 alias uint FMGeneration;
17 alias short FMFontFamily;
18 alias short FMFontStyle;
19 alias short FMFontSize;
20 alias uint FMFont;
21 alias uint FMFilterSelector;
22 alias FMFontFamilyCallbackFilterProcPtr FMFontFamilyCallbackFilterUPP;
23 alias FMFontCallbackFilterProcPtr FMFontCallbackFilterUPP;
24 alias uint ATSOptionFlags;
25 alias uint ATSGeneration;
26 alias uint ATSFontContainerRef;
27 alias uint ATSFontFamilyRef;
28 alias uint ATSFontRef;
29 alias ushort ATSGlyphRef;
30 alias CGFloat ATSFontSize;
31 alias uint ATSFontFormat;
32 alias ushort ATSCurveType;
33 alias ushort GlyphID;
34
35 extern (C)
36 {
37 alias int function (uint, void*) FMFontCallbackFilterProcPtr;
38 alias int function (short, void*) FMFontFamilyCallbackFilterProcPtr;
39 }
40
41 // This is needed otherwise the enums will fail compiling with gdc
42 version (GNU)
43 {
44 private
45 {
46 const __kFMTrueTypeFontTechnology = getOSType!("true");
47 const __kFMPostScriptFontTechnology = getOSType!("typ1");
48 }
49 }
50
51 enum
52 {
53 kInvalidGeneration = 0L,
54 kInvalidFontFamily = -1,
55 kInvalidFont = 0L
56 }
57
58 enum
59 {
60 kFMCurrentFilterFormat = 0L
61 }
62
63 enum
64 {
65 kFMFontTechnologyFilterSelector = 1L,
66 kFMFontContainerFilterSelector = 2L,
67 kFMGenerationFilterSelector = 3L,
68 kFMFontFamilyCallbackFilterSelector = 4L,
69 kFMFontCallbackFilterSelector = 5L,
70 kFMFontDirectoryFilterSelector = 6L,
71 kFMFontFileRefFilterSelector = 10L
72 }
73
74 enum
75 {
76 kFMTrueTypeFontTechnology = getOSType!("true"),
77 kFMPostScriptFontTechnology = getOSType!("typ1")
78 }
79
80 enum
81 {
82 kATSFontFormatUnspecified = 0
83 }
84
85 enum
86 {
87 kATSGenerationUnspecified = 0L,
88 kATSFontContainerRefUnspecified = 0L,
89 kATSFontFamilyRefUnspecified = 0L,
90 kATSFontRefUnspecified = 0L
91 }
92
93 enum
94 {
95 kATSItalicQDSkew = (1 << 16) / 4,
96 kATSBoldQDStretch = (1 << 16) * 3 / 2,
97 kATSRadiansFactor = 1144
98 }
99
100 enum
101 {
102 kATSCubicCurveType = 0x0001,
103 kATSQuadCurveType = 0x0002,
104 kATSOtherCurveType = 0x0003
105 }
106
107 enum
108 {
109 kATSDeletedGlyphcode = 0xFFFF
110 }
111
112 struct ATSFSSpec
113 {
114 short vRefNum;
115 int parID;
116 ubyte[64] name;
117 }
118
119
120 struct FMFontFamilyInstance
121 {
122 short fontFamily;
123 short fontStyle;
124 }
125
126
127 struct FMFontFamilyIterator
128 {
129 UInt32* reserved;
130 }
131
132
133 struct FMFontIterator
134 {
135 UInt32* reserved;
136 }
137
138
139 struct FMFontFamilyInstanceIterator
140 {
141 UInt32* reserved;
142 }
143
144
145 struct FMFontDirectoryFilter
146 {
147 short fontFolderDomain;
148 UInt32* reserved;
149 }
150
151 struct FMFilter
152 {
153 uint format;
154 FMFilterSelector selector;
155
156 union
157 {
158 FourCharCode fontTechnologyFilter;
159 ATSFSSpec fontContainerFilter;
160 FMGeneration generationFilter;
161 FMFontFamilyCallbackFilterUPP fontFamilyCallbackFilter;
162 FMFontCallbackFilterUPP fontCallbackFilter;
163 FMFontDirectoryFilter fontDirectoryFilter;
164 /*const*/ FSRef* fontFileRefFilter;
165 }
166 }
167
168
169 struct ATSFontMetrics
170 {
171 float version_;
172 CGFloat ascent;
173 CGFloat descent;
174 CGFloat leading;
175 CGFloat avgAdvanceWidth;
176 CGFloat maxAdvanceWidth;
177 CGFloat minLeftSideBearing;
178 CGFloat minRightSideBearing;
179 CGFloat stemWidth;
180 CGFloat stemHeight;
181 CGFloat capHeight;
182 CGFloat xHeight;
183 CGFloat italicAngle;
184 CGFloat underlinePosition;
185 CGFloat underlineThickness;
186 }
187
188
189 struct ATSUCurvePath
190 {
191 UInt32 vectors;
192 UInt32* controlBits;
193 ATSPoint* vector;
194 }
195
196
197 struct ATSUCurvePaths
198 {
199 UInt32 contours;
200 ATSUCurvePath* contour;
201 }
202
203
204 struct ATSGlyphIdealMetrics
205 {
206 ATSPoint advance;
207 ATSPoint sideBearing;
208 ATSPoint otherSideBearing;
209 }
210
211
212 struct ATSGlyphScreenMetrics
213 {
214 ATSPoint deviceAdvance;
215 uint topLeft;
216 uint height;
217 UInt32 width;
218 ATSPoint sideBearing;
219 ATSPoint otherSideBearing;
220 }
221
222 extern (C)
223 {
224 FMFontFamilyCallbackFilterUPP NewFMFontFamilyCallbackFilterUPP (FMFontFamilyCallbackFilterProcPtr userRoutine);
225 FMFontCallbackFilterUPP NewFMFontCallbackFilterUPP (FMFontCallbackFilterProcPtr userRoutine);
226 void DisposeFMFontFamilyCallbackFilterUPP (FMFontFamilyCallbackFilterUPP userUPP);
227 void DisposeFMFontCallbackFilterUPP (FMFontCallbackFilterUPP userUPP);
228 int InvokeFMFontFamilyCallbackFilterUPP (short iFontFamily, void* iRefCon, FMFontFamilyCallbackFilterUPP userUPP);
229 int InvokeFMFontCallbackFilterUPP (uint iFont, void* iRefCon, FMFontCallbackFilterUPP userUPP);
230 }