1 // Licensed under the Apache License, Version 2.0
2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4 // All files in the project carrying such notice may not be copied, modified, or distributed
5 // except according to those terms.
6 //! Mappings for the content of dwrite_3.h
7 use ctypes::c_void;
8 use shared::basetsd::{UINT16, UINT32, UINT64};
9 use shared::minwindef::{BOOL, FILETIME, FLOAT};
10 use um::dcommon::{DWRITE_GLYPH_IMAGE_DATA, DWRITE_GLYPH_IMAGE_FORMATS, DWRITE_MEASURING_MODE};
11 use um::dwrite::{
12     DWRITE_FONT_SIMULATIONS, DWRITE_FONT_STRETCH, DWRITE_FONT_STYLE, DWRITE_FONT_WEIGHT,
13     DWRITE_GLYPH_RUN, DWRITE_INFORMATIONAL_STRING_ID, DWRITE_LINE_SPACING_METHOD, DWRITE_MATRIX,
14     DWRITE_PIXEL_GEOMETRY, DWRITE_RENDERING_MODE_ALIASED, DWRITE_RENDERING_MODE_DEFAULT,
15     DWRITE_RENDERING_MODE_GDI_CLASSIC, DWRITE_RENDERING_MODE_GDI_NATURAL,
16     DWRITE_RENDERING_MODE_NATURAL, DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC,
17     DWRITE_RENDERING_MODE_OUTLINE, IDWriteFont, IDWriteFontCollection, IDWriteFontCollectionVtbl,
18     IDWriteFontFace, IDWriteFontFamily, IDWriteFontFamilyVtbl, IDWriteFontFile, IDWriteFontList,
19     IDWriteFontListVtbl, IDWriteGdiInterop, IDWriteGdiInteropVtbl, IDWriteGlyphRunAnalysis,
20     IDWriteLocalizedStrings, IDWriteRenderingParams,
21 };
22 use um::dwrite_1::{DWRITE_OUTLINE_THRESHOLD, DWRITE_PANOSE, DWRITE_TEXT_ANTIALIAS_MODE};
23 use um::dwrite_2::{
24     DWRITE_GRID_FIT_MODE, IDWriteFactory2, IDWriteFactory2Vtbl, IDWriteFont2, IDWriteFont2Vtbl,
25     IDWriteFontFace2, IDWriteFontFace2Vtbl, IDWriteRenderingParams2, IDWriteRenderingParams2Vtbl,
26     IDWriteTextFormat1, IDWriteTextFormat1Vtbl, IDWriteTextLayout2, IDWriteTextLayout2Vtbl,
27 };
28 use um::unknwnbase::{IUnknown, IUnknownVtbl};
29 use um::wingdi::{FONTSIGNATURE, LOGFONTW};
30 use um::winnt::{HRESULT, WCHAR};
31 pub const DWRITE_E_REMOTEFONT: HRESULT = 0x8898500D;
32 pub const DWRITE_E_DOWNLOADCANCELLED: HRESULT = 0x8898500E;
33 pub const DWRITE_E_DOWNLOADFAILED: HRESULT = 0x8898500F;
34 pub const DWRITE_E_TOOMANYDOWNLOADS: HRESULT = 0x88985010;
35 ENUM!{enum DWRITE_FONT_PROPERTY_ID {
36     DWRITE_FONT_PROPERTY_ID_NONE,
37     DWRITE_FONT_PROPERTY_ID_FAMILY_NAME,
38     DWRITE_FONT_PROPERTY_ID_PREFERRED_FAMILY_NAME,
39     DWRITE_FONT_PROPERTY_ID_FACE_NAME,
40     DWRITE_FONT_PROPERTY_ID_FULL_NAME,
41     DWRITE_FONT_PROPERTY_ID_WIN32_FAMILY_NAME,
42     DWRITE_FONT_PROPERTY_ID_POSTSCRIPT_NAME,
43     DWRITE_FONT_PROPERTY_ID_DESIGN_SCRIPT_LANGUAGE_TAG,
44     DWRITE_FONT_PROPERTY_ID_SUPPORTED_SCRIPT_LANGUAGE_TAG,
45     DWRITE_FONT_PROPERTY_ID_SEMANTIC_TAG,
46     DWRITE_FONT_PROPERTY_ID_WEIGHT ,
47     DWRITE_FONT_PROPERTY_ID_STRETCH,
48     DWRITE_FONT_PROPERTY_ID_STYLE,
49     DWRITE_FONT_PROPERTY_ID_TOTAL,
50 }}
51 STRUCT!{struct DWRITE_FONT_PROPERTY {
52     propertyId: DWRITE_FONT_PROPERTY_ID,
53     propertyValue: *const WCHAR,
54     localeName: *const WCHAR,
55 }}
56 ENUM!{enum DWRITE_LOCALITY {
57     DWRITE_LOCALITY_REMOTE,
58     DWRITE_LOCALITY_PARTIAL,
59     DWRITE_LOCALITY_LOCAL,
60 }}
61 ENUM!{enum DWRITE_RENDERING_MODE1 {
62     DWRITE_RENDERING_MODE1_DEFAULT = DWRITE_RENDERING_MODE_DEFAULT,
63     DWRITE_RENDERING_MODE1_ALIASED = DWRITE_RENDERING_MODE_ALIASED,
64     DWRITE_RENDERING_MODE1_GDI_CLASSIC = DWRITE_RENDERING_MODE_GDI_CLASSIC,
65     DWRITE_RENDERING_MODE1_GDI_NATURAL = DWRITE_RENDERING_MODE_GDI_NATURAL,
66     DWRITE_RENDERING_MODE1_NATURAL = DWRITE_RENDERING_MODE_NATURAL,
67     DWRITE_RENDERING_MODE1_NATURAL_SYMMETRIC = DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC,
68     DWRITE_RENDERING_MODE1_OUTLINE = DWRITE_RENDERING_MODE_OUTLINE,
69     DWRITE_RENDERING_MODE1_NATURAL_SYMMETRIC_DOWNSAMPLED,
70 }}
71 RIDL!{#[uuid(0xb7924baa, 0x391b, 0x412a, 0x8c, 0x5c, 0xe4, 0x4c, 0xc2, 0xd8, 0x67, 0xdc)]
72 interface IDWriteRenderingParams3(IDWriteRenderingParams3Vtbl):
73     IDWriteRenderingParams2(IDWriteRenderingParams2Vtbl) {
74     fn GetRenderingMode1() -> DWRITE_RENDERING_MODE1,
75 }}
76 RIDL!{#[uuid(0x9a1b41c3, 0xd3bb, 0x466a, 0x87, 0xfc, 0xfe, 0x67, 0x55, 0x6a, 0x3b, 0x65)]
77 interface IDWriteFactory3(IDWriteFactory3Vtbl): IDWriteFactory2(IDWriteFactory2Vtbl) {
78     fn CreateGlyphRunAnalysis(
79         glyphRun: *const DWRITE_GLYPH_RUN,
80         transform: *const DWRITE_MATRIX,
81         renderingMode: DWRITE_RENDERING_MODE1,
82         measuringMode: DWRITE_MEASURING_MODE,
83         gridFitMode: DWRITE_GRID_FIT_MODE,
84         antialiasMode: DWRITE_TEXT_ANTIALIAS_MODE,
85         baselineOriginX: FLOAT,
86         baselineOriginY: FLOAT,
87         glyphRunAnalysis: *mut *mut IDWriteGlyphRunAnalysis,
88     ) -> HRESULT,
89     fn CreateCustomRenderingParams(
90         gamma: FLOAT,
91         enhancedContrast: FLOAT,
92         grayscaleEnhancedContrast: FLOAT,
93         clearTypeLevel: FLOAT,
94         pixelGeometry: DWRITE_PIXEL_GEOMETRY,
95         renderingMode: DWRITE_RENDERING_MODE1,
96         gridFitMode: DWRITE_GRID_FIT_MODE,
97         renderingParams: *mut *mut IDWriteRenderingParams3,
98     ) -> HRESULT,
99     fn CreateFontFaceReference_2(
100         fontFile: *mut IDWriteFontFile,
101         faceIndex: UINT32,
102         fontSimulations: DWRITE_FONT_SIMULATIONS,
103         fontFaceReference: *mut *mut IDWriteFontFaceReference,
104     ) -> HRESULT,
105     fn CreateFontFaceReference_1(
106         filePath: *const WCHAR,
107         lastWriteTime: *const FILETIME,
108         faceIndex: UINT32,
109         fontSimulations: DWRITE_FONT_SIMULATIONS,
110         fontFaceReference: *mut *mut IDWriteFontFaceReference,
111     ) -> HRESULT,
112     fn GetSystemFontSet(
113         fontSet: *mut *mut IDWriteFontSet,
114     ) -> HRESULT,
115     fn CreateFontSetBuilder(
116         fontSetBuilder: *mut *mut IDWriteFontSetBuilder,
117     ) -> HRESULT,
118     fn CreateFontCollectionFromFontSet(
119         fontSet: *mut IDWriteFontSet,
120         fontCollection: *mut *mut IDWriteFontCollection1,
121     ) -> HRESULT,
122     fn GetSystemFontCollection(
123         includeDownloadableFonts: BOOL,
124         fontCollection: *mut *mut IDWriteFontCollection1,
125         checkForUpdates: BOOL,
126     ) -> HRESULT,
127     fn GetFontDownloadQueue(
128         fontDownloadQueue: *mut *mut IDWriteFontDownloadQueue,
129     ) -> HRESULT,
130 }}
131 RIDL!{#[uuid(0x53585141, 0xd9f8, 0x4095, 0x83, 0x21, 0xd7, 0x3c, 0xf6, 0xbd, 0x11, 0x6b)]
132 interface IDWriteFontSet(IDWriteFontSetVtbl): IUnknown(IUnknownVtbl) {
133     fn GetFontCount() -> UINT32,
134     fn GetFontFaceReference(
135         listIndex: UINT32,
136         fontFaceReference: *mut *mut IDWriteFontFaceReference,
137     ) -> HRESULT,
138     fn FindFontFaceReference(
139         fontFaceReference: *mut IDWriteFontFaceReference,
140         listIndex: *mut UINT32,
141         exists: *mut BOOL,
142     ) -> HRESULT,
143     fn FindFontFace(
144         fontFace: *mut IDWriteFontFace,
145         listIndex: *mut UINT32,
146         exists: *mut BOOL,
147     ) -> HRESULT,
148     fn GetPropertyValues_3(
149         propertyID: DWRITE_FONT_PROPERTY_ID,
150         values: *mut *mut IDWriteStringList,
151     ) -> HRESULT,
152     fn GetPropertyValues_2(
153         propertyID: DWRITE_FONT_PROPERTY_ID,
154         preferredLocaleNames: *const WCHAR,
155         values: *mut *mut IDWriteStringList,
156     ) -> HRESULT,
157     fn GetPropertyValues_1(
158         listIndex: UINT32,
159         propertyId: DWRITE_FONT_PROPERTY_ID,
160         exists: *mut BOOL,
161         values: *mut *mut IDWriteLocalizedStrings,
162     ) -> HRESULT,
163     fn GetPropertyOccurrenceCount(
164         property: *const DWRITE_FONT_PROPERTY,
165         propertyOccurrenceCount: *mut UINT32,
166     ) -> HRESULT,
167     fn GetMatchingFonts_2(
168         familyName: *const WCHAR,
169         fontWeight: DWRITE_FONT_WEIGHT,
170         fontStretch: DWRITE_FONT_STRETCH,
171         fontStyle: DWRITE_FONT_STYLE,
172         filteredSet: *mut *mut IDWriteFontSet,
173     ) -> HRESULT,
174     fn GetMatchingFonts_1(
175         properties: *const DWRITE_FONT_PROPERTY,
176         propertyCount: UINT32,
177         filteredSet: *mut *mut IDWriteFontSet,
178     ) -> HRESULT,
179 }}
180 RIDL!{#[uuid(0x2f642afe, 0x9c68, 0x4f40, 0xb8, 0xbe, 0x45, 0x74, 0x01, 0xaf, 0xcb, 0x3d)]
181 interface IDWriteFontSetBuilder(IDWriteFontSetBuilderVtbl): IUnknown(IUnknownVtbl) {
182     fn AddFontFaceReference_2(
183         fontFaceReference: *mut IDWriteFontFaceReference,
184         properties: *const DWRITE_FONT_PROPERTY,
185         propertyCount: UINT32,
186     ) -> HRESULT,
187     fn AddFontFaceReference_1(
188         fontFaceReference: *mut IDWriteFontFaceReference,
189     ) -> HRESULT,
190     fn AddFontSet(
191         fontSet: *mut IDWriteFontSet,
192     ) -> HRESULT,
193     fn CreateFontSet(
194         fontSet: *mut *mut IDWriteFontSet,
195     ) -> HRESULT,
196 }}
197 RIDL!{#[uuid(0x53585141, 0xd9f8, 0x4095, 0x83, 0x21, 0xd7, 0x3c, 0xf6, 0xbd, 0x11, 0x6c)]
198 interface IDWriteFontCollection1(IDWriteFontCollection1Vtbl):
199     IDWriteFontCollection(IDWriteFontCollectionVtbl) {
200     fn GetFontSet(
201         fontSet: *mut *mut IDWriteFontSet,
202     ) -> HRESULT,
203     fn GetFontFamily(
204         index: UINT32,
205         fontFamily: *mut *mut IDWriteFontFamily1,
206     ) -> HRESULT,
207 }}
208 RIDL!{#[uuid(0xda20d8ef, 0x812a, 0x4c43, 0x98, 0x02, 0x62, 0xec, 0x4a, 0xbd, 0x7a, 0xdf)]
209 interface IDWriteFontFamily1(IDWriteFontFamily1Vtbl):
210     IDWriteFontFamily(IDWriteFontFamilyVtbl) {
211     fn GetFontLocality(
212         listIndex: UINT32,
213     ) -> DWRITE_LOCALITY,
214     fn GetFont(
215         listIndex: UINT32,
216         font: *mut *mut IDWriteFont3,
217     ) -> HRESULT,
218     fn GetFontFaceReference(
219         listIndex: UINT32,
220         fontFaceReference: *mut *mut IDWriteFontFaceReference,
221     ) -> HRESULT,
222 }}
223 RIDL!{#[uuid(0xda20d8ef, 0x812a, 0x4c43, 0x98, 0x02, 0x62, 0xec, 0x4a, 0xbd, 0x7a, 0xde)]
224 interface IDWriteFontList1(IDWriteFontList1Vtbl): IDWriteFontList(IDWriteFontListVtbl) {
225     fn GetFontLocality(
226         listIndex: UINT32,
227     ) -> DWRITE_LOCALITY,
228     fn GetFont(
229         listIndex: UINT32,
230         font: *mut *mut IDWriteFont3,
231     ) -> HRESULT,
232     fn GetFontFaceReference(
233         listIndex: UINT32,
234         fontFaceReference: *mut *mut IDWriteFontFaceReference,
235     ) -> HRESULT,
236 }}
237 RIDL!{#[uuid(0x5e7fa7ca, 0xdde3, 0x424c, 0x89, 0xf0, 0x9f, 0xcd, 0x6f, 0xed, 0x58, 0xcd)]
238 interface IDWriteFontFaceReference(IDWriteFontFaceReferenceVtbl):
239     IUnknown(IUnknownVtbl) {
240     fn CreateFontFace(
241         fontFace: *mut *mut IDWriteFontFace3,
242     ) -> HRESULT,
243     fn CreateFontFaceWithSimulations(
244         fontFaceSimulationFlags: DWRITE_FONT_SIMULATIONS,
245         fontFace: *mut *mut IDWriteFontFace3,
246     ) -> HRESULT,
247     fn Equals(
248         fontFaceReference: *mut IDWriteFontFaceReference,
249     ) -> BOOL,
250     fn GetFontFaceIndex() -> UINT32,
251     fn GetSimulations() -> DWRITE_FONT_SIMULATIONS,
252     fn GetFontFile(
253         fontFile: *mut *mut IDWriteFontFile,
254     ) -> HRESULT,
255     fn GetLocalFileSize() -> UINT64,
256     fn GetFileSize() -> UINT64,
257     fn GetFileTime(
258         lastWriteTime: *mut FILETIME,
259     ) -> HRESULT,
260     fn GetLocality() -> DWRITE_LOCALITY,
261     fn EnqueueFontDownloadRequest() -> HRESULT,
262     fn EnqueueCharacterDownloadRequest(
263         characters: *const WCHAR,
264         characterCount: UINT32,
265     ) -> HRESULT,
266     fn EnqueueGlyphDownloadRequest(
267         glyphIndices: *const UINT16,
268         glyphCount: UINT32,
269     ) -> HRESULT,
270     fn EnqueueFileFragmentDownloadRequest(
271         fileOffset: UINT64,
272         fragmentSize: UINT64,
273     ) -> HRESULT,
274 }}
275 RIDL!{#[uuid(0x29748ed6, 0x8c9c, 0x4a6a, 0xbe, 0x0b, 0xd9, 0x12, 0xe8, 0x53, 0x89, 0x44)]
276 interface IDWriteFont3(IDWriteFont3Vtbl): IDWriteFont2(IDWriteFont2Vtbl) {
277     fn CreateFontFace(
278         fontFace: *mut *mut IDWriteFontFace3,
279     ) -> HRESULT,
280     fn Equals(
281         font: *mut IDWriteFont,
282     ) -> BOOL,
283     fn GetFontFaceReference(
284         fontFaceReference: *mut *mut IDWriteFontFaceReference,
285     ) -> HRESULT,
286     fn HasCharacter(
287         unicodeValue: UINT32,
288     ) -> BOOL,
289     fn GetLocality() -> DWRITE_LOCALITY,
290 }}
291 RIDL!{#[uuid(0xd37d7598, 0x09be, 0x4222, 0xa2, 0x36, 0x20, 0x81, 0x34, 0x1c, 0xc1, 0xf2)]
292 interface IDWriteFontFace3(IDWriteFontFace3Vtbl):
293     IDWriteFontFace2(IDWriteFontFace2Vtbl) {
294     fn GetFontFaceReference(
295         fontFaceReference: *mut *mut IDWriteFontFaceReference,
296     ) -> HRESULT,
297     fn GetPanose(
298         panose: *mut DWRITE_PANOSE,
299     ) -> (),
300     fn GetWeight() -> DWRITE_FONT_WEIGHT,
301     fn GetStretch() -> DWRITE_FONT_STRETCH,
302     fn GetStyle() -> DWRITE_FONT_STYLE,
303     fn GetFamilyNames(
304         names: *mut *mut IDWriteLocalizedStrings,
305     ) -> HRESULT,
306     fn GetFaceNames(
307         names: *mut *mut IDWriteLocalizedStrings,
308     ) -> HRESULT,
309     fn GetInformationalStrings(
310         informationalStringID: DWRITE_INFORMATIONAL_STRING_ID,
311         informationalStrings: *mut *mut IDWriteLocalizedStrings,
312         exists: *mut BOOL,
313     ) -> HRESULT,
314     fn HasCharacter(
315         unicodeValue: UINT32,
316     ) -> BOOL,
317     fn GetRecommendedRenderingMode(
318         fontEmSize: FLOAT,
319         dpiX: FLOAT,
320         dpiY: FLOAT,
321         transform: *const DWRITE_MATRIX,
322         isSideways: BOOL,
323         outlineThreshold: DWRITE_OUTLINE_THRESHOLD,
324         measuringMode: DWRITE_MEASURING_MODE,
325         renderingParams: *mut IDWriteRenderingParams,
326         renderingMode: *mut DWRITE_RENDERING_MODE1,
327         gridFitMode: *mut DWRITE_GRID_FIT_MODE,
328     ) -> HRESULT,
329     fn IsCharacterLocal(
330         unicodeValue: UINT32,
331     ) -> BOOL,
332     fn IsGlyphLocal(
333         glyphId: UINT16,
334     ) -> BOOL,
335     fn AreCharactersLocal(
336         characters: *const WCHAR,
337         characterCount: UINT32,
338         enqueueIfNotLocal: BOOL,
339         isLocal: *mut BOOL,
340     ) -> HRESULT,
341     fn AreGlyphsLocal(
342         glyphIndices: *const UINT16,
343         glyphCount: UINT32,
344         enqueueIfNotLocal: BOOL,
345         isLocal: *mut BOOL,
346     ) -> HRESULT,
347 }}
348 RIDL!{#[uuid(0xcfee3140, 0x1157, 0x47ca, 0x8b, 0x85, 0x31, 0xbf, 0xcf, 0x3f, 0x2d, 0x0e)]
349 interface IDWriteStringList(IDWriteStringListVtbl): IUnknown(IUnknownVtbl) {
350     fn GetCount() -> UINT32,
351     fn GetLocaleNameLength(
352         listIndex: UINT32,
353         length: *mut UINT32,
354     ) -> HRESULT,
355     fn GetLocaleName(
356         listIndex: UINT32,
357         localeName: *mut WCHAR,
358         size: UINT32,
359     ) -> HRESULT,
360     fn GetStringLength(
361         listIndex: UINT32,
362         length: *mut UINT32,
363     ) -> HRESULT,
364     fn GetString(
365         listIndex: UINT32,
366         stringBuffer: *mut WCHAR,
367         stringBufferSize: UINT32,
368     ) -> HRESULT,
369 }}
370 RIDL!{#[uuid(0xb06fe5b9, 0x43ec, 0x4393, 0x88, 0x1b, 0xdb, 0xe4, 0xdc, 0x72, 0xfd, 0xa7)]
371 interface IDWriteFontDownloadListener(IDWriteFontDownloadListenerVtbl):
372     IUnknown(IUnknownVtbl) {
373     fn DownloadCompleted(
374         downloadQueue: *mut IDWriteFontDownloadQueue,
375         context: *mut IUnknown,
376         downloadResult: HRESULT,
377     ) -> (),
378 }}
379 RIDL!{#[uuid(0xb71e6052, 0x5aea, 0x4fa3, 0x83, 0x2e, 0xf6, 0x0d, 0x43, 0x1f, 0x7e, 0x91)]
380 interface IDWriteFontDownloadQueue(IDWriteFontDownloadQueueVtbl):
381     IUnknown(IUnknownVtbl) {
382     fn AddListener(
383         listener: *mut IDWriteFontDownloadListener,
384         token: *mut UINT32,
385     ) -> HRESULT,
386     fn RemoveListener(
387         token: UINT32,
388     ) -> HRESULT,
389     fn IsEmpty() -> BOOL,
390     fn BeginDownload(
391         context: *mut IUnknown,
392     ) -> HRESULT,
393     fn CancelDownload() -> HRESULT,
394     fn GetGenerationCount() -> UINT64,
395 }}
396 RIDL!{#[uuid(0x4556be70, 0x3abd, 0x4f70, 0x90, 0xbe, 0x42, 0x17, 0x80, 0xa6, 0xf5, 0x15)]
397 interface IDWriteGdiInterop1(IDWriteGdiInterop1Vtbl):
398     IDWriteGdiInterop(IDWriteGdiInteropVtbl) {
399     fn CreateFontFromLOGFONT(
400         logFont: *const LOGFONTW,
401         fontCollection: *mut IDWriteFontCollection,
402         font: *mut *mut IDWriteFont,
403     ) -> HRESULT,
404     fn GetFontSignature_2(
405         fontFace: *mut IDWriteFontFace,
406         fontSignature: *mut FONTSIGNATURE,
407     ) -> HRESULT,
408     fn GetFontSignature_1(
409         font: *mut IDWriteFont,
410         fontSignature: *mut FONTSIGNATURE,
411     ) -> HRESULT,
412     fn GetMatchingFontsByLOGFONT(
413         logFont: *const LOGFONTW,
414         fontSet: *mut IDWriteFontSet,
415         filteredSet: *mut *mut IDWriteFontSet,
416     ) -> HRESULT,
417 }}
418 STRUCT!{struct DWRITE_LINE_METRICS1 {
419     length: UINT32,
420     trailingWhitespaceLength: UINT32,
421     newlineLength: UINT32,
422     height: FLOAT,
423     baseline: FLOAT,
424     isTrimmed: BOOL,
425     leadingBefore: FLOAT,
426     leadingAfter: FLOAT,
427 }}
428 ENUM!{enum DWRITE_FONT_LINE_GAP_USAGE {
429     DWRITE_FONT_LINE_GAP_USAGE_DEFAULT,
430     DWRITE_FONT_LINE_GAP_USAGE_DISABLED,
431     DWRITE_FONT_LINE_GAP_USAGE_ENABLED,
432 }}
433 STRUCT!{struct DWRITE_LINE_SPACING {
434     method: DWRITE_LINE_SPACING_METHOD,
435     height: FLOAT,
436     baseline: FLOAT,
437     leadingBefore: FLOAT,
438     fontLineGapUsage: DWRITE_FONT_LINE_GAP_USAGE,
439 }}
440 RIDL!{#[uuid(0xf67e0edd, 0x9e3d, 0x4ecc, 0x8c, 0x32, 0x41, 0x83, 0x25, 0x3d, 0xfe, 0x70)]
441 interface IDWriteTextFormat2(IDWriteTextFormat2Vtbl):
442     IDWriteTextFormat1(IDWriteTextFormat1Vtbl) {
443     fn SetLineSpacing(
444         lineSpacingOptions: *const DWRITE_LINE_SPACING,
445     ) -> HRESULT,
446     fn GetLineSpacing(
447         lineSpacingOptions: *mut DWRITE_LINE_SPACING,
448     ) -> HRESULT,
449 }}
450 RIDL!{#[uuid(0x07ddcd52, 0x020e, 0x4de8, 0xac, 0x33, 0x6c, 0x95, 0x3d, 0x83, 0xf9, 0x2d)]
451 interface IDWriteTextLayout3(IDWriteTextLayout3Vtbl):
452     IDWriteTextLayout2(IDWriteTextLayout2Vtbl) {
453     fn InvalidateLayout() -> HRESULT,
454     fn SetLineSpacing(
455         lineSpacingOptions: *const DWRITE_LINE_SPACING,
456     ) -> HRESULT,
457     fn GetLineSpacing(
458         lineSpacingOptions: *mut DWRITE_LINE_SPACING,
459     ) -> HRESULT,
460     fn GetLineMetrics(
461         lineMetrics: *mut DWRITE_LINE_METRICS1,
462         maxLineCount: UINT32,
463         actualLineCount: *mut UINT32,
464     ) -> HRESULT,
465 }}
466 RIDL!{#[uuid(0x27f2a904, 0x4eb8, 0x441d, 0x96, 0x78, 0x05, 0x63, 0xf5, 0x3e, 0x3e, 0x2f)]
467 interface IDWriteFontFace4(IDWriteFontFace4Vtbl): IDWriteFontFace3(IDWriteFontFace3Vtbl) {
468     fn GetGlyphImageFormats_2(
469         glyph: UINT16,
470         ppemFirst: UINT32,
471         ppemLast: UINT32,
472         formats: *mut DWRITE_GLYPH_IMAGE_FORMATS,
473     ) -> HRESULT,
474     fn GetGlyphImageFormats_1() -> DWRITE_GLYPH_IMAGE_FORMATS,
475     fn GetGlyphImageData(
476         glyph: UINT16,
477         ppem: UINT32,
478         format: DWRITE_GLYPH_IMAGE_FORMATS,
479         data: *mut DWRITE_GLYPH_IMAGE_DATA,
480         context: *mut *mut c_void,
481     ) -> HRESULT,
482     fn ReleaseGlyphImageData(
483         context: *mut c_void,
484     ) -> (),
485 }}
486 ENUM!{enum DWRITE_FONT_AXIS_TAG {
487     DWRITE_FONT_AXIS_TAG_WEIGHT = 0x74686777,
488     DWRITE_FONT_AXIS_TAG_WIDTH = 0x68746477,
489     DWRITE_FONT_AXIS_TAG_SLANT = 0x746e6c73,
490     DWRITE_FONT_AXIS_TAG_OPTICAL_SIZE = 0x7a73706f,
491     DWRITE_FONT_AXIS_TAG_ITALIC = 0x6c617469,
492 }}
493 STRUCT!{struct DWRITE_FONT_AXIS_VALUE {
494     axisTag: DWRITE_FONT_AXIS_TAG,
495     value: FLOAT,
496 }}
497 STRUCT!{struct DWRITE_FONT_AXIS_RANGE {
498     axisTag: DWRITE_FONT_AXIS_TAG,
499     minValue: FLOAT,
500     maxValue: FLOAT,
501 }}
502 ENUM!{enum DWRITE_FONT_AXIS_ATTRIBUTES {
503     DWRITE_FONT_AXIS_ATTRIBUTES_NONE,
504     DWRITE_FONT_AXIS_ATTRIBUTES_VARIABLE,
505     DWRITE_FONT_AXIS_ATTRIBUTES_HIDDEN,
506 }}
507 RIDL!{#[uuid(0x98eff3a5, 0xb667, 0x479a, 0xb1, 0x45, 0xe2, 0xfa, 0x5b, 0x9f, 0xdc, 0x29)]
508 interface IDWriteFontFace5(IDWriteFontFace5Vtbl): IDWriteFontFace4(IDWriteFontFace4Vtbl) {
509     fn GetFontAxisValueCount() -> UINT32,
510     fn GetFontAxisValues(
511         values: *mut DWRITE_FONT_AXIS_VALUE,
512         valueCount: UINT32,
513     ) -> HRESULT,
514     fn HasVariations() -> BOOL,
515     fn GetFontResource(
516         resource: *mut *mut IDWriteFontResource,
517     ) -> HRESULT,
518     fn Equals(
519         fontFace: *mut IDWriteFontFace,
520     ) -> BOOL,
521 }}
522 RIDL!{#[uuid(0xc081fe77, 0x2fd1, 0x41ac, 0xa5, 0xa3, 0x34, 0x98, 0x3c, 0x4b, 0xa6, 0x1a)]
523 interface IDWriteFontFaceReference1(IDWriteFontFaceReference1Vtbl):
524     IDWriteFontFaceReference(IDWriteFontFaceReferenceVtbl) {
525     fn CreateFontFace(
526         fontFace: *mut *mut IDWriteFontFace5,
527     ) -> HRESULT,
528     fn GetFontAxisValueCount() -> UINT32,
529     fn GetFontAxisValues(
530         values: *mut DWRITE_FONT_AXIS_VALUE,
531         numValues: UINT32,
532     ) -> HRESULT,
533 }}
534 RIDL!{#[uuid(0x1f803a76, 0x6871, 0x48e8, 0x98, 0x7f, 0xb9, 0x75, 0x55, 0x1c, 0x50, 0xf2)]
535 interface IDWriteFontResource(IDWriteFontResourceVtbl): IUnknown(IUnknownVtbl) {
536     fn GetFontFile(
537         fontFile: *mut *mut IDWriteFontFile,
538     ) -> HRESULT,
539     fn GetFontFaceIndex() -> UINT32,
540     fn GetFontAxisCount() -> UINT32,
541     fn GetDefaultFontAxisValues(
542         values: *const DWRITE_FONT_AXIS_VALUE,
543         numValues: UINT32,
544     ) -> HRESULT,
545     fn GetFontAxisRanges(
546         ranges: *const DWRITE_FONT_AXIS_RANGE,
547         numRanges: UINT32,
548     ) -> HRESULT,
549     fn GetFontAxisAttributes(
550         axis: UINT32,
551     ) -> DWRITE_FONT_AXIS_ATTRIBUTES,
552     fn GetAxisNames(
553         axis: UINT32,
554         names: *mut *mut IDWriteLocalizedStrings,
555     ) -> HRESULT,
556     fn GetAxisValueNameCount(
557         axis: UINT32,
558     ) -> UINT32,
559     fn GetAxisValueNames(
560         axis: UINT32,
561         axisValue: UINT32,
562         axisRange: *mut DWRITE_FONT_AXIS_RANGE,
563         names: *mut *mut IDWriteLocalizedStrings,
564     ) -> HRESULT,
565     fn HasVariations() -> BOOL,
566     fn CreateFontFace(
567         simulations: DWRITE_FONT_SIMULATIONS,
568         axisValues: *const DWRITE_FONT_AXIS_VALUE,
569         numValues: UINT32,
570         fontFace: *mut *mut IDWriteFontFace5,
571     ) -> HRESULT,
572     fn CreateFontFaceReference(
573         simulations: DWRITE_FONT_SIMULATIONS,
574         axisValues: *const DWRITE_FONT_AXIS_VALUE,
575         numValues: UINT32,
576         reference: *mut *mut IDWriteFontFaceReference1,
577     ) -> HRESULT,
578 }}
579