blob: f7d284be7781f543d87f3a61a4a30b004dc4903b [file] [log] [blame]
José Fonseca31f2b6e2011-10-10 01:45:04 +01001##########################################################################
2#
3# Copyright 2011 Jose Fonseca
4# All Rights Reserved.
5#
6# Permission is hereby granted, free of charge, to any person obtaining a copy
7# of this software and associated documentation files (the "Software"), to deal
8# in the Software without restriction, including without limitation the rights
9# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10# copies of the Software, and to permit persons to whom the Software is
11# furnished to do so, subject to the following conditions:
12#
13# The above copyright notice and this permission notice shall be included in
14# all copies or substantial portions of the Software.
15#
16# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22# THE SOFTWARE.
23#
24##########################################################################/
25
26
27from winapi import *
28from dcommon import *
29
30
31ID2D1SimplifiedGeometrySink = Interface("ID2D1SimplifiedGeometrySink", IUnknown)
32IDWriteGeometrySink = Alias("IDWriteGeometrySink", ID2D1SimplifiedGeometrySink)
33
34IDWriteFontFileLoader = Interface("IDWriteFontFileLoader", IUnknown)
35IDWriteLocalFontFileLoader = Interface("IDWriteLocalFontFileLoader", IDWriteFontFileLoader)
36IDWriteFontFileStream = Interface("IDWriteFontFileStream", IUnknown)
37IDWriteFontFile = Interface("IDWriteFontFile", IUnknown)
38IDWriteRenderingParams = Interface("IDWriteRenderingParams", IUnknown)
39IDWriteFontFace = Interface("IDWriteFontFace", IUnknown)
40IDWriteFontCollectionLoader = Interface("IDWriteFontCollectionLoader", IUnknown)
41IDWriteFontFileEnumerator = Interface("IDWriteFontFileEnumerator", IUnknown)
42IDWriteLocalizedStrings = Interface("IDWriteLocalizedStrings", IUnknown)
43IDWriteFontCollection = Interface("IDWriteFontCollection", IUnknown)
44IDWriteFontList = Interface("IDWriteFontList", IUnknown)
45IDWriteFontFamily = Interface("IDWriteFontFamily", IDWriteFontList)
46IDWriteFont = Interface("IDWriteFont", IUnknown)
47IDWriteTextFormat = Interface("IDWriteTextFormat", IUnknown)
48IDWriteTypography = Interface("IDWriteTypography", IUnknown)
49IDWriteNumberSubstitution = Interface("IDWriteNumberSubstitution", IUnknown)
50IDWriteTextAnalysisSource = Interface("IDWriteTextAnalysisSource", IUnknown)
51IDWriteTextAnalysisSink = Interface("IDWriteTextAnalysisSink", IUnknown)
52IDWriteTextAnalyzer = Interface("IDWriteTextAnalyzer", IUnknown)
53IDWriteInlineObject = Interface("IDWriteInlineObject", IUnknown)
54IDWritePixelSnapping = Interface("IDWritePixelSnapping", IUnknown)
55IDWriteTextRenderer = Interface("IDWriteTextRenderer", IDWritePixelSnapping)
56IDWriteTextLayout = Interface("IDWriteTextLayout", IDWriteTextFormat)
57IDWriteBitmapRenderTarget = Interface("IDWriteBitmapRenderTarget", IUnknown)
58IDWriteGdiInterop = Interface("IDWriteGdiInterop", IUnknown)
59IDWriteGlyphRunAnalysis = Interface("IDWriteGlyphRunAnalysis", IUnknown)
60IDWriteFactory = Interface("IDWriteFactory", IUnknown)
61
62
63def EnumFlag(expr, values):
64 return Flags(Alias(expr, DWORD), values)
65
66
67DWRITE_FONT_FILE_TYPE = Enum("DWRITE_FONT_FILE_TYPE", [
68 "DWRITE_FONT_FILE_TYPE_UNKNOWN",
69 "DWRITE_FONT_FILE_TYPE_CFF",
70 "DWRITE_FONT_FILE_TYPE_TRUETYPE",
71 "DWRITE_FONT_FILE_TYPE_TRUETYPE_COLLECTION",
72 "DWRITE_FONT_FILE_TYPE_TYPE1_PFM",
73 "DWRITE_FONT_FILE_TYPE_TYPE1_PFB",
74 "DWRITE_FONT_FILE_TYPE_VECTOR",
75 "DWRITE_FONT_FILE_TYPE_BITMAP",
76])
77
78DWRITE_FONT_FACE_TYPE = Enum("DWRITE_FONT_FACE_TYPE", [
79 "DWRITE_FONT_FACE_TYPE_CFF",
80 "DWRITE_FONT_FACE_TYPE_TRUETYPE",
81 "DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION",
82 "DWRITE_FONT_FACE_TYPE_TYPE1",
83 "DWRITE_FONT_FACE_TYPE_VECTOR",
84 "DWRITE_FONT_FACE_TYPE_BITMAP",
85 "DWRITE_FONT_FACE_TYPE_UNKNOWN",
86])
87
88DWRITE_FONT_SIMULATIONS = EnumFlag("DWRITE_FONT_SIMULATIONS", [
89 "DWRITE_FONT_SIMULATIONS_NONE",
90 "DWRITE_FONT_SIMULATIONS_BOLD",
91 "DWRITE_FONT_SIMULATIONS_OBLIQUE",
92])
93
94DWRITE_FONT_WEIGHT = Enum("DWRITE_FONT_WEIGHT", [
95 "DWRITE_FONT_WEIGHT_THIN",
96 "DWRITE_FONT_WEIGHT_EXTRA_LIGHT",
97 #"DWRITE_FONT_WEIGHT_ULTRA_LIGHT",
98 "DWRITE_FONT_WEIGHT_LIGHT",
99 "DWRITE_FONT_WEIGHT_NORMAL",
100 #"DWRITE_FONT_WEIGHT_REGULAR",
101 "DWRITE_FONT_WEIGHT_MEDIUM",
102 "DWRITE_FONT_WEIGHT_DEMI_BOLD",
103 #"DWRITE_FONT_WEIGHT_SEMI_BOLD",
104 "DWRITE_FONT_WEIGHT_BOLD",
105 "DWRITE_FONT_WEIGHT_EXTRA_BOLD",
106 #"DWRITE_FONT_WEIGHT_ULTRA_BOLD",
107 "DWRITE_FONT_WEIGHT_BLACK",
108 #"DWRITE_FONT_WEIGHT_HEAVY",
109 "DWRITE_FONT_WEIGHT_EXTRA_BLACK",
110 #"DWRITE_FONT_WEIGHT_ULTRA_BLACK",
111])
112
113DWRITE_FONT_STRETCH = Enum("DWRITE_FONT_STRETCH", [
114 "DWRITE_FONT_STRETCH_UNDEFINED",
115 "DWRITE_FONT_STRETCH_ULTRA_CONDENSED",
116 "DWRITE_FONT_STRETCH_EXTRA_CONDENSED",
117 "DWRITE_FONT_STRETCH_CONDENSED",
118 "DWRITE_FONT_STRETCH_SEMI_CONDENSED",
119 "DWRITE_FONT_STRETCH_NORMAL",
120 #"DWRITE_FONT_STRETCH_MEDIUM",
121 "DWRITE_FONT_STRETCH_SEMI_EXPANDED",
122 "DWRITE_FONT_STRETCH_EXPANDED",
123 "DWRITE_FONT_STRETCH_EXTRA_EXPANDED",
124 "DWRITE_FONT_STRETCH_ULTRA_EXPANDED",
125])
126
127DWRITE_FONT_STYLE = Enum("DWRITE_FONT_STYLE", [
128 "DWRITE_FONT_STYLE_NORMAL",
129 "DWRITE_FONT_STYLE_OBLIQUE",
130 "DWRITE_FONT_STYLE_ITALIC",
131])
132
133DWRITE_INFORMATIONAL_STRING_ID = Enum("DWRITE_INFORMATIONAL_STRING_ID", [
134 "DWRITE_INFORMATIONAL_STRING_NONE",
135 "DWRITE_INFORMATIONAL_STRING_COPYRIGHT_NOTICE",
136 "DWRITE_INFORMATIONAL_STRING_VERSION_STRINGS",
137 "DWRITE_INFORMATIONAL_STRING_TRADEMARK",
138 "DWRITE_INFORMATIONAL_STRING_MANUFACTURER",
139 "DWRITE_INFORMATIONAL_STRING_DESIGNER",
140 "DWRITE_INFORMATIONAL_STRING_DESIGNER_URL",
141 "DWRITE_INFORMATIONAL_STRING_DESCRIPTION",
142 "DWRITE_INFORMATIONAL_STRING_FONT_VENDOR_URL",
143 "DWRITE_INFORMATIONAL_STRING_LICENSE_DESCRIPTION",
144 "DWRITE_INFORMATIONAL_STRING_LICENSE_INFO_URL",
145 "DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES",
146 "DWRITE_INFORMATIONAL_STRING_WIN32_SUBFAMILY_NAMES",
147 "DWRITE_INFORMATIONAL_STRING_PREFERRED_FAMILY_NAMES",
148 "DWRITE_INFORMATIONAL_STRING_PREFERRED_SUBFAMILY_NAMES",
149 "DWRITE_INFORMATIONAL_STRING_SAMPLE_TEXT",
150])
151
152DWRITE_FONT_METRICS = Struct("DWRITE_FONT_METRICS", [
153 (UINT16, "designUnitsPerEm"),
154 (UINT16, "ascent"),
155 (UINT16, "descent"),
156 (INT16, "lineGap"),
157 (UINT16, "capHeight"),
158 (UINT16, "xHeight"),
159 (INT16, "underlinePosition"),
160 (UINT16, "underlineThickness"),
161 (INT16, "strikethroughPosition"),
162 (UINT16, "strikethroughThickness"),
163])
164
165DWRITE_GLYPH_METRICS = Struct("DWRITE_GLYPH_METRICS", [
166 (INT32, "leftSideBearing"),
167 (UINT32, "advanceWidth"),
168 (INT32, "rightSideBearing"),
169 (INT32, "topSideBearing"),
170 (UINT32, "advanceHeight"),
171 (INT32, "bottomSideBearing"),
172 (INT32, "verticalOriginY"),
173])
174
175DWRITE_GLYPH_OFFSET = Struct("DWRITE_GLYPH_OFFSET", [
176 (FLOAT, "advanceOffset"),
177 (FLOAT, "ascenderOffset"),
178])
179
180DWRITE_FACTORY_TYPE = Enum("DWRITE_FACTORY_TYPE", [
181 "DWRITE_FACTORY_TYPE_SHARED",
182 "DWRITE_FACTORY_TYPE_ISOLATED",
183])
184
185IDWriteFontFileLoader.methods += [
186 Method(HRESULT, "CreateStreamFromKey", [(OpaquePointer(Const(Void)), "fontFileReferenceKey"), (UINT32, "fontFileReferenceKeySize"), Out(Pointer(Pointer(IDWriteFontFileStream)), "fontFileStream")]),
187]
188
189IDWriteLocalFontFileLoader.methods += [
190 Method(HRESULT, "GetFilePathLengthFromKey", [(OpaquePointer(Const(Void)), "fontFileReferenceKey"), (UINT32, "fontFileReferenceKeySize"), Out(Pointer(UINT32), "filePathLength")]),
191 Method(HRESULT, "GetFilePathFromKey", [(OpaquePointer(Const(Void)), "fontFileReferenceKey"), (UINT32, "fontFileReferenceKeySize"), Out(Pointer(WCHAR), "filePath"), (UINT32, "filePathSize")]),
192 Method(HRESULT, "GetLastWriteTimeFromKey", [(OpaquePointer(Const(Void)), "fontFileReferenceKey"), (UINT32, "fontFileReferenceKeySize"), Out(Pointer(FILETIME), "lastWriteTime")]),
193]
194
195IDWriteFontFileStream.methods += [
196 Method(HRESULT, "ReadFileFragment", [Out(Pointer(OpaquePointer(Const(Void))), "fragmentStart"), (UINT64, "fileOffset"), (UINT64, "fragmentSize"), Out(Pointer(OpaquePointer(Void)), "fragmentContext")]),
197 Method(Void, "ReleaseFileFragment", [(OpaquePointer(Void), "fragmentContext")]),
198 Method(HRESULT, "GetFileSize", [Out(Pointer(UINT64), "fileSize")]),
199 Method(HRESULT, "GetLastWriteTime", [Out(Pointer(UINT64), "lastWriteTime")]),
200]
201
202IDWriteFontFile.methods += [
203 Method(HRESULT, "GetReferenceKey", [Out(Pointer(OpaquePointer(Const(Void))), "fontFileReferenceKey"), Out(Pointer(UINT32), "fontFileReferenceKeySize")]),
204 Method(HRESULT, "GetLoader", [Out(Pointer(Pointer(IDWriteFontFileLoader)), "fontFileLoader")]),
205 Method(HRESULT, "Analyze", [Out(Pointer(BOOL), "isSupportedFontType"), Out(Pointer(DWRITE_FONT_FILE_TYPE), "fontFileType"), Out(Pointer(DWRITE_FONT_FACE_TYPE), "fontFaceType"), Out(Pointer(UINT32), "numberOfFaces")]),
206]
207
208DWRITE_PIXEL_GEOMETRY = Enum("DWRITE_PIXEL_GEOMETRY", [
209 "DWRITE_PIXEL_GEOMETRY_FLAT",
210 "DWRITE_PIXEL_GEOMETRY_RGB",
211 "DWRITE_PIXEL_GEOMETRY_BGR",
212])
213
214DWRITE_RENDERING_MODE = Enum("DWRITE_RENDERING_MODE", [
215 "DWRITE_RENDERING_MODE_DEFAULT",
216 "DWRITE_RENDERING_MODE_ALIASED",
217 "DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC",
218 "DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL",
219 "DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL",
220 "DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC",
221 "DWRITE_RENDERING_MODE_OUTLINE",
222])
223
224DWRITE_MATRIX = Struct("DWRITE_MATRIX", [
225 (FLOAT, "m11"),
226 (FLOAT, "m12"),
227 (FLOAT, "m21"),
228 (FLOAT, "m22"),
229 (FLOAT, "dx"),
230 (FLOAT, "dy"),
231])
232
233IDWriteRenderingParams.methods += [
234 Method(FLOAT, "GetGamma", []),
235 Method(FLOAT, "GetEnhancedContrast", []),
236 Method(FLOAT, "GetClearTypeLevel", []),
237 Method(DWRITE_PIXEL_GEOMETRY, "GetPixelGeometry", []),
238 Method(DWRITE_RENDERING_MODE, "GetRenderingMode", []),
239]
240
241IDWriteFontFace.methods += [
242 Method(DWRITE_FONT_FACE_TYPE, "GetType", []),
243 Method(HRESULT, "GetFiles", [(OpaquePointer(UINT32), "numberOfFiles"), Out(Pointer(Pointer(IDWriteFontFile)), "fontFiles")]),
244 Method(UINT32, "GetIndex", []),
245 Method(DWRITE_FONT_SIMULATIONS, "GetSimulations", []),
246 Method(BOOL, "IsSymbolFont", []),
247 Method(Void, "GetMetrics", [Out(Pointer(DWRITE_FONT_METRICS), "fontFaceMetrics")]),
248 Method(UINT16, "GetGlyphCount", []),
249 Method(HRESULT, "GetDesignGlyphMetrics", [(Pointer(Const(UINT16)), "glyphIndices"), (UINT32, "glyphCount"), Out(Pointer(DWRITE_GLYPH_METRICS), "glyphMetrics"), (BOOL, "isSideways")]),
250 Method(HRESULT, "GetGlyphIndices", [(Pointer(Const(UINT32)), "codePoints"), (UINT32, "codePointCount"), Out(Pointer(UINT16), "glyphIndices")]),
251 Method(HRESULT, "TryGetFontTable", [(UINT32, "openTypeTableTag"), Out(Pointer(OpaquePointer(Const(Void))), "tableData"), Out(Pointer(UINT32), "tableSize"), Out(Pointer(OpaquePointer(Void)), "tableContext"), Out(Pointer(BOOL), "exists")]),
252 Method(Void, "ReleaseFontTable", [(OpaquePointer(Void), "tableContext")]),
253 Method(HRESULT, "GetGlyphRunOutline", [(FLOAT, "emSize"), (Pointer(Const(UINT16)), "glyphIndices"), (Pointer(Const(FLOAT)), "glyphAdvances"), (Pointer(Const(DWRITE_GLYPH_OFFSET)), "glyphOffsets"), (UINT32, "glyphCount"), (BOOL, "isSideways"), (BOOL, "isRightToLeft"), (Pointer(IDWriteGeometrySink), "geometrySink")]),
254 Method(HRESULT, "GetRecommendedRenderingMode", [(FLOAT, "emSize"), (FLOAT, "pixelsPerDip"), (DWRITE_MEASURING_MODE, "measuringMode"), (Pointer(IDWriteRenderingParams), "renderingParams"), Out(Pointer(DWRITE_RENDERING_MODE), "renderingMode")]),
255]
256
257IDWriteFontCollectionLoader.methods += [
258 Method(HRESULT, "CreateEnumeratorFromKey", [(Pointer(IDWriteFactory), "factory"), (OpaquePointer(Const(Void)), "collectionKey"), (UINT32, "collectionKeySize"), Out(Pointer(Pointer(IDWriteFontFileEnumerator)), "fontFileEnumerator")]),
259]
260
261IDWriteFontFileEnumerator.methods += [
262 Method(HRESULT, "MoveNext", [Out(Pointer(BOOL), "hasCurrentFile")]),
263 Method(HRESULT, "GetCurrentFontFile", [Out(Pointer(Pointer(IDWriteFontFile)), "fontFile")]),
264]
265
266IDWriteLocalizedStrings.methods += [
267 Method(UINT32, "GetCount", []),
268 Method(HRESULT, "FindLocaleName", [(Pointer(Const(WCHAR)), "localeName"), Out(Pointer(UINT32), "index"), Out(Pointer(BOOL), "exists")]),
269 Method(HRESULT, "GetLocaleNameLength", [(UINT32, "index"), Out(Pointer(UINT32), "length")]),
270 Method(HRESULT, "GetLocaleName", [(UINT32, "index"), Out(Pointer(WCHAR), "localeName"), (UINT32, "size")]),
271 Method(HRESULT, "GetStringLength", [(UINT32, "index"), Out(Pointer(UINT32), "length")]),
272 Method(HRESULT, "GetString", [(UINT32, "index"), Out(Pointer(WCHAR), "stringBuffer"), (UINT32, "size")]),
273]
274
275IDWriteFontCollection.methods += [
276 Method(UINT32, "GetFontFamilyCount", []),
277 Method(HRESULT, "GetFontFamily", [(UINT32, "index"), Out(Pointer(Pointer(IDWriteFontFamily)), "fontFamily")]),
278 Method(HRESULT, "FindFamilyName", [(Pointer(Const(WCHAR)), "familyName"), Out(Pointer(UINT32), "index"), Out(Pointer(BOOL), "exists")]),
279 Method(HRESULT, "GetFontFromFontFace", [(Pointer(IDWriteFontFace), "fontFace"), Out(Pointer(Pointer(IDWriteFont)), "font")]),
280]
281
282IDWriteFontList.methods += [
283 Method(HRESULT, "GetFontCollection", [Out(Pointer(Pointer(IDWriteFontCollection)), "fontCollection")]),
284 Method(UINT32, "GetFontCount", []),
285 Method(HRESULT, "GetFont", [(UINT32, "index"), Out(Pointer(Pointer(IDWriteFont)), "font")]),
286]
287
288IDWriteFontFamily.methods += [
289 Method(HRESULT, "GetFamilyNames", [Out(Pointer(Pointer(IDWriteLocalizedStrings)), "names")]),
290 Method(HRESULT, "GetFirstMatchingFont", [(DWRITE_FONT_WEIGHT, "weight"), (DWRITE_FONT_STRETCH, "stretch"), (DWRITE_FONT_STYLE, "style"), Out(Pointer(Pointer(IDWriteFont)), "matchingFont")]),
291 Method(HRESULT, "GetMatchingFonts", [(DWRITE_FONT_WEIGHT, "weight"), (DWRITE_FONT_STRETCH, "stretch"), (DWRITE_FONT_STYLE, "style"), Out(Pointer(Pointer(IDWriteFontList)), "matchingFonts")]),
292]
293
294IDWriteFont.methods += [
295 Method(HRESULT, "GetFontFamily", [Out(Pointer(Pointer(IDWriteFontFamily)), "fontFamily")]),
296 Method(DWRITE_FONT_WEIGHT, "GetWeight", []),
297 Method(DWRITE_FONT_STRETCH, "GetStretch", []),
298 Method(DWRITE_FONT_STYLE, "GetStyle", []),
299 Method(BOOL, "IsSymbolFont", []),
300 Method(HRESULT, "GetFaceNames", [Out(Pointer(Pointer(IDWriteLocalizedStrings)), "names")]),
301 Method(HRESULT, "GetInformationalStrings", [(DWRITE_INFORMATIONAL_STRING_ID, "informationalStringID"), Out(Pointer(Pointer(IDWriteLocalizedStrings)), "informationalStrings"), Out(Pointer(BOOL), "exists")]),
302 Method(DWRITE_FONT_SIMULATIONS, "GetSimulations", []),
303 Method(Void, "GetMetrics", [Out(Pointer(DWRITE_FONT_METRICS), "fontMetrics")]),
304 Method(HRESULT, "HasCharacter", [(UINT32, "unicodeValue"), Out(Pointer(BOOL), "exists")]),
305 Method(HRESULT, "CreateFontFace", [Out(Pointer(Pointer(IDWriteFontFace)), "fontFace")]),
306]
307
308DWRITE_READING_DIRECTION = Enum("DWRITE_READING_DIRECTION", [
309 "DWRITE_READING_DIRECTION_LEFT_TO_RIGHT",
310 "DWRITE_READING_DIRECTION_RIGHT_TO_LEFT",
311])
312
313DWRITE_FLOW_DIRECTION = Enum("DWRITE_FLOW_DIRECTION", [
314 "DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM",
315])
316
317DWRITE_TEXT_ALIGNMENT = Enum("DWRITE_TEXT_ALIGNMENT", [
318 "DWRITE_TEXT_ALIGNMENT_LEADING",
319 "DWRITE_TEXT_ALIGNMENT_TRAILING",
320 "DWRITE_TEXT_ALIGNMENT_CENTER",
321])
322
323DWRITE_PARAGRAPH_ALIGNMENT = Enum("DWRITE_PARAGRAPH_ALIGNMENT", [
324 "DWRITE_PARAGRAPH_ALIGNMENT_NEAR",
325 "DWRITE_PARAGRAPH_ALIGNMENT_FAR",
326 "DWRITE_PARAGRAPH_ALIGNMENT_CENTER",
327])
328
329DWRITE_WORD_WRAPPING = Enum("DWRITE_WORD_WRAPPING", [
330 "DWRITE_WORD_WRAPPING_WRAP",
331 "DWRITE_WORD_WRAPPING_NO_WRAP",
332])
333
334DWRITE_LINE_SPACING_METHOD = Enum("DWRITE_LINE_SPACING_METHOD", [
335 "DWRITE_LINE_SPACING_METHOD_DEFAULT",
336 "DWRITE_LINE_SPACING_METHOD_UNIFORM",
337])
338
339DWRITE_TRIMMING_GRANULARITY = Enum("DWRITE_TRIMMING_GRANULARITY", [
340 "DWRITE_TRIMMING_GRANULARITY_NONE",
341 "DWRITE_TRIMMING_GRANULARITY_CHARACTER",
342 "DWRITE_TRIMMING_GRANULARITY_WORD",
343])
344
345DWRITE_FONT_FEATURE_TAG = Enum("DWRITE_FONT_FEATURE_TAG", [
346 "DWRITE_FONT_FEATURE_TAG_ALTERNATIVE_FRACTIONS",
347 "DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS_FROM_CAPITALS",
348 "DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS_FROM_CAPITALS",
349 "DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_ALTERNATES",
350 "DWRITE_FONT_FEATURE_TAG_CASE_SENSITIVE_FORMS",
351 "DWRITE_FONT_FEATURE_TAG_GLYPH_COMPOSITION_DECOMPOSITION",
352 "DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_LIGATURES",
353 "DWRITE_FONT_FEATURE_TAG_CAPITAL_SPACING",
354 "DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_SWASH",
355 "DWRITE_FONT_FEATURE_TAG_CURSIVE_POSITIONING",
356 "DWRITE_FONT_FEATURE_TAG_DEFAULT",
357 "DWRITE_FONT_FEATURE_TAG_DISCRETIONARY_LIGATURES",
358 "DWRITE_FONT_FEATURE_TAG_EXPERT_FORMS",
359 "DWRITE_FONT_FEATURE_TAG_FRACTIONS",
360 "DWRITE_FONT_FEATURE_TAG_FULL_WIDTH",
361 "DWRITE_FONT_FEATURE_TAG_HALF_FORMS",
362 "DWRITE_FONT_FEATURE_TAG_HALANT_FORMS",
363 "DWRITE_FONT_FEATURE_TAG_ALTERNATE_HALF_WIDTH",
364 "DWRITE_FONT_FEATURE_TAG_HISTORICAL_FORMS",
365 "DWRITE_FONT_FEATURE_TAG_HORIZONTAL_KANA_ALTERNATES",
366 "DWRITE_FONT_FEATURE_TAG_HISTORICAL_LIGATURES",
367 "DWRITE_FONT_FEATURE_TAG_HALF_WIDTH",
368 "DWRITE_FONT_FEATURE_TAG_HOJO_KANJI_FORMS",
369 "DWRITE_FONT_FEATURE_TAG_JIS04_FORMS",
370 "DWRITE_FONT_FEATURE_TAG_JIS78_FORMS",
371 "DWRITE_FONT_FEATURE_TAG_JIS83_FORMS",
372 "DWRITE_FONT_FEATURE_TAG_JIS90_FORMS",
373 "DWRITE_FONT_FEATURE_TAG_KERNING",
374 "DWRITE_FONT_FEATURE_TAG_STANDARD_LIGATURES",
375 "DWRITE_FONT_FEATURE_TAG_LINING_FIGURES",
376 "DWRITE_FONT_FEATURE_TAG_LOCALIZED_FORMS",
377 "DWRITE_FONT_FEATURE_TAG_MARK_POSITIONING",
378 "DWRITE_FONT_FEATURE_TAG_MATHEMATICAL_GREEK",
379 "DWRITE_FONT_FEATURE_TAG_MARK_TO_MARK_POSITIONING",
380 "DWRITE_FONT_FEATURE_TAG_ALTERNATE_ANNOTATION_FORMS",
381 "DWRITE_FONT_FEATURE_TAG_NLC_KANJI_FORMS",
382 "DWRITE_FONT_FEATURE_TAG_OLD_STYLE_FIGURES",
383 "DWRITE_FONT_FEATURE_TAG_ORDINALS",
384 "DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_ALTERNATE_WIDTH",
385 "DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS",
386 "DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_FIGURES",
387 "DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_WIDTHS",
388 "DWRITE_FONT_FEATURE_TAG_QUARTER_WIDTHS",
389 "DWRITE_FONT_FEATURE_TAG_REQUIRED_LIGATURES",
390 "DWRITE_FONT_FEATURE_TAG_RUBY_NOTATION_FORMS",
391 "DWRITE_FONT_FEATURE_TAG_STYLISTIC_ALTERNATES",
392 "DWRITE_FONT_FEATURE_TAG_SCIENTIFIC_INFERIORS",
393 "DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS",
394 "DWRITE_FONT_FEATURE_TAG_SIMPLIFIED_FORMS",
395 "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1",
396 "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_2",
397 "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_3",
398 "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_4",
399 "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_5",
400 "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_6",
401 "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_7",
402 "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_8",
403 "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_9",
404 "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_10",
405 "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_11",
406 "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_12",
407 "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_13",
408 "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_14",
409 "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_15",
410 "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_16",
411 "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_17",
412 "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_18",
413 "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_19",
414 "DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_20",
415 "DWRITE_FONT_FEATURE_TAG_SUBSCRIPT",
416 "DWRITE_FONT_FEATURE_TAG_SUPERSCRIPT",
417 "DWRITE_FONT_FEATURE_TAG_SWASH",
418 "DWRITE_FONT_FEATURE_TAG_TITLING",
419 "DWRITE_FONT_FEATURE_TAG_TRADITIONAL_NAME_FORMS",
420 "DWRITE_FONT_FEATURE_TAG_TABULAR_FIGURES",
421 "DWRITE_FONT_FEATURE_TAG_TRADITIONAL_FORMS",
422 "DWRITE_FONT_FEATURE_TAG_THIRD_WIDTHS",
423 "DWRITE_FONT_FEATURE_TAG_UNICASE",
424 "DWRITE_FONT_FEATURE_TAG_SLASHED_ZERO",
425])
426
427DWRITE_TEXT_RANGE = Struct("DWRITE_TEXT_RANGE", [
428 (UINT32, "startPosition"),
429 (UINT32, "length"),
430])
431
432DWRITE_FONT_FEATURE = Struct("DWRITE_FONT_FEATURE", [
433 (DWRITE_FONT_FEATURE_TAG, "nameTag"),
434 (UINT32, "parameter"),
435])
436
437DWRITE_TYPOGRAPHIC_FEATURES = Struct("DWRITE_TYPOGRAPHIC_FEATURES", [
438 (OpaquePointer(DWRITE_FONT_FEATURE), "features"),
439 (UINT32, "featureCount"),
440])
441
442DWRITE_TRIMMING = Struct("DWRITE_TRIMMING", [
443 (DWRITE_TRIMMING_GRANULARITY, "granularity"),
444 (UINT32, "delimiter"),
445 (UINT32, "delimiterCount"),
446])
447
448IDWriteTextFormat.methods += [
449 Method(HRESULT, "SetTextAlignment", [(DWRITE_TEXT_ALIGNMENT, "textAlignment")]),
450 Method(HRESULT, "SetParagraphAlignment", [(DWRITE_PARAGRAPH_ALIGNMENT, "paragraphAlignment")]),
451 Method(HRESULT, "SetWordWrapping", [(DWRITE_WORD_WRAPPING, "wordWrapping")]),
452 Method(HRESULT, "SetReadingDirection", [(DWRITE_READING_DIRECTION, "readingDirection")]),
453 Method(HRESULT, "SetFlowDirection", [(DWRITE_FLOW_DIRECTION, "flowDirection")]),
454 Method(HRESULT, "SetIncrementalTabStop", [(FLOAT, "incrementalTabStop")]),
455 Method(HRESULT, "SetTrimming", [(Pointer(Const(DWRITE_TRIMMING)), "trimmingOptions"), (Pointer(IDWriteInlineObject), "trimmingSign")]),
456 Method(HRESULT, "SetLineSpacing", [(DWRITE_LINE_SPACING_METHOD, "lineSpacingMethod"), (FLOAT, "lineSpacing"), (FLOAT, "baseline")]),
457 Method(DWRITE_TEXT_ALIGNMENT, "GetTextAlignment", []),
458 Method(DWRITE_PARAGRAPH_ALIGNMENT, "GetParagraphAlignment", []),
459 Method(DWRITE_WORD_WRAPPING, "GetWordWrapping", []),
460 Method(DWRITE_READING_DIRECTION, "GetReadingDirection", []),
461 Method(DWRITE_FLOW_DIRECTION, "GetFlowDirection", []),
462 Method(FLOAT, "GetIncrementalTabStop", []),
463 Method(HRESULT, "GetTrimming", [Out(Pointer(DWRITE_TRIMMING), "trimmingOptions"), Out(Pointer(Pointer(IDWriteInlineObject)), "trimmingSign")]),
464 Method(HRESULT, "GetLineSpacing", [Out(Pointer(DWRITE_LINE_SPACING_METHOD), "lineSpacingMethod"), Out(Pointer(FLOAT), "lineSpacing"), Out(Pointer(FLOAT), "baseline")]),
465 Method(HRESULT, "GetFontCollection", [Out(Pointer(Pointer(IDWriteFontCollection)), "fontCollection")]),
466 Method(UINT32, "GetFontFamilyNameLength", []),
467 Method(HRESULT, "GetFontFamilyName", [Out(Pointer(WCHAR), "fontFamilyName"), (UINT32, "nameSize")]),
468 Method(DWRITE_FONT_WEIGHT, "GetFontWeight", []),
469 Method(DWRITE_FONT_STYLE, "GetFontStyle", []),
470 Method(DWRITE_FONT_STRETCH, "GetFontStretch", []),
471 Method(FLOAT, "GetFontSize", []),
472 Method(UINT32, "GetLocaleNameLength", []),
473 Method(HRESULT, "GetLocaleName", [Out(Pointer(WCHAR), "localeName"), (UINT32, "nameSize")]),
474]
475
476IDWriteTypography.methods += [
477 Method(HRESULT, "AddFontFeature", [(DWRITE_FONT_FEATURE, "fontFeature")]),
478 Method(UINT32, "GetFontFeatureCount", []),
479 Method(HRESULT, "GetFontFeature", [(UINT32, "fontFeatureIndex"), Out(Pointer(DWRITE_FONT_FEATURE), "fontFeature")]),
480]
481
482DWRITE_SCRIPT_SHAPES = EnumFlag("DWRITE_SCRIPT_SHAPES", [
483 "DWRITE_SCRIPT_SHAPES_DEFAULT",
484 "DWRITE_SCRIPT_SHAPES_NO_VISUAL",
485])
486
487DWRITE_SCRIPT_ANALYSIS = Struct("DWRITE_SCRIPT_ANALYSIS", [
488 (UINT16, "script"),
489 (DWRITE_SCRIPT_SHAPES, "shapes"),
490])
491
492DWRITE_BREAK_CONDITION = Enum("DWRITE_BREAK_CONDITION", [
493 "DWRITE_BREAK_CONDITION_NEUTRAL",
494 "DWRITE_BREAK_CONDITION_CAN_BREAK",
495 "DWRITE_BREAK_CONDITION_MAY_NOT_BREAK",
496 "DWRITE_BREAK_CONDITION_MUST_BREAK",
497])
498
499DWRITE_LINE_BREAKPOINT = Struct("DWRITE_LINE_BREAKPOINT", [
500 (UINT8, "breakConditionBefore"),
501 (UINT8, "breakConditionAfter"),
502 (UINT8, "isWhitespace"),
503 (UINT8, "isSoftHyphen"),
504 (UINT8, "padding"),
505])
506
507DWRITE_NUMBER_SUBSTITUTION_METHOD = Enum("DWRITE_NUMBER_SUBSTITUTION_METHOD", [
508 "DWRITE_NUMBER_SUBSTITUTION_METHOD_FROM_CULTURE",
509 "DWRITE_NUMBER_SUBSTITUTION_METHOD_CONTEXTUAL",
510 "DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE",
511 "DWRITE_NUMBER_SUBSTITUTION_METHOD_NATIONAL",
512 "DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL",
513])
514
515IDWriteNumberSubstitution.methods += [
516]
517
518DWRITE_SHAPING_TEXT_PROPERTIES = Struct("DWRITE_SHAPING_TEXT_PROPERTIES", [
519 (UINT16, "isShapedAlone"),
520 (UINT16, "reserved"),
521])
522
523DWRITE_SHAPING_GLYPH_PROPERTIES = Struct("DWRITE_SHAPING_GLYPH_PROPERTIES", [
524 (UINT16, "justification"),
525 (UINT16, "isClusterStart"),
526 (UINT16, "isDiacritic"),
527 (UINT16, "isZeroWidthSpace"),
528 (UINT16, "reserved"),
529])
530
531IDWriteTextAnalysisSource.methods += [
532 Method(HRESULT, "GetTextAtPosition", [(UINT32, "textPosition"), Out(Pointer(Pointer(Const(WCHAR))), "textString"), Out(Pointer(UINT32), "textLength")]),
533 Method(HRESULT, "GetTextBeforePosition", [(UINT32, "textPosition"), Out(Pointer(Pointer(Const(WCHAR))), "textString"), Out(Pointer(UINT32), "textLength")]),
534 Method(DWRITE_READING_DIRECTION, "GetParagraphReadingDirection", []),
535 Method(HRESULT, "GetLocaleName", [(UINT32, "textPosition"), Out(Pointer(UINT32), "textLength"), Out(Pointer(Pointer(Const(WCHAR))), "localeName")]),
536 Method(HRESULT, "GetNumberSubstitution", [(UINT32, "textPosition"), Out(Pointer(UINT32), "textLength"), Out(Pointer(Pointer(IDWriteNumberSubstitution)), "numberSubstitution")]),
537]
538
539IDWriteTextAnalysisSink.methods += [
540 Method(HRESULT, "SetScriptAnalysis", [(UINT32, "textPosition"), (UINT32, "textLength"), (Pointer(Const(DWRITE_SCRIPT_ANALYSIS)), "scriptAnalysis")]),
541 Method(HRESULT, "SetLineBreakpoints", [(UINT32, "textPosition"), (UINT32, "textLength"), (Pointer(Const(DWRITE_LINE_BREAKPOINT)), "lineBreakpoints")]),
542 Method(HRESULT, "SetBidiLevel", [(UINT32, "textPosition"), (UINT32, "textLength"), (UINT8, "explicitLevel"), (UINT8, "resolvedLevel")]),
543 Method(HRESULT, "SetNumberSubstitution", [(UINT32, "textPosition"), (UINT32, "textLength"), (Pointer(IDWriteNumberSubstitution), "numberSubstitution")]),
544]
545
546IDWriteTextAnalyzer.methods += [
547 Method(HRESULT, "AnalyzeScript", [(Pointer(IDWriteTextAnalysisSource), "analysisSource"), (UINT32, "textPosition"), (UINT32, "textLength"), (Pointer(IDWriteTextAnalysisSink), "analysisSink")]),
548 Method(HRESULT, "AnalyzeBidi", [(Pointer(IDWriteTextAnalysisSource), "analysisSource"), (UINT32, "textPosition"), (UINT32, "textLength"), (Pointer(IDWriteTextAnalysisSink), "analysisSink")]),
549 Method(HRESULT, "AnalyzeNumberSubstitution", [(Pointer(IDWriteTextAnalysisSource), "analysisSource"), (UINT32, "textPosition"), (UINT32, "textLength"), (Pointer(IDWriteTextAnalysisSink), "analysisSink")]),
550 Method(HRESULT, "AnalyzeLineBreakpoints", [(Pointer(IDWriteTextAnalysisSource), "analysisSource"), (UINT32, "textPosition"), (UINT32, "textLength"), (Pointer(IDWriteTextAnalysisSink), "analysisSink")]),
551 Method(HRESULT, "GetGlyphs", [(Pointer(Const(WCHAR)), "textString"), (UINT32, "textLength"), (Pointer(IDWriteFontFace), "fontFace"), (BOOL, "isSideways"), (BOOL, "isRightToLeft"), (Pointer(Const(DWRITE_SCRIPT_ANALYSIS)), "scriptAnalysis"), (Pointer(Const(WCHAR)), "localeName"), (Pointer(IDWriteNumberSubstitution), "numberSubstitution"), (OpaquePointer(Pointer(Const(DWRITE_TYPOGRAPHIC_FEATURES))), "features"), (Pointer(Const(UINT32)), "featureRangeLengths"), (UINT32, "featureRanges"), (UINT32, "maxGlyphCount"), Out(Pointer(UINT16), "clusterMap"), Out(Pointer(DWRITE_SHAPING_TEXT_PROPERTIES), "textProps"), Out(Pointer(UINT16), "glyphIndices"), Out(Pointer(DWRITE_SHAPING_GLYPH_PROPERTIES), "glyphProps"), Out(Pointer(UINT32), "actualGlyphCount")]),
552 Method(HRESULT, "GetGlyphPlacements", [(Pointer(Const(WCHAR)), "textString"), (Pointer(Const(UINT16)), "clusterMap"), (OpaquePointer(DWRITE_SHAPING_TEXT_PROPERTIES), "textProps"), (UINT32, "textLength"), (Pointer(Const(UINT16)), "glyphIndices"), (Pointer(Const(DWRITE_SHAPING_GLYPH_PROPERTIES)), "glyphProps"), (UINT32, "glyphCount"), (Pointer(IDWriteFontFace), "fontFace"), (FLOAT, "fontEmSize"), (BOOL, "isSideways"), (BOOL, "isRightToLeft"), (Pointer(Const(DWRITE_SCRIPT_ANALYSIS)), "scriptAnalysis"), (Pointer(Const(WCHAR)), "localeName"), (OpaquePointer(Pointer(Const(DWRITE_TYPOGRAPHIC_FEATURES))), "features"), (Pointer(Const(UINT32)), "featureRangeLengths"), (UINT32, "featureRanges"), Out(Pointer(FLOAT), "glyphAdvances"), Out(Pointer(DWRITE_GLYPH_OFFSET), "glyphOffsets")]),
553]
554
555DWRITE_GLYPH_RUN = Struct("DWRITE_GLYPH_RUN", [
556 (Pointer(IDWriteFontFace), "fontFace"),
557 (FLOAT, "fontEmSize"),
558 (UINT32, "glyphCount"),
559 (Pointer(Const(UINT16)), "glyphIndices"),
560 (Pointer(Const(FLOAT)), "glyphAdvances"),
561 (Pointer(Const(DWRITE_GLYPH_OFFSET)), "glyphOffsets"),
562 (BOOL, "isSideways"),
563 (UINT32, "bidiLevel"),
564])
565
566DWRITE_GLYPH_RUN_DESCRIPTION = Struct("DWRITE_GLYPH_RUN_DESCRIPTION", [
567 (Pointer(Const(WCHAR)), "localeName"),
568 (Pointer(Const(WCHAR)), "string"),
569 (UINT32, "stringLength"),
570 (Pointer(Const(UINT16)), "clusterMap"),
571 (UINT32, "textPosition"),
572])
573
574DWRITE_UNDERLINE = Struct("DWRITE_UNDERLINE", [
575 (FLOAT, "width"),
576 (FLOAT, "thickness"),
577 (FLOAT, "offset"),
578 (FLOAT, "runHeight"),
579 (DWRITE_READING_DIRECTION, "readingDirection"),
580 (DWRITE_FLOW_DIRECTION, "flowDirection"),
581 (Pointer(Const(WCHAR)), "localeName"),
582 (DWRITE_MEASURING_MODE, "measuringMode"),
583])
584
585DWRITE_STRIKETHROUGH = Struct("DWRITE_STRIKETHROUGH", [
586 (FLOAT, "width"),
587 (FLOAT, "thickness"),
588 (FLOAT, "offset"),
589 (DWRITE_READING_DIRECTION, "readingDirection"),
590 (DWRITE_FLOW_DIRECTION, "flowDirection"),
591 (Pointer(Const(WCHAR)), "localeName"),
592 (DWRITE_MEASURING_MODE, "measuringMode"),
593])
594
595DWRITE_LINE_METRICS = Struct("DWRITE_LINE_METRICS", [
596 (UINT32, "length"),
597 (UINT32, "trailingWhitespaceLength"),
598 (UINT32, "newlineLength"),
599 (FLOAT, "height"),
600 (FLOAT, "baseline"),
601 (BOOL, "isTrimmed"),
602])
603
604DWRITE_CLUSTER_METRICS = Struct("DWRITE_CLUSTER_METRICS", [
605 (FLOAT, "width"),
606 (UINT16, "length"),
607 (UINT16, "canWrapLineAfter"),
608 (UINT16, "isWhitespace"),
609 (UINT16, "isNewline"),
610 (UINT16, "isSoftHyphen"),
611 (UINT16, "isRightToLeft"),
612 (UINT16, "padding"),
613])
614
615DWRITE_TEXT_METRICS = Struct("DWRITE_TEXT_METRICS", [
616 (FLOAT, "left"),
617 (FLOAT, "top"),
618 (FLOAT, "width"),
619 (FLOAT, "widthIncludingTrailingWhitespace"),
620 (FLOAT, "height"),
621 (FLOAT, "layoutWidth"),
622 (FLOAT, "layoutHeight"),
623 (UINT32, "maxBidiReorderingDepth"),
624 (UINT32, "lineCount"),
625])
626
627DWRITE_INLINE_OBJECT_METRICS = Struct("DWRITE_INLINE_OBJECT_METRICS", [
628 (FLOAT, "width"),
629 (FLOAT, "height"),
630 (FLOAT, "baseline"),
631 (BOOL, "supportsSideways"),
632])
633
634DWRITE_OVERHANG_METRICS = Struct("DWRITE_OVERHANG_METRICS", [
635 (FLOAT, "left"),
636 (FLOAT, "top"),
637 (FLOAT, "right"),
638 (FLOAT, "bottom"),
639])
640
641DWRITE_HIT_TEST_METRICS = Struct("DWRITE_HIT_TEST_METRICS", [
642 (UINT32, "textPosition"),
643 (UINT32, "length"),
644 (FLOAT, "left"),
645 (FLOAT, "top"),
646 (FLOAT, "width"),
647 (FLOAT, "height"),
648 (UINT32, "bidiLevel"),
649 (BOOL, "isText"),
650 (BOOL, "isTrimmed"),
651])
652
653IDWriteInlineObject.methods += [
654 Method(HRESULT, "Draw", [(OpaquePointer(Void), "clientDrawingContext"), (Pointer(IDWriteTextRenderer), "renderer"), (FLOAT, "originX"), (FLOAT, "originY"), (BOOL, "isSideways"), (BOOL, "isRightToLeft"), (Pointer(IUnknown), "clientDrawingEffect")]),
655 Method(HRESULT, "GetMetrics", [Out(Pointer(DWRITE_INLINE_OBJECT_METRICS), "metrics")]),
656 Method(HRESULT, "GetOverhangMetrics", [Out(Pointer(DWRITE_OVERHANG_METRICS), "overhangs")]),
657 Method(HRESULT, "GetBreakConditions", [Out(Pointer(DWRITE_BREAK_CONDITION), "breakConditionBefore"), Out(Pointer(DWRITE_BREAK_CONDITION), "breakConditionAfter")]),
658]
659
660IDWritePixelSnapping.methods += [
661 Method(HRESULT, "IsPixelSnappingDisabled", [(OpaquePointer(Void), "clientDrawingContext"), Out(Pointer(BOOL), "isDisabled")]),
662 Method(HRESULT, "GetCurrentTransform", [(OpaquePointer(Void), "clientDrawingContext"), Out(Pointer(DWRITE_MATRIX), "transform")]),
663 Method(HRESULT, "GetPixelsPerDip", [(OpaquePointer(Void), "clientDrawingContext"), Out(Pointer(FLOAT), "pixelsPerDip")]),
664]
665
666IDWriteTextRenderer.methods += [
667 Method(HRESULT, "DrawGlyphRun", [(OpaquePointer(Void), "clientDrawingContext"), (FLOAT, "baselineOriginX"), (FLOAT, "baselineOriginY"), (DWRITE_MEASURING_MODE, "measuringMode"), (Pointer(Const(DWRITE_GLYPH_RUN)), "glyphRun"), (Pointer(Const(DWRITE_GLYPH_RUN_DESCRIPTION)), "glyphRunDescription"), (Pointer(IUnknown), "clientDrawingEffect")]),
668 Method(HRESULT, "DrawUnderline", [(OpaquePointer(Void), "clientDrawingContext"), (FLOAT, "baselineOriginX"), (FLOAT, "baselineOriginY"), (Pointer(Const(DWRITE_UNDERLINE)), "underline"), (Pointer(IUnknown), "clientDrawingEffect")]),
669 Method(HRESULT, "DrawStrikethrough", [(OpaquePointer(Void), "clientDrawingContext"), (FLOAT, "baselineOriginX"), (FLOAT, "baselineOriginY"), (Pointer(Const(DWRITE_STRIKETHROUGH)), "strikethrough"), (Pointer(IUnknown), "clientDrawingEffect")]),
670 Method(HRESULT, "DrawInlineObject", [(OpaquePointer(Void), "clientDrawingContext"), (FLOAT, "originX"), (FLOAT, "originY"), (Pointer(IDWriteInlineObject), "inlineObject"), (BOOL, "isSideways"), (BOOL, "isRightToLeft"), (Pointer(IUnknown), "clientDrawingEffect")]),
671]
672
673IDWriteTextLayout.methods += [
674 Method(HRESULT, "SetMaxWidth", [(FLOAT, "maxWidth")]),
675 Method(HRESULT, "SetMaxHeight", [(FLOAT, "maxHeight")]),
676 Method(HRESULT, "SetFontCollection", [(Pointer(IDWriteFontCollection), "fontCollection"), (DWRITE_TEXT_RANGE, "textRange")]),
677 Method(HRESULT, "SetFontFamilyName", [(Pointer(Const(WCHAR)), "fontFamilyName"), (DWRITE_TEXT_RANGE, "textRange")]),
678 Method(HRESULT, "SetFontWeight", [(DWRITE_FONT_WEIGHT, "fontWeight"), (DWRITE_TEXT_RANGE, "textRange")]),
679 Method(HRESULT, "SetFontStyle", [(DWRITE_FONT_STYLE, "fontStyle"), (DWRITE_TEXT_RANGE, "textRange")]),
680 Method(HRESULT, "SetFontStretch", [(DWRITE_FONT_STRETCH, "fontStretch"), (DWRITE_TEXT_RANGE, "textRange")]),
681 Method(HRESULT, "SetFontSize", [(FLOAT, "fontSize"), (DWRITE_TEXT_RANGE, "textRange")]),
682 Method(HRESULT, "SetUnderline", [(BOOL, "hasUnderline"), (DWRITE_TEXT_RANGE, "textRange")]),
683 Method(HRESULT, "SetStrikethrough", [(BOOL, "hasStrikethrough"), (DWRITE_TEXT_RANGE, "textRange")]),
684 Method(HRESULT, "SetDrawingEffect", [(Pointer(IUnknown), "drawingEffect"), (DWRITE_TEXT_RANGE, "textRange")]),
685 Method(HRESULT, "SetInlineObject", [(Pointer(IDWriteInlineObject), "inlineObject"), (DWRITE_TEXT_RANGE, "textRange")]),
686 Method(HRESULT, "SetTypography", [(Pointer(IDWriteTypography), "typography"), (DWRITE_TEXT_RANGE, "textRange")]),
687 Method(HRESULT, "SetLocaleName", [(Pointer(Const(WCHAR)), "localeName"), (DWRITE_TEXT_RANGE, "textRange")]),
688 Method(FLOAT, "GetMaxWidth", []),
689 Method(FLOAT, "GetMaxHeight", []),
690 Method(HRESULT, "GetFontCollection", [(UINT32, "currentPosition"), Out(Pointer(Pointer(IDWriteFontCollection)), "fontCollection"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
691 Method(HRESULT, "GetFontFamilyNameLength", [(UINT32, "currentPosition"), Out(Pointer(UINT32), "nameLength"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
692 Method(HRESULT, "GetFontFamilyName", [(UINT32, "currentPosition"), Out(Pointer(WCHAR), "fontFamilyName"), (UINT32, "nameSize"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
693 Method(HRESULT, "GetFontWeight", [(UINT32, "currentPosition"), Out(Pointer(DWRITE_FONT_WEIGHT), "fontWeight"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
694 Method(HRESULT, "GetFontStyle", [(UINT32, "currentPosition"), Out(Pointer(DWRITE_FONT_STYLE), "fontStyle"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
695 Method(HRESULT, "GetFontStretch", [(UINT32, "currentPosition"), Out(Pointer(DWRITE_FONT_STRETCH), "fontStretch"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
696 Method(HRESULT, "GetFontSize", [(UINT32, "currentPosition"), Out(Pointer(FLOAT), "fontSize"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
697 Method(HRESULT, "GetUnderline", [(UINT32, "currentPosition"), Out(Pointer(BOOL), "hasUnderline"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
698 Method(HRESULT, "GetStrikethrough", [(UINT32, "currentPosition"), Out(Pointer(BOOL), "hasStrikethrough"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
699 Method(HRESULT, "GetDrawingEffect", [(UINT32, "currentPosition"), Out(Pointer(Pointer(IUnknown)), "drawingEffect"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
700 Method(HRESULT, "GetInlineObject", [(UINT32, "currentPosition"), Out(Pointer(Pointer(IDWriteInlineObject)), "inlineObject"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
701 Method(HRESULT, "GetTypography", [(UINT32, "currentPosition"), Out(Pointer(Pointer(IDWriteTypography)), "typography"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
702 Method(HRESULT, "GetLocaleNameLength", [(UINT32, "currentPosition"), Out(Pointer(UINT32), "nameLength"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
703 Method(HRESULT, "GetLocaleName", [(UINT32, "currentPosition"), Out(Pointer(WCHAR), "localeName"), (UINT32, "nameSize"), Out(Pointer(DWRITE_TEXT_RANGE), "textRange")]),
704 Method(HRESULT, "Draw", [(OpaquePointer(Void), "clientDrawingContext"), (Pointer(IDWriteTextRenderer), "renderer"), (FLOAT, "originX"), (FLOAT, "originY")]),
705 Method(HRESULT, "GetLineMetrics", [Out(Pointer(DWRITE_LINE_METRICS), "lineMetrics"), (UINT32, "maxLineCount"), Out(Pointer(UINT32), "actualLineCount")]),
706 Method(HRESULT, "GetMetrics", [Out(Pointer(DWRITE_TEXT_METRICS), "textMetrics")]),
707 Method(HRESULT, "GetOverhangMetrics", [Out(Pointer(DWRITE_OVERHANG_METRICS), "overhangs")]),
708 Method(HRESULT, "GetClusterMetrics", [Out(Pointer(DWRITE_CLUSTER_METRICS), "clusterMetrics"), (UINT32, "maxClusterCount"), Out(Pointer(UINT32), "actualClusterCount")]),
709 Method(HRESULT, "DetermineMinWidth", [Out(Pointer(FLOAT), "minWidth")]),
710 Method(HRESULT, "HitTestPoint", [(FLOAT, "pointX"), (FLOAT, "pointY"), Out(Pointer(BOOL), "isTrailingHit"), Out(Pointer(BOOL), "isInside"), Out(Pointer(DWRITE_HIT_TEST_METRICS), "hitTestMetrics")]),
711 Method(HRESULT, "HitTestTextPosition", [(UINT32, "textPosition"), (BOOL, "isTrailingHit"), Out(Pointer(FLOAT), "pointX"), Out(Pointer(FLOAT), "pointY"), Out(Pointer(DWRITE_HIT_TEST_METRICS), "hitTestMetrics")]),
712 Method(HRESULT, "HitTestTextRange", [(UINT32, "textPosition"), (UINT32, "textLength"), (FLOAT, "originX"), (FLOAT, "originY"), Out(Pointer(DWRITE_HIT_TEST_METRICS), "hitTestMetrics"), (UINT32, "maxHitTestMetricsCount"), Out(Pointer(UINT32), "actualHitTestMetricsCount")]),
713]
714
715IDWriteBitmapRenderTarget.methods += [
716 Method(HRESULT, "DrawGlyphRun", [(FLOAT, "baselineOriginX"), (FLOAT, "baselineOriginY"), (DWRITE_MEASURING_MODE, "measuringMode"), (Pointer(Const(DWRITE_GLYPH_RUN)), "glyphRun"), (Pointer(IDWriteRenderingParams), "renderingParams"), (COLORREF, "textColor"), Out(Pointer(RECT), "blackBoxRect")]),
717 Method(HDC, "GetMemoryDC", []),
718 Method(FLOAT, "GetPixelsPerDip", []),
719 Method(HRESULT, "SetPixelsPerDip", [(FLOAT, "pixelsPerDip")]),
720 Method(HRESULT, "GetCurrentTransform", [Out(Pointer(DWRITE_MATRIX), "transform")]),
721 Method(HRESULT, "SetCurrentTransform", [(Pointer(Const(DWRITE_MATRIX)), "transform")]),
722 Method(HRESULT, "GetSize", [Out(Pointer(SIZE), "size")]),
723 Method(HRESULT, "Resize", [(UINT32, "width"), (UINT32, "height")]),
724]
725
726IDWriteGdiInterop.methods += [
727 Method(HRESULT, "CreateFontFromLOGFONT", [(Pointer(Const(LOGFONTW)), "logFont"), Out(Pointer(Pointer(IDWriteFont)), "font")]),
728 Method(HRESULT, "ConvertFontToLOGFONT", [(Pointer(IDWriteFont), "font"), Out(Pointer(LOGFONTW), "logFont"), Out(Pointer(BOOL), "isSystemFont")]),
729 Method(HRESULT, "ConvertFontFaceToLOGFONT", [(Pointer(IDWriteFontFace), "font"), Out(Pointer(LOGFONTW), "logFont")]),
730 Method(HRESULT, "CreateFontFaceFromHdc", [(HDC, "hdc"), Out(Pointer(Pointer(IDWriteFontFace)), "fontFace")]),
731 Method(HRESULT, "CreateBitmapRenderTarget", [(HDC, "hdc"), (UINT32, "width"), (UINT32, "height"), Out(Pointer(Pointer(IDWriteBitmapRenderTarget)), "renderTarget")]),
732]
733
734DWRITE_TEXTURE_TYPE = Enum("DWRITE_TEXTURE_TYPE", [
735 "DWRITE_TEXTURE_ALIASED_1x1",
736 "DWRITE_TEXTURE_CLEARTYPE_3x1",
737])
738
739IDWriteGlyphRunAnalysis.methods += [
740 Method(HRESULT, "GetAlphaTextureBounds", [(DWRITE_TEXTURE_TYPE, "textureType"), Out(Pointer(RECT), "textureBounds")]),
741 Method(HRESULT, "CreateAlphaTexture", [(DWRITE_TEXTURE_TYPE, "textureType"), (Pointer(Const(RECT)), "textureBounds"), Out(Pointer(BYTE), "alphaValues"), (UINT32, "bufferSize")]),
742 Method(HRESULT, "GetAlphaBlendParams", [(Pointer(IDWriteRenderingParams), "renderingParams"), Out(Pointer(FLOAT), "blendGamma"), Out(Pointer(FLOAT), "blendEnhancedContrast"), Out(Pointer(FLOAT), "blendClearTypeLevel")]),
743]
744
745IDWriteFactory.methods += [
746 Method(HRESULT, "GetSystemFontCollection", [Out(Pointer(Pointer(IDWriteFontCollection)), "fontCollection"), (BOOL, "checkForUpdates")]),
747 Method(HRESULT, "CreateCustomFontCollection", [(Pointer(IDWriteFontCollectionLoader), "collectionLoader"), (OpaquePointer(Const(Void)), "collectionKey"), (UINT32, "collectionKeySize"), Out(Pointer(Pointer(IDWriteFontCollection)), "fontCollection")]),
748 Method(HRESULT, "RegisterFontCollectionLoader", [(Pointer(IDWriteFontCollectionLoader), "fontCollectionLoader")]),
749 Method(HRESULT, "UnregisterFontCollectionLoader", [(Pointer(IDWriteFontCollectionLoader), "fontCollectionLoader")]),
750 Method(HRESULT, "CreateFontFileReference", [(Pointer(Const(WCHAR)), "filePath"), (Pointer(Const(FILETIME)), "lastWriteTime"), Out(Pointer(Pointer(IDWriteFontFile)), "fontFile")]),
751 Method(HRESULT, "CreateCustomFontFileReference", [(OpaquePointer(Const(Void)), "fontFileReferenceKey"), (UINT32, "fontFileReferenceKeySize"), (Pointer(IDWriteFontFileLoader), "fontFileLoader"), Out(Pointer(Pointer(IDWriteFontFile)), "fontFile")]),
752 Method(HRESULT, "CreateFontFace", [(DWRITE_FONT_FACE_TYPE, "fontFaceType"), (UINT32, "numberOfFiles"), (Pointer(Const(Pointer(IDWriteFontFile))), "fontFiles"), (UINT32, "faceIndex"), (DWRITE_FONT_SIMULATIONS, "fontFaceSimulationFlags"), Out(Pointer(Pointer(IDWriteFontFace)), "fontFace")]),
753 Method(HRESULT, "CreateRenderingParams", [Out(Pointer(Pointer(IDWriteRenderingParams)), "renderingParams")]),
754 Method(HRESULT, "CreateMonitorRenderingParams", [(HMONITOR, "monitor"), Out(Pointer(Pointer(IDWriteRenderingParams)), "renderingParams")]),
755 Method(HRESULT, "CreateCustomRenderingParams", [(FLOAT, "gamma"), (FLOAT, "enhancedContrast"), (FLOAT, "clearTypeLevel"), (DWRITE_PIXEL_GEOMETRY, "pixelGeometry"), (DWRITE_RENDERING_MODE, "renderingMode"), Out(Pointer(Pointer(IDWriteRenderingParams)), "renderingParams")]),
756 Method(HRESULT, "RegisterFontFileLoader", [(Pointer(IDWriteFontFileLoader), "fontFileLoader")]),
757 Method(HRESULT, "UnregisterFontFileLoader", [(Pointer(IDWriteFontFileLoader), "fontFileLoader")]),
758 Method(HRESULT, "CreateTextFormat", [(Pointer(Const(WCHAR)), "fontFamilyName"), (Pointer(IDWriteFontCollection), "fontCollection"), (DWRITE_FONT_WEIGHT, "fontWeight"), (DWRITE_FONT_STYLE, "fontStyle"), (DWRITE_FONT_STRETCH, "fontStretch"), (FLOAT, "fontSize"), (Pointer(Const(WCHAR)), "localeName"), Out(Pointer(Pointer(IDWriteTextFormat)), "textFormat")]),
759 Method(HRESULT, "CreateTypography", [Out(Pointer(Pointer(IDWriteTypography)), "typography")]),
760 Method(HRESULT, "GetGdiInterop", [Out(Pointer(Pointer(IDWriteGdiInterop)), "gdiInterop")]),
761 Method(HRESULT, "CreateTextLayout", [(Pointer(Const(WCHAR)), "string"), (UINT32, "stringLength"), (Pointer(IDWriteTextFormat), "textFormat"), (FLOAT, "maxWidth"), (FLOAT, "maxHeight"), Out(Pointer(Pointer(IDWriteTextLayout)), "textLayout")]),
762 Method(HRESULT, "CreateGdiCompatibleTextLayout", [(Pointer(Const(WCHAR)), "string"), (UINT32, "stringLength"), (Pointer(IDWriteTextFormat), "textFormat"), (FLOAT, "layoutWidth"), (FLOAT, "layoutHeight"), (FLOAT, "pixelsPerDip"), (Pointer(Const(DWRITE_MATRIX)), "transform"), (BOOL, "useGdiNatural"), Out(Pointer(Pointer(IDWriteTextLayout)), "textLayout")]),
763 Method(HRESULT, "CreateEllipsisTrimmingSign", [(Pointer(IDWriteTextFormat), "textFormat"), Out(Pointer(Pointer(IDWriteInlineObject)), "trimmingSign")]),
764 Method(HRESULT, "CreateTextAnalyzer", [Out(Pointer(Pointer(IDWriteTextAnalyzer)), "textAnalyzer")]),
765 Method(HRESULT, "CreateNumberSubstitution", [(DWRITE_NUMBER_SUBSTITUTION_METHOD, "substitutionMethod"), (Pointer(Const(WCHAR)), "localeName"), (BOOL, "ignoreUserOverride"), Out(Pointer(Pointer(IDWriteNumberSubstitution)), "numberSubstitution")]),
766 Method(HRESULT, "CreateGlyphRunAnalysis", [(Pointer(Const(DWRITE_GLYPH_RUN)), "glyphRun"), (FLOAT, "pixelsPerDip"), (Pointer(Const(DWRITE_MATRIX)), "transform"), (DWRITE_RENDERING_MODE, "renderingMode"), (DWRITE_MEASURING_MODE, "measuringMode"), (FLOAT, "baselineOriginX"), (FLOAT, "baselineOriginY"), Out(Pointer(Pointer(IDWriteGlyphRunAnalysis)), "glyphRunAnalysis")]),
767]
768
769dwrite = API("dwrite")
770dwrite.add_functions([
771 StdFunction(HRESULT, "DWriteCreateFactory", [(DWRITE_FACTORY_TYPE, "factoryType"), (REFIID, "iid"), Out(Pointer(Pointer(IUnknown)), "factory")]),
772])