Mercurial > projects > dstep
comparison dstep/applicationservices/ats/ATSFont.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.ATSFont; | |
8 | |
9 //import dstep.AvailabilityMacros; | |
10 import dstep.applicationservices.ats.ATSTypes; | |
11 import dstep.applicationservices.ats.SFNTTypes; | |
12 import dstep.corefoundation.CoreFoundation; | |
13 import dstep.coreservices.CoreServices; | |
14 import dstep.objc.bridge.TypeEncoding; | |
15 | |
16 struct ATSFontFamilyIterator_; | |
17 struct ATSFontIterator_; | |
18 struct ATSFontNotificationRef_; | |
19 struct ATSFontNotificationInfoRef_; | |
20 | |
21 alias uint ATSFontContext; | |
22 alias ATSFontFamilyIterator_* ATSFontFamilyIterator; | |
23 alias ATSFontIterator_* ATSFontIterator; | |
24 alias int ATSFontFilterSelector; | |
25 alias ATSFontNotificationRef_* ATSFontNotificationRef; | |
26 alias ATSFontNotificationInfoRef_* ATSFontNotificationInfoRef; | |
27 alias int ATSFontNotifyOption; | |
28 alias int ATSFontNotifyAction; | |
29 alias int ATSFontQueryMessageID; | |
30 alias uint ATSFontAutoActivationSetting; | |
31 | |
32 extern (C) | |
33 { | |
34 alias int function (uint, void*) ATSFontApplierFunction; | |
35 alias void function (ATSFontNotificationInfoRef, void*) ATSNotificationCallback; | |
36 alias CFPropertyListRef function (int, CFPropertyListRef, void*) ATSFontQueryCallback; | |
37 alias int function (uint, void*) ATSFontFamilyApplierFunction; | |
38 } | |
39 | |
40 // This is needed otherwise the enums will fail compiling with gdc | |
41 version (GNU) | |
42 { | |
43 private | |
44 { | |
45 const __kATSQueryActivateFontMessage = getOSType!("atsa"); | |
46 } | |
47 } | |
48 | |
49 enum | |
50 { | |
51 kATSOptionFlagsDefault = kNilOptions, | |
52 kATSOptionFlagsComposeFontPostScriptName = 1 << 0, | |
53 kATSOptionFlagsUseDataForkAsResourceFork = 1 << 8, | |
54 kATSOptionFlagsUseResourceFork = 2 << 8, | |
55 kATSOptionFlagsUseDataFork = 3 << 8 | |
56 } | |
57 | |
58 enum | |
59 { | |
60 kATSIterationCompleted = -980L, | |
61 kATSInvalidFontFamilyAccess = -981L, | |
62 kATSInvalidFontAccess = -982L, | |
63 kATSIterationScopeModified = -983L, | |
64 kATSInvalidFontTableAccess = -984L, | |
65 kATSInvalidFontContainerAccess = -985L, | |
66 kATSInvalidGlyphAccess = -986L | |
67 } | |
68 | |
69 enum | |
70 { | |
71 kATSFontContextUnspecified = 0, | |
72 kATSFontContextGlobal = 1, | |
73 kATSFontContextLocal = 2 | |
74 } | |
75 | |
76 enum | |
77 { | |
78 kATSOptionFlagsActivateDisabled = 0x00000001 << 5, | |
79 kATSOptionFlagsProcessSubdirectories = 0x00000001 << 6, | |
80 kATSOptionFlagsDoNotNotify = 0x00000001 << 7, | |
81 kATSOptionFlagsRecordPersistently = 0x00000001 << 18 | |
82 } | |
83 | |
84 enum | |
85 { | |
86 kATSOptionFlagsIterateByPrecedenceMask = 0x00000001 << 5, | |
87 kATSOptionFlagsIncludeDisabledMask = 0x00000001 << 7, | |
88 kATSOptionFlagsIterationScopeMask = 0x00000007 << 12, | |
89 kATSOptionFlagsDefaultScope = 0x00000000 << 12, | |
90 kATSOptionFlagsUnRestrictedScope = 0x00000001 << 12, | |
91 kATSOptionFlagsRestrictedScope = 0x00000002 << 12 | |
92 } | |
93 | |
94 enum | |
95 { | |
96 kATSFontFilterCurrentVersion = 0 | |
97 } | |
98 | |
99 enum /*ATSFontFilterSelector*/ | |
100 { | |
101 kATSFontFilterSelectorUnspecified = 0, | |
102 kATSFontFilterSelectorGeneration = 3, | |
103 kATSFontFilterSelectorFontFamily = 7, | |
104 kATSFontFilterSelectorFontFamilyApplierFunction = 8, | |
105 kATSFontFilterSelectorFontApplierFunction = 9, | |
106 kATSFileReferenceFilterSelector = 10 | |
107 } | |
108 | |
109 enum /*ATSFontNotifyOption*/ | |
110 { | |
111 kATSFontNotifyOptionDefault = 0, | |
112 kATSFontNotifyOptionReceiveWhileSuspended = 1L << 0 | |
113 } | |
114 | |
115 enum /*ATSFontNotifyAction*/ | |
116 { | |
117 kATSFontNotifyActionFontsChanged = 1, | |
118 kATSFontNotifyActionDirectoriesChanged = 2 | |
119 } | |
120 | |
121 enum /*ATSFontQueryMessageID*/ | |
122 { | |
123 kATSQueryActivateFontMessage = getOSType!("atsa") | |
124 } | |
125 | |
126 enum | |
127 { | |
128 kATSFontAutoActivationDefault = 0, | |
129 kATSFontAutoActivationDisabled = 1, | |
130 kATSFontAutoActivationEnabled = 2, | |
131 kATSFontAutoActivationAsk = 4 | |
132 } | |
133 | |
134 struct ATSFontFilter | |
135 { | |
136 uint version_; | |
137 ATSFontFilterSelector filterSelector; | |
138 | |
139 union | |
140 { | |
141 ATSGeneration generationFilter; | |
142 ATSFontFamilyRef fontFamilyFilter; | |
143 ATSFontFamilyApplierFunction fontFamilyApplierFunctionFilter; | |
144 ATSFontApplierFunction fontApplierFunctionFilter; | |
145 /*const*/ FSRef* fontFileRefFilter; | |
146 } | |
147 } | |
148 | |
149 | |
150 struct ATSFontQuerySourceContext | |
151 { | |
152 UInt32 version_; | |
153 void* refCon; | |
154 CFAllocatorRetainCallBack retain; | |
155 CFAllocatorReleaseCallBack release; | |
156 } | |
157 | |
158 extern (C) | |
159 { | |
160 uint ATSGetGeneration (); | |
161 int ATSFontActivateFromFileReference (FSRef* iFile, uint iContext, uint iFormat, void* iRefCon, uint iOptions, ATSFontContainerRef* oContainer); | |
162 int ATSFontActivateFromMemory (LogicalAddress iData, uint iLength, uint iContext, uint iFormat, void* iReserved, uint iOptions, ATSFontContainerRef* oContainer); | |
163 int ATSFontDeactivate (uint iContainer, void* iRefCon, uint iOptions); | |
164 int ATSFontGetContainerFromFileReference (FSRef* iFile, uint iContext, uint iOptions, ATSFontContainerRef* oContainer); | |
165 int ATSFontGetContainer (uint iFont, uint iOptions, ATSFontContainerRef* oContainer); | |
166 int ATSFontSetEnabled (uint iFont, uint iOptions, ubyte iEnabled); | |
167 ubyte ATSFontIsEnabled (uint iFont); | |
168 int ATSFontFamilyApplyFunction (ATSFontFamilyApplierFunction iFunction, void* iRefCon); | |
169 int ATSFontFamilyIteratorCreate (uint iContext, ATSFontFilter* iFilter, void* iRefCon, uint iOptions, ATSFontFamilyIterator* ioIterator); | |
170 int ATSFontFamilyIteratorRelease (ATSFontFamilyIterator* ioIterator); | |
171 int ATSFontFamilyIteratorReset (uint iContext, ATSFontFilter* iFilter, void* iRefCon, uint iOptions, ATSFontFamilyIterator* ioIterator); | |
172 int ATSFontFamilyIteratorNext (ATSFontFamilyIterator iIterator, ATSFontFamilyRef* oFamily); | |
173 uint ATSFontFamilyFindFromName (CFStringRef iName, uint iOptions); | |
174 uint ATSFontFamilyGetGeneration (uint iFamily); | |
175 int ATSFontFamilyGetName (uint iFamily, uint iOptions, CFStringRef* oName); | |
176 uint ATSFontFamilyGetEncoding (uint iFamily); | |
177 int ATSFontApplyFunction (ATSFontApplierFunction iFunction, void* iRefCon); | |
178 int ATSFontIteratorCreate (uint iContext, ATSFontFilter* iFilter, void* iRefCon, uint iOptions, ATSFontIterator* ioIterator); | |
179 int ATSFontIteratorRelease (ATSFontIterator* ioIterator); | |
180 int ATSFontIteratorReset (uint iContext, ATSFontFilter* iFilter, void* iRefCon, uint iOptions, ATSFontIterator* ioIterator); | |
181 int ATSFontIteratorNext (ATSFontIterator iIterator, ATSFontRef* oFont); | |
182 uint ATSFontFindFromName (CFStringRef iName, uint iOptions); | |
183 uint ATSFontFindFromPostScriptName (CFStringRef iName, uint iOptions); | |
184 int ATSFontFindFromContainer (uint iContainer, uint iOptions, uint iCount, ATSFontRef* ioArray, ItemCount* oCount); | |
185 uint ATSFontGetGeneration (uint iFont); | |
186 int ATSFontGetName (uint iFont, uint iOptions, CFStringRef* oName); | |
187 int ATSFontGetPostScriptName (uint iFont, uint iOptions, CFStringRef* oName); | |
188 int ATSFontGetTableDirectory (uint iFont, uint iBufferSize, void* ioBuffer, ByteCount* oSize); | |
189 int ATSFontGetTable (uint iFont, uint iTag, uint iOffset, uint iBufferSize, void* ioBuffer, ByteCount* oSize); | |
190 int ATSFontGetHorizontalMetrics (uint iFont, uint iOptions, ATSFontMetrics* oMetrics); | |
191 int ATSFontGetVerticalMetrics (uint iFont, uint iOptions, ATSFontMetrics* oMetrics); | |
192 uint ATSFontFamilyFindFromQuickDrawName (char* iName); | |
193 int ATSFontFamilyGetQuickDrawName (uint iFamily, ubyte[256] oName); | |
194 int ATSFontGetFileReference (uint iFont, FSRef* oFile); | |
195 int ATSFontGetFontFamilyResource (uint iFont, uint iBufferSize, void* ioBuffer, ByteCount* oSize); | |
196 int ATSFontNotify (int action, void* info); | |
197 int ATSFontNotificationSubscribe (ATSNotificationCallback callback, int options, void* iRefcon, ATSFontNotificationRef* oNotificationRef); | |
198 int ATSFontNotificationUnsubscribe (ATSFontNotificationRef notificationRef); | |
199 CFRunLoopSourceRef ATSCreateFontQueryRunLoopSource (int queryOrder, int sourceOrder, ATSFontQueryCallback callout, ATSFontQuerySourceContext* context); | |
200 int ATSFontSetGlobalAutoActivationSetting (uint iSetting); | |
201 uint ATSFontGetGlobalAutoActivationSetting (); | |
202 int ATSFontSetAutoActivationSettingForApplication (uint iSetting, CFURLRef iApplicationFileURL); | |
203 uint ATSFontGetAutoActivationSettingForApplication (CFURLRef iApplicationFileURL); | |
204 } |