1 // Copyright © 2015-2017 winapi-rs developers
2 // Licensed under the Apache License, Version 2.0
3 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
4 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
5 // All files in the project carrying such notice may not be copied, modified, or distributed
6 // except according to those terms.
7 //! DirectX Typography Services public API definitions.
8 use ctypes::c_void;
9 use shared::basetsd::{INT16, INT32, UINT16, UINT32, UINT64, UINT8};
10 use shared::guiddef::REFIID;
11 use shared::minwindef::{BOOL, BYTE, FILETIME, FLOAT};
12 use shared::windef::{COLORREF, HDC, HMONITOR, RECT, SIZE};
13 use shared::winerror::SEVERITY_ERROR;
14 use um::d2d1::ID2D1SimplifiedGeometrySink;
15 use um::dcommon::DWRITE_MEASURING_MODE;
16 use um::unknwnbase::{IUnknown, IUnknownVtbl};
17 use um::wingdi::LOGFONTW;
18 use um::winnt::{HRESULT, WCHAR};
19 ENUM!{enum DWRITE_FONT_FILE_TYPE {
20 DWRITE_FONT_FILE_TYPE_UNKNOWN,
21 DWRITE_FONT_FILE_TYPE_CFF,
22 DWRITE_FONT_FILE_TYPE_TRUETYPE,
23 DWRITE_FONT_FILE_TYPE_OPENTYPE_COLLECTION,
24 DWRITE_FONT_FILE_TYPE_TYPE1_PFM,
25 DWRITE_FONT_FILE_TYPE_TYPE1_PFB,
26 DWRITE_FONT_FILE_TYPE_VECTOR,
27 DWRITE_FONT_FILE_TYPE_BITMAP,
28 DWRITE_FONT_FILE_TYPE_TRUETYPE_COLLECTION = DWRITE_FONT_FILE_TYPE_OPENTYPE_COLLECTION,
29 }}
30 ENUM!{enum DWRITE_FONT_FACE_TYPE {
31 DWRITE_FONT_FACE_TYPE_CFF,
32 DWRITE_FONT_FACE_TYPE_TRUETYPE,
33 DWRITE_FONT_FACE_TYPE_OPENTYPE_COLLECTION,
34 DWRITE_FONT_FACE_TYPE_TYPE1,
35 DWRITE_FONT_FACE_TYPE_VECTOR,
36 DWRITE_FONT_FACE_TYPE_BITMAP,
37 DWRITE_FONT_FACE_TYPE_UNKNOWN,
38 DWRITE_FONT_FACE_TYPE_RAW_CFF,
39 DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION = DWRITE_FONT_FACE_TYPE_OPENTYPE_COLLECTION,
40 }}
41 ENUM!{enum DWRITE_FONT_SIMULATIONS {
42 DWRITE_FONT_SIMULATIONS_NONE = 0x0000,
43 DWRITE_FONT_SIMULATIONS_BOLD = 0x0001,
44 DWRITE_FONT_SIMULATIONS_OBLIQUE = 0x0002,
45 }}
46 ENUM!{enum DWRITE_FONT_WEIGHT {
47 DWRITE_FONT_WEIGHT_THIN = 100,
48 DWRITE_FONT_WEIGHT_EXTRA_LIGHT = 200,
49 DWRITE_FONT_WEIGHT_ULTRA_LIGHT = 200,
50 DWRITE_FONT_WEIGHT_LIGHT = 300,
51 DWRITE_FONT_WEIGHT_SEMI_LIGHT = 350,
52 DWRITE_FONT_WEIGHT_NORMAL = 400,
53 DWRITE_FONT_WEIGHT_REGULAR = 400,
54 DWRITE_FONT_WEIGHT_MEDIUM = 500,
55 DWRITE_FONT_WEIGHT_DEMI_BOLD = 600,
56 DWRITE_FONT_WEIGHT_SEMI_BOLD = 600,
57 DWRITE_FONT_WEIGHT_BOLD = 700,
58 DWRITE_FONT_WEIGHT_EXTRA_BOLD = 800,
59 DWRITE_FONT_WEIGHT_ULTRA_BOLD = 800,
60 DWRITE_FONT_WEIGHT_BLACK = 900,
61 DWRITE_FONT_WEIGHT_HEAVY = 900,
62 DWRITE_FONT_WEIGHT_EXTRA_BLACK = 950,
63 DWRITE_FONT_WEIGHT_ULTRA_BLACK = 950,
64 }}
65 ENUM!{enum DWRITE_FONT_STRETCH {
66 DWRITE_FONT_STRETCH_UNDEFINED = 0,
67 DWRITE_FONT_STRETCH_ULTRA_CONDENSED = 1,
68 DWRITE_FONT_STRETCH_EXTRA_CONDENSED = 2,
69 DWRITE_FONT_STRETCH_CONDENSED = 3,
70 DWRITE_FONT_STRETCH_SEMI_CONDENSED = 4,
71 DWRITE_FONT_STRETCH_NORMAL = 5,
72 DWRITE_FONT_STRETCH_MEDIUM = 5,
73 DWRITE_FONT_STRETCH_SEMI_EXPANDED = 6,
74 DWRITE_FONT_STRETCH_EXPANDED = 7,
75 DWRITE_FONT_STRETCH_EXTRA_EXPANDED = 8,
76 DWRITE_FONT_STRETCH_ULTRA_EXPANDED = 9,
77 }}
78 ENUM!{enum DWRITE_FONT_STYLE {
79 DWRITE_FONT_STYLE_NORMAL,
80 DWRITE_FONT_STYLE_OBLIQUE,
81 DWRITE_FONT_STYLE_ITALIC,
82 }}
83 ENUM!{enum DWRITE_INFORMATIONAL_STRING_ID {
84 DWRITE_INFORMATIONAL_STRING_NONE,
85 DWRITE_INFORMATIONAL_STRING_COPYRIGHT_NOTICE,
86 DWRITE_INFORMATIONAL_STRING_VERSION_STRINGS,
87 DWRITE_INFORMATIONAL_STRING_TRADEMARK,
88 DWRITE_INFORMATIONAL_STRING_MANUFACTURER,
89 DWRITE_INFORMATIONAL_STRING_DESIGNER,
90 DWRITE_INFORMATIONAL_STRING_DESIGNER_URL,
91 DWRITE_INFORMATIONAL_STRING_DESCRIPTION,
92 DWRITE_INFORMATIONAL_STRING_FONT_VENDOR_URL,
93 DWRITE_INFORMATIONAL_STRING_LICENSE_DESCRIPTION,
94 DWRITE_INFORMATIONAL_STRING_LICENSE_INFO_URL,
95 DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES,
96 DWRITE_INFORMATIONAL_STRING_WIN32_SUBFAMILY_NAMES,
97 DWRITE_INFORMATIONAL_STRING_PREFERRED_FAMILY_NAMES,
98 DWRITE_INFORMATIONAL_STRING_PREFERRED_SUBFAMILY_NAMES,
99 DWRITE_INFORMATIONAL_STRING_SAMPLE_TEXT,
100 DWRITE_INFORMATIONAL_STRING_FULL_NAME,
101 DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_NAME,
102 DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_CID_NAME,
103 DWRITE_INFORMATIONAL_STRING_WWS_FAMILY_NAME,
104 DWRITE_INFORMATIONAL_STRING_DESIGN_SCRIPT_LANGUAGE_TAG,
105 DWRITE_INFORMATIONAL_STRING_SUPPORTED_SCRIPT_LANGUAGE_TAG,
106 }}
107 STRUCT!{struct DWRITE_FONT_METRICS {
108 designUnitsPerEm: UINT16,
109 ascent: UINT16,
110 descent: UINT16,
111 lineGap: INT16,
112 capHeight: UINT16,
113 xHeight: UINT16,
114 underlinePosition: INT16,
115 underlineThickness: UINT16,
116 strikethroughPosition: INT16,
117 strikethroughThickness: UINT16,
118 }}
119 STRUCT!{struct DWRITE_GLYPH_METRICS {
120 leftSideBearing: INT32,
121 advanceWidth: UINT32,
122 rightSideBearing: INT32,
123 topSideBearing: INT32,
124 advanceHeight: UINT32,
125 bottomSideBearing: INT32,
126 verticalOriginY: INT32,
127 }}
128 STRUCT!{struct DWRITE_GLYPH_OFFSET {
129 advanceOffset: FLOAT,
130 ascenderOffset: FLOAT,
131 }}
132 ENUM!{enum DWRITE_FACTORY_TYPE {
133 DWRITE_FACTORY_TYPE_SHARED,
134 DWRITE_FACTORY_TYPE_ISOLATED,
135 }}
136 RIDL!{#[uuid(0x727cad4e, 0xd6af, 0x4c9e, 0x8a, 0x08, 0xd6, 0x95, 0xb1, 0x1c, 0xaa, 0x49)]
137 interface IDWriteFontFileLoader(IDWriteFontFileLoaderVtbl): IUnknown(IUnknownVtbl) {
138 fn CreateStreamFromKey(
139 fontFileReferenceKey: *const c_void,
140 fontFileReferenceKeySize: UINT32,
141 fontFileStream: *mut *mut IDWriteFontFileStream,
142 ) -> HRESULT,
143 }}
144 RIDL!{#[uuid(0xb2d9f3ec, 0xc9fe, 0x4a11, 0xa2, 0xec, 0xd8, 0x62, 0x08, 0xf7, 0xc0, 0xa2)]
145 interface IDWriteLocalFontFileLoader(IDWriteLocalFontFileLoaderVtbl):
146 IDWriteFontFileLoader(IDWriteFontFileLoaderVtbl) {
147 fn GetFilePathLengthFromKey(
148 fontFileReferenceKey: *const c_void,
149 fontFileReferenceKeySize: UINT32,
150 filePathLength: *mut UINT32,
151 ) -> HRESULT,
152 fn GetFilePathFromKey(
153 fontFileReferenceKey: *const c_void,
154 fontFileReferenceKeySize: UINT32,
155 filePath: *mut WCHAR,
156 filePathSize: UINT32,
157 ) -> HRESULT,
158 fn GetLastWriteTimeFromKey(
159 fontFileReferenceKey: *const c_void,
160 fontFileReferenceKeySize: UINT32,
161 lastWriteTime: *mut FILETIME,
162 ) -> HRESULT,
163 }}
164 RIDL!{#[uuid(0x6d4865fe, 0x0ab8, 0x4d91, 0x8f, 0x62, 0x5d, 0xd6, 0xbe, 0x34, 0xa3, 0xe0)]
165 interface IDWriteFontFileStream(IDWriteFontFileStreamVtbl): IUnknown(IUnknownVtbl) {
166 fn ReadFileFragment(
167 fragmentStart: *mut *const c_void,
168 fileOffset: UINT64,
169 fragmentSize: UINT64,
170 fragmentContext: *mut *mut c_void,
171 ) -> HRESULT,
172 fn ReleaseFileFragment(
173 fragmentContext: *mut c_void,
174 ) -> (),
175 fn GetFileSize(
176 fileSize: *mut UINT64,
177 ) -> HRESULT,
178 fn GetLastWriteTime(
179 lastWriteTime: *mut UINT64,
180 ) -> HRESULT,
181 }}
182 ENUM!{enum DWRITE_OUTLINE_THRESHOLD {
183 DWRITE_OUTLINE_THRESHOLD_ANTIALIASED,
184 DWRITE_OUTLINE_THRESHOLD_ALIASED,
185 }}
186 STRUCT!{struct DWRITE_FONT_METRICS1 {
187 designUnitsPerEm: UINT16,
188 ascent: UINT16,
189 descent: UINT16,
190 lineGap: INT16,
191 capHeight: UINT16,
192 xHeight: UINT16,
193 underlinePosition: INT16,
194 underlineThickness: UINT16,
195 strikethroughPosition: INT16,
196 strikethroughThickness: UINT16,
197 glyphBoxLeft: INT16,
198 glyphBoxTop: INT16,
199 glyphBoxRight: INT16,
200 glyphBoxBottom: INT16,
201 subscriptPositionX: INT16,
202 subscriptPositionY: INT16,
203 subscriptSizeX: INT16,
204 subscriptSizeY: INT16,
205 superscriptPositionX: INT16,
206 superscriptPositionY: INT16,
207 superscriptSizeX: INT16,
208 superscriptSizeY: INT16,
209 hasTypographicMetrics: BOOL,
210 }}
211 STRUCT!{struct DWRITE_UNICODE_RANGE {
212 first: UINT32,
213 last: UINT32,
214 }}
215 STRUCT!{struct DWRITE_CARET_METRICS {
216 slopeRise: INT16,
217 slopeRun: INT16,
218 offset: INT16,
219 }}
220 #[inline]
DWRITE_MAKE_OPENTYPE_TAG(a: u8, b: u8, c: u8, d: u8) -> u32221 pub fn DWRITE_MAKE_OPENTYPE_TAG(a: u8, b: u8, c: u8, d: u8) -> u32 {
222 ((d as u32) << 24) | ((c as u32) << 16) | ((b as u32) << 8) | (a as u32)
223 }
224 RIDL!{#[uuid(0x739d886a, 0xcef5, 0x47dc, 0x87, 0x69, 0x1a, 0x8b, 0x41, 0xbe, 0xbb, 0xb0)]
225 interface IDWriteFontFile(IDWriteFontFileVtbl): IUnknown(IUnknownVtbl) {
226 fn GetReferenceKey(
227 fontFileReferenceKey: *mut *const c_void,
228 fontFileReferenceKeySize: *mut UINT32,
229 ) -> HRESULT,
230 fn GetLoader(
231 fontFileLoader: *mut *mut IDWriteFontFileLoader,
232 ) -> HRESULT,
233 fn Analyze(
234 isSupportedFontType: *mut BOOL,
235 fontFileType: *mut DWRITE_FONT_FILE_TYPE,
236 fontFaceType: *mut DWRITE_FONT_FACE_TYPE,
237 numberOfFaces: *mut UINT32,
238 ) -> HRESULT,
239 }}
240 ENUM!{enum DWRITE_PIXEL_GEOMETRY {
241 DWRITE_PIXEL_GEOMETRY_FLAT,
242 DWRITE_PIXEL_GEOMETRY_RGB,
243 DWRITE_PIXEL_GEOMETRY_BGR,
244 }}
245 ENUM!{enum DWRITE_RENDERING_MODE {
246 DWRITE_RENDERING_MODE_DEFAULT,
247 DWRITE_RENDERING_MODE_ALIASED,
248 DWRITE_RENDERING_MODE_GDI_CLASSIC,
249 DWRITE_RENDERING_MODE_GDI_NATURAL,
250 DWRITE_RENDERING_MODE_NATURAL,
251 DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC,
252 DWRITE_RENDERING_MODE_OUTLINE,
253 DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC = DWRITE_RENDERING_MODE_GDI_CLASSIC,
254 DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL = DWRITE_RENDERING_MODE_GDI_NATURAL,
255 DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL = DWRITE_RENDERING_MODE_NATURAL,
256 DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC = DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC,
257 }}
258 STRUCT!{struct DWRITE_MATRIX {
259 m11: FLOAT,
260 m12: FLOAT,
261 m21: FLOAT,
262 m22: FLOAT,
263 dx: FLOAT,
264 dy: FLOAT,
265 }}
266 RIDL!{#[uuid(0x2f0da53a, 0x2add, 0x47cd, 0x82, 0xee, 0xd9, 0xec, 0x34, 0x68, 0x8e, 0x75)]
267 interface IDWriteRenderingParams(IDWriteRenderingParamsVtbl): IUnknown(IUnknownVtbl) {
268 fn GetGamma() -> FLOAT,
269 fn GetEnhancedContrast() -> FLOAT,
270 fn GetClearTypeLevel() -> FLOAT,
271 fn GetPixelGeometry() -> DWRITE_PIXEL_GEOMETRY,
272 fn GetRenderingMode() -> DWRITE_RENDERING_MODE,
273 }}
274 pub type IDWriteGeometrySink = ID2D1SimplifiedGeometrySink;
275 RIDL!{#[uuid(0x5f49804d, 0x7024, 0x4d43, 0xbf, 0xa9, 0xd2, 0x59, 0x84, 0xf5, 0x38, 0x49)]
276 interface IDWriteFontFace(IDWriteFontFaceVtbl): IUnknown(IUnknownVtbl) {
277 fn GetType() -> DWRITE_FONT_FACE_TYPE,
278 fn GetFiles(
279 numberOfFiles: *mut UINT32,
280 fontFiles: *mut *mut IDWriteFontFile,
281 ) -> HRESULT,
282 fn GetIndex() -> UINT32,
283 fn GetSimulations() -> DWRITE_FONT_SIMULATIONS,
284 fn IsSymbolFont() -> BOOL,
285 fn GetMetrics(
286 fontFaceMetrics: *mut DWRITE_FONT_METRICS,
287 ) -> (),
288 fn GetGlyphCount() -> UINT16,
289 fn GetDesignGlyphMetrics(
290 glyphIndices: *const UINT16,
291 glyphCount: UINT32,
292 glyphMetrics: *mut DWRITE_GLYPH_METRICS,
293 isSideways: BOOL,
294 ) -> HRESULT,
295 fn GetGlyphIndices(
296 codePoints: *const UINT32,
297 codePointCount: UINT32,
298 glyphIndices: *mut UINT16,
299 ) -> HRESULT,
300 fn TryGetFontTable(
301 openTypeTableTag: UINT32,
302 tableData: *mut *const c_void,
303 tableSize: *mut UINT32,
304 tableContext: *mut *mut c_void,
305 exists: *mut BOOL,
306 ) -> HRESULT,
307 fn ReleaseFontTable(
308 tableContext: *mut c_void,
309 ) -> HRESULT,
310 fn GetGlyphRunOutline(
311 emSize: FLOAT,
312 glyphIndices: *const UINT16,
313 glyphAdvances: *const FLOAT,
314 glyphOffsets: *const DWRITE_GLYPH_OFFSET,
315 glyphCount: UINT32,
316 isSideways: BOOL,
317 isRightToLeft: BOOL,
318 geometrySink: *mut IDWriteGeometrySink,
319 ) -> HRESULT,
320 fn GetRecommendedRenderingMode(
321 emSize: FLOAT,
322 pixelsPerDip: FLOAT,
323 measuringMode: DWRITE_MEASURING_MODE,
324 renderingParams: *mut IDWriteRenderingParams,
325 renderingMode: *mut DWRITE_RENDERING_MODE,
326 ) -> HRESULT,
327 fn GetGdiCompatibleMetrics(
328 emSize: FLOAT,
329 pixelsPerDip: FLOAT,
330 transform: *const DWRITE_MATRIX,
331 fontFaceMetrics: *mut DWRITE_FONT_METRICS,
332 ) -> HRESULT,
333 fn GetGdiCompatibleGlyphMetrics(
334 enSize: FLOAT,
335 pixelsPerDip: FLOAT,
336 transform: *const DWRITE_MATRIX,
337 useGdiNatrual: BOOL,
338 glyphIndices: *const UINT16,
339 glyphCount: UINT32,
340 glyphMetrics: *mut DWRITE_GLYPH_METRICS,
341 isSideways: BOOL,
342 ) -> HRESULT,
343 }}
344 RIDL!{#[uuid(0xa71efdb4, 0x9fdb, 0x4838, 0xad, 0x90, 0xcf, 0xc3, 0xbe, 0x8c, 0x3d, 0xaf)]
345 interface IDWriteFontFace1(IDWriteFontFace1Vtbl): IDWriteFontFace(IDWriteFontFaceVtbl) {
346 fn GetMetrics(
347 fontFaceMetrics: *mut DWRITE_FONT_METRICS1,
348 ) -> (),
349 fn GetGdiCompatibleMetrics(
350 emSize: FLOAT,
351 pixelsPerDip: FLOAT,
352 transform: *const DWRITE_MATRIX,
353 fontFaceMetrics: *mut DWRITE_FONT_METRICS1,
354 ) -> HRESULT,
355 fn GetCaretMetrics(
356 caretMetrics: *mut DWRITE_CARET_METRICS,
357 ) -> (),
358 fn GetUnicodeRanges(
359 maxRangeCount: UINT32,
360 unicodeRanges: *mut DWRITE_UNICODE_RANGE,
361 actualRangeCount: *mut UINT32,
362 ) -> HRESULT,
363 fn IsMonoSpacedFont() -> BOOL,
364 fn GetDesignGlyphAdvances(
365 glyphCount: UINT32,
366 glyphIndices: *const UINT16,
367 glyphAdvances: *mut INT32,
368 isSideways: BOOL,
369 ) -> HRESULT,
370 fn GetGdiCompatibleGlyphAdvance(
371 emSize: FLOAT,
372 pixelsPerDip: FLOAT,
373 transform: *const DWRITE_MATRIX,
374 useGdiNatural: BOOL,
375 isSideways: BOOL,
376 glyphCount: UINT32,
377 glyphIndices: *const UINT16,
378 glyphAdvances: *mut INT32,
379 ) -> HRESULT,
380 fn GetKerningPairAdjustments(
381 glyphCount: UINT32,
382 glyphIndices: *const UINT16,
383 glyphAdvanceAdjustments: *mut INT32,
384 ) -> HRESULT,
385 fn HasKerningPairs() -> BOOL,
386 fn GetRecommendedRenderingMode(
387 fontEmSize: FLOAT,
388 dpiX: FLOAT,
389 dpiY: FLOAT,
390 transform: *const DWRITE_MATRIX,
391 isSideways: BOOL,
392 outlineThreshold: DWRITE_OUTLINE_THRESHOLD,
393 measuringMode: DWRITE_MEASURING_MODE,
394 renderingMode: *mut DWRITE_RENDERING_MODE,
395 ) -> HRESULT,
396 fn GetVerticalGlyphVariants(
397 nominalGlyphIndices: *const UINT16,
398 verticalGlyphIndices: *mut UINT16,
399 ) -> HRESULT,
400 fn HasVerticalGlyphVariants() -> BOOL,
401 }}
402 RIDL!{#[uuid(0xcca920e4, 0x52f0, 0x492b, 0xbf, 0xa8, 0x29, 0xc7, 0x2e, 0xe0, 0xa4, 0x68)]
403 interface IDWriteFontCollectionLoader(IDWriteFontCollectionLoaderVtbl):
404 IUnknown(IUnknownVtbl) {
405 fn CreateEnumeratorFromKey(
406 factory: *mut IDWriteFactory,
407 collectionKey: *const c_void,
408 collectionKeySize: UINT32,
409 fontFileEnumerator: *mut *mut IDWriteFontFileEnumerator,
410 ) -> HRESULT,
411 }}
412 RIDL!{#[uuid(0x72755049, 0x5ff7, 0x435d, 0x83, 0x48, 0x4b, 0xe9, 0x7c, 0xfa, 0x6c, 0x7c)]
413 interface IDWriteFontFileEnumerator(IDWriteFontFileEnumeratorVtbl): IUnknown(IUnknownVtbl) {
414 fn MoveNext(
415 hasCurrentFile: *mut BOOL,
416 ) -> HRESULT,
417 fn GetCurrentFontFile(
418 fontFile: *mut *mut IDWriteFontFile,
419 ) -> HRESULT,
420 }}
421 RIDL!{#[uuid(0x08256209, 0x099a, 0x4b34, 0xb8, 0x6d, 0xc2, 0x2b, 0x11, 0x0e, 0x77, 0x71)]
422 interface IDWriteLocalizedStrings(IDWriteLocalizedStringsVtbl): IUnknown(IUnknownVtbl) {
423 fn GetCount() -> UINT32,
424 fn FindLocaleName(
425 localeName: *const WCHAR,
426 index: *mut UINT32,
427 exists: *mut BOOL,
428 ) -> HRESULT,
429 fn GetLocaleNameLength(
430 index: UINT32,
431 length: *mut UINT32,
432 ) -> HRESULT,
433 fn GetLocaleName(
434 index: UINT32,
435 localeName: *mut WCHAR,
436 size: UINT32,
437 ) -> HRESULT,
438 fn GetStringLength(
439 index: UINT32,
440 length: *mut UINT32,
441 ) -> HRESULT,
442 fn GetString(
443 index: UINT32,
444 stringBuffer: *mut WCHAR,
445 size: UINT32,
446 ) -> HRESULT,
447 }}
448 RIDL!{#[uuid(0xa84cee02, 0x3eea, 0x4eee, 0xa8, 0x27, 0x87, 0xc1, 0xa0, 0x2a, 0x0f, 0xcc)]
449 interface IDWriteFontCollection(IDWriteFontCollectionVtbl): IUnknown(IUnknownVtbl) {
450 fn GetFontFamilyCount() -> UINT32,
451 fn GetFontFamily(
452 index: UINT32,
453 fontFamily: *mut *mut IDWriteFontFamily,
454 ) -> HRESULT,
455 fn FindFamilyName(
456 familyName: *const WCHAR,
457 index: *mut UINT32,
458 exists: *mut BOOL,
459 ) -> HRESULT,
460 fn GetFontFromFontFace(
461 fontFace: *mut IDWriteFontFace,
462 font: *mut *mut IDWriteFont,
463 ) -> HRESULT,
464 }}
465 RIDL!{#[uuid(0x1a0d8438, 0x1d97, 0x4ec1, 0xae, 0xf9, 0xa2, 0xfb, 0x86, 0xed, 0x6a, 0xcb)]
466 interface IDWriteFontList(IDWriteFontListVtbl): IUnknown(IUnknownVtbl) {
467 fn GetFontCollection(
468 fontCollection: *mut *mut IDWriteFontCollection,
469 ) -> HRESULT,
470 fn GetFontCount() -> UINT32,
471 fn GetFont(
472 index: UINT32,
473 font: *mut *mut IDWriteFont,
474 ) -> HRESULT,
475 }}
476 RIDL!{#[uuid(0xda20d8ef, 0x812a, 0x4c43, 0x98, 0x02, 0x62, 0xec, 0x4a, 0xbd, 0x7a, 0xdd)]
477 interface IDWriteFontFamily(IDWriteFontFamilyVtbl): IDWriteFontList(IDWriteFontListVtbl) {
478 fn GetFamilyNames(
479 names: *mut *mut IDWriteLocalizedStrings,
480 ) -> HRESULT,
481 fn GetFirstMatchingFont(
482 weight: DWRITE_FONT_WEIGHT,
483 stretch: DWRITE_FONT_STRETCH,
484 style: DWRITE_FONT_STYLE,
485 matchingFont: *mut *mut IDWriteFont,
486 ) -> HRESULT,
487 fn GetMatchingFonts(
488 weight: DWRITE_FONT_WEIGHT,
489 stretch: DWRITE_FONT_STRETCH,
490 style: DWRITE_FONT_STYLE,
491 matchingFonts: *mut *mut IDWriteFontList,
492 ) -> HRESULT,
493 }}
494 RIDL!{#[uuid(0xacd16696, 0x8c14, 0x4f5d, 0x87, 0x7e, 0xfe, 0x3f, 0xc1, 0xd3, 0x27, 0x37)]
495 interface IDWriteFont(IDWriteFontVtbl): IUnknown(IUnknownVtbl) {
496 fn GetFontFamily(
497 fontFamily: *mut *mut IDWriteFontFamily,
498 ) -> HRESULT,
499 fn GetWeight() -> DWRITE_FONT_WEIGHT,
500 fn GetStretch() -> DWRITE_FONT_STRETCH,
501 fn GetStyle() -> DWRITE_FONT_STYLE,
502 fn IsSymbolFont() -> BOOL,
503 fn GetFaceNames(
504 names: *mut *mut IDWriteLocalizedStrings,
505 ) -> HRESULT,
506 fn GetInformationalStrings(
507 informationalStringId: DWRITE_INFORMATIONAL_STRING_ID,
508 informationalStrings: *mut *mut IDWriteLocalizedStrings,
509 exists: *mut BOOL,
510 ) -> HRESULT,
511 fn GetSimulations() -> DWRITE_FONT_SIMULATIONS,
512 fn GetMetrics(
513 fontMetrics: *mut DWRITE_FONT_METRICS,
514 ) -> (),
515 fn HasCharacter(
516 unicodeValue: UINT32,
517 exists: *mut BOOL,
518 ) -> HRESULT,
519 fn CreateFontFace(
520 fontFace: *mut *mut IDWriteFontFace,
521 ) -> HRESULT,
522 }}
523 ENUM!{enum DWRITE_READING_DIRECTION {
524 DWRITE_READING_DIRECTION_LEFT_TO_RIGHT = 0,
525 DWRITE_READING_DIRECTION_RIGHT_TO_LEFT = 1,
526 DWRITE_READING_DIRECTION_TOP_TO_BOTTOM = 2,
527 DWRITE_READING_DIRECTION_BOTTOM_TO_TOP = 3,
528 }}
529 ENUM!{enum DWRITE_FLOW_DIRECTION {
530 DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM = 0,
531 DWRITE_FLOW_DIRECTION_BOTTOM_TO_TOP = 1,
532 DWRITE_FLOW_DIRECTION_LEFT_TO_RIGHT = 2,
533 DWRITE_FLOW_DIRECTION_RIGHT_TO_LEFT = 3,
534 }}
535 ENUM!{enum DWRITE_TEXT_ALIGNMENT {
536 DWRITE_TEXT_ALIGNMENT_LEADING,
537 DWRITE_TEXT_ALIGNMENT_TRAILING,
538 DWRITE_TEXT_ALIGNMENT_CENTER,
539 DWRITE_TEXT_ALIGNMENT_JUSTIFIED,
540 }}
541 ENUM!{enum DWRITE_PARAGRAPH_ALIGNMENT {
542 DWRITE_PARAGRAPH_ALIGNMENT_NEAR,
543 DWRITE_PARAGRAPH_ALIGNMENT_FAR,
544 DWRITE_PARAGRAPH_ALIGNMENT_CENTER,
545 }}
546 ENUM!{enum DWRITE_WORD_WRAPPING {
547 DWRITE_WORD_WRAPPING_WRAP = 0,
548 DWRITE_WORD_WRAPPING_NO_WRAP = 1,
549 DWRITE_WORD_WRAPPING_EMERGENCY_BREAK = 2,
550 DWRITE_WORD_WRAPPING_WHOLE_WORD = 3,
551 DWRITE_WORD_WRAPPING_CHARACTER = 4,
552 }}
553 ENUM!{enum DWRITE_LINE_SPACING_METHOD {
554 DWRITE_LINE_SPACING_METHOD_DEFAULT,
555 DWRITE_LINE_SPACING_METHOD_UNIFORM,
556 DWRITE_LINE_SPACING_METHOD_PROPORTIONAL,
557 }}
558 ENUM!{enum DWRITE_TRIMMING_GRANULARITY {
559 DWRITE_TRIMMING_GRANULARITY_NONE,
560 DWRITE_TRIMMING_GRANULARITY_CHARACTER,
561 DWRITE_TRIMMING_GRANULARITY_WORD,
562 }}
563 ENUM!{enum DWRITE_FONT_FEATURE_TAG {
564 DWRITE_FONT_FEATURE_TAG_ALTERNATIVE_FRACTIONS = 0x63726661, // 'afrc'
565 DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS_FROM_CAPITALS = 0x63703263, // 'c2pc'
566 DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS_FROM_CAPITALS = 0x63733263, // 'c2sc'
567 DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_ALTERNATES = 0x746c6163, // 'calt'
568 DWRITE_FONT_FEATURE_TAG_CASE_SENSITIVE_FORMS = 0x65736163, // 'case'
569 DWRITE_FONT_FEATURE_TAG_GLYPH_COMPOSITION_DECOMPOSITION = 0x706d6363, // 'ccmp'
570 DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_LIGATURES = 0x67696c63, // 'clig'
571 DWRITE_FONT_FEATURE_TAG_CAPITAL_SPACING = 0x70737063, // 'cpsp'
572 DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_SWASH = 0x68777363, // 'cswh'
573 DWRITE_FONT_FEATURE_TAG_CURSIVE_POSITIONING = 0x73727563, // 'curs'
574 DWRITE_FONT_FEATURE_TAG_DEFAULT = 0x746c6664, // 'dflt'
575 DWRITE_FONT_FEATURE_TAG_DISCRETIONARY_LIGATURES = 0x67696c64, // 'dlig'
576 DWRITE_FONT_FEATURE_TAG_EXPERT_FORMS = 0x74707865, // 'expt'
577 DWRITE_FONT_FEATURE_TAG_FRACTIONS = 0x63617266, // 'frac'
578 DWRITE_FONT_FEATURE_TAG_FULL_WIDTH = 0x64697766, // 'fwid'
579 DWRITE_FONT_FEATURE_TAG_HALF_FORMS = 0x666c6168, // 'half'
580 DWRITE_FONT_FEATURE_TAG_HALANT_FORMS = 0x6e6c6168, // 'haln'
581 DWRITE_FONT_FEATURE_TAG_ALTERNATE_HALF_WIDTH = 0x746c6168, // 'halt'
582 DWRITE_FONT_FEATURE_TAG_HISTORICAL_FORMS = 0x74736968, // 'hist'
583 DWRITE_FONT_FEATURE_TAG_HORIZONTAL_KANA_ALTERNATES = 0x616e6b68, // 'hkna'
584 DWRITE_FONT_FEATURE_TAG_HISTORICAL_LIGATURES = 0x67696c68, // 'hlig'
585 DWRITE_FONT_FEATURE_TAG_HALF_WIDTH = 0x64697768, // 'hwid'
586 DWRITE_FONT_FEATURE_TAG_HOJO_KANJI_FORMS = 0x6f6a6f68, // 'hojo'
587 DWRITE_FONT_FEATURE_TAG_JIS04_FORMS = 0x3430706a, // 'jp04'
588 DWRITE_FONT_FEATURE_TAG_JIS78_FORMS = 0x3837706a, // 'jp78'
589 DWRITE_FONT_FEATURE_TAG_JIS83_FORMS = 0x3338706a, // 'jp83'
590 DWRITE_FONT_FEATURE_TAG_JIS90_FORMS = 0x3039706a, // 'jp90'
591 DWRITE_FONT_FEATURE_TAG_KERNING = 0x6e72656b, // 'kern'
592 DWRITE_FONT_FEATURE_TAG_STANDARD_LIGATURES = 0x6167696c, // 'liga'
593 DWRITE_FONT_FEATURE_TAG_LINING_FIGURES = 0x6d756e6c, // 'lnum'
594 DWRITE_FONT_FEATURE_TAG_LOCALIZED_FORMS = 0x6c636f6c, // 'locl'
595 DWRITE_FONT_FEATURE_TAG_MARK_POSITIONING = 0x6b72616d, // 'mark'
596 DWRITE_FONT_FEATURE_TAG_MATHEMATICAL_GREEK = 0x6b72676d, // 'mgrk'
597 DWRITE_FONT_FEATURE_TAG_MARK_TO_MARK_POSITIONING = 0x6b6d6b6d, // 'mkmk'
598 DWRITE_FONT_FEATURE_TAG_ALTERNATE_ANNOTATION_FORMS = 0x746c616e, // 'nalt'
599 DWRITE_FONT_FEATURE_TAG_NLC_KANJI_FORMS = 0x6b636c6e, // 'nlck'
600 DWRITE_FONT_FEATURE_TAG_OLD_STYLE_FIGURES = 0x6d756e6f, // 'onum'
601 DWRITE_FONT_FEATURE_TAG_ORDINALS = 0x6e64726f, // 'ordn'
602 DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_ALTERNATE_WIDTH = 0x746c6170, // 'palt'
603 DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS = 0x70616370, // 'pcap'
604 DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_FIGURES = 0x6d756e70, // 'pnum'
605 DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_WIDTHS = 0x64697770, // 'pwid'
606 DWRITE_FONT_FEATURE_TAG_QUARTER_WIDTHS = 0x64697771, // 'qwid'
607 DWRITE_FONT_FEATURE_TAG_REQUIRED_LIGATURES = 0x67696c72, // 'rlig'
608 DWRITE_FONT_FEATURE_TAG_RUBY_NOTATION_FORMS = 0x79627572, // 'ruby'
609 DWRITE_FONT_FEATURE_TAG_STYLISTIC_ALTERNATES = 0x746c6173, // 'salt'
610 DWRITE_FONT_FEATURE_TAG_SCIENTIFIC_INFERIORS = 0x666e6973, // 'sinf'
611 DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS = 0x70636d73, // 'smcp'
612 DWRITE_FONT_FEATURE_TAG_SIMPLIFIED_FORMS = 0x6c706d73, // 'smpl'
613 DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1 = 0x31307373, // 'ss01'
614 DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_2 = 0x32307373, // 'ss02'
615 DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_3 = 0x33307373, // 'ss03'
616 DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_4 = 0x34307373, // 'ss04'
617 DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_5 = 0x35307373, // 'ss05'
618 DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_6 = 0x36307373, // 'ss06'
619 DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_7 = 0x37307373, // 'ss07'
620 DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_8 = 0x38307373, // 'ss08'
621 DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_9 = 0x39307373, // 'ss09'
622 DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_10 = 0x30317373, // 'ss10'
623 DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_11 = 0x31317373, // 'ss11'
624 DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_12 = 0x32317373, // 'ss12'
625 DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_13 = 0x33317373, // 'ss13'
626 DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_14 = 0x34317373, // 'ss14'
627 DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_15 = 0x35317373, // 'ss15'
628 DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_16 = 0x36317373, // 'ss16'
629 DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_17 = 0x37317373, // 'ss17'
630 DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_18 = 0x38317373, // 'ss18'
631 DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_19 = 0x39317373, // 'ss19'
632 DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_20 = 0x30327373, // 'ss20'
633 DWRITE_FONT_FEATURE_TAG_SUBSCRIPT = 0x73627573, // 'subs'
634 DWRITE_FONT_FEATURE_TAG_SUPERSCRIPT = 0x73707573, // 'sups'
635 DWRITE_FONT_FEATURE_TAG_SWASH = 0x68737773, // 'swsh'
636 DWRITE_FONT_FEATURE_TAG_TITLING = 0x6c746974, // 'titl'
637 DWRITE_FONT_FEATURE_TAG_TRADITIONAL_NAME_FORMS = 0x6d616e74, // 'tnam'
638 DWRITE_FONT_FEATURE_TAG_TABULAR_FIGURES = 0x6d756e74, // 'tnum'
639 DWRITE_FONT_FEATURE_TAG_TRADITIONAL_FORMS = 0x64617274, // 'trad'
640 DWRITE_FONT_FEATURE_TAG_THIRD_WIDTHS = 0x64697774, // 'twid'
641 DWRITE_FONT_FEATURE_TAG_UNICASE = 0x63696e75, // 'unic'
642 DWRITE_FONT_FEATURE_TAG_VERTICAL_WRITING = 0x74726576, // 'vert'
643 DWRITE_FONT_FEATURE_TAG_VERTICAL_ALTERNATES_AND_ROTATION = 0x32747276, // 'vrt2'
644 DWRITE_FONT_FEATURE_TAG_SLASHED_ZERO = 0x6f72657a, // 'zero'
645 }}
646 STRUCT!{struct DWRITE_TEXT_RANGE {
647 startPosition: UINT32,
648 length: UINT32,
649 }}
650 STRUCT!{struct DWRITE_FONT_FEATURE {
651 nameTag: DWRITE_FONT_FEATURE_TAG,
652 parameter: UINT32,
653 }}
654 STRUCT!{struct DWRITE_TYPOGRAPHIC_FEATURES {
655 features: *mut DWRITE_FONT_FEATURE,
656 featureCount: UINT32,
657 }}
658 STRUCT!{struct DWRITE_TRIMMING {
659 granularity: DWRITE_TRIMMING_GRANULARITY,
660 delimiter: UINT32,
661 delimiterCount: UINT32,
662 }}
663 RIDL!{#[uuid(0x9c906818, 0x31d7, 0x4fd3, 0xa1, 0x51, 0x7c, 0x5e, 0x22, 0x5d, 0xb5, 0x5a)]
664 interface IDWriteTextFormat(IDWriteTextFormatVtbl): IUnknown(IUnknownVtbl) {
665 fn SetTextAlignment(
666 textAlignment: DWRITE_TEXT_ALIGNMENT,
667 ) -> HRESULT,
668 fn SetParagraphAlignment(
669 paragraphAlignment: DWRITE_PARAGRAPH_ALIGNMENT,
670 ) -> HRESULT,
671 fn SetWordWrapping(
672 wordWrapping: DWRITE_WORD_WRAPPING,
673 ) -> HRESULT,
674 fn SetReadingDirection(
675 readingDirection: DWRITE_READING_DIRECTION,
676 ) -> HRESULT,
677 fn SetFlowDirection(
678 flowDirection: DWRITE_FLOW_DIRECTION,
679 ) -> HRESULT,
680 fn SetIncrementalTabStop(
681 incrementalTabStop: FLOAT,
682 ) -> HRESULT,
683 fn SetTrimming(
684 trimmingOptions: *const DWRITE_TRIMMING,
685 trimmingSign: *mut IDWriteInlineObject,
686 ) -> HRESULT,
687 fn SetLineSpacing(
688 lineSpacingMethod: DWRITE_LINE_SPACING_METHOD,
689 lineSpacing: FLOAT,
690 baseLine: FLOAT,
691 ) -> HRESULT,
692 fn GetTextAlignment() -> DWRITE_TEXT_ALIGNMENT,
693 fn GetParagraphAlignment() -> DWRITE_PARAGRAPH_ALIGNMENT,
694 fn GetWordWrapping() -> DWRITE_WORD_WRAPPING,
695 fn GetReadingDirection() -> DWRITE_READING_DIRECTION,
696 fn GetFlowDirection() -> DWRITE_FLOW_DIRECTION,
697 fn GetIncrementalTabStop() -> FLOAT,
698 fn GetTrimming(
699 trimmingOptions: *mut DWRITE_TRIMMING,
700 trimmingSign: *mut *mut IDWriteInlineObject,
701 ) -> HRESULT,
702 fn GetLineSpacing(
703 lineSpacingMethod: *mut DWRITE_LINE_SPACING_METHOD,
704 lineSpacing: *mut FLOAT,
705 baseline: *mut FLOAT,
706 ) -> HRESULT,
707 fn GetFontCollection(
708 fontCollection: *mut *mut IDWriteFontCollection,
709 ) -> HRESULT,
710 fn GetFontFamilyNameLength() -> UINT32,
711 fn GetFontFamilyName(
712 fontFamilyName: *mut WCHAR,
713 nameSize: UINT32,
714 ) -> HRESULT,
715 fn GetFontWeight() -> DWRITE_FONT_WEIGHT,
716 fn GetFontStyle() -> DWRITE_FONT_STYLE,
717 fn GetFontStretch() -> DWRITE_FONT_STRETCH,
718 fn GetFontSize() -> FLOAT,
719 fn GetLocaleNameLength() -> UINT32,
720 fn GetLocaleName(
721 localeName: *mut WCHAR,
722 nameSize: UINT32,
723 ) -> HRESULT,
724 }}
725 RIDL!{#[uuid(0x55f1112b, 0x1dc2, 0x4b3c, 0x95, 0x41, 0xf4, 0x68, 0x94, 0xed, 0x85, 0xb6)]
726 interface IDWriteTypography(IDWriteTypographyVtbl): IUnknown(IUnknownVtbl) {
727 fn AddFontFeature(
728 fontFeature: DWRITE_FONT_FEATURE,
729 ) -> HRESULT,
730 fn GetFontFeatureCount() -> UINT32,
731 fn GetFontFeature(
732 fontFeatureIndex: UINT32,
733 fontFeature: *mut DWRITE_FONT_FEATURE,
734 ) -> HRESULT,
735 }}
736 ENUM!{enum DWRITE_SCRIPT_SHAPES {
737 DWRITE_SCRIPT_SHAPES_DEFAULT = 0,
738 DWRITE_SCRIPT_SHAPES_NO_VISUAL = 1,
739 }}
740 STRUCT!{struct DWRITE_SCRIPT_ANALYSIS {
741 script: UINT16,
742 shapes: DWRITE_SCRIPT_SHAPES,
743 }}
744 ENUM!{enum DWRITE_BREAK_CONDITION {
745 DWRITE_BREAK_CONDITION_NEUTRAL,
746 DWRITE_BREAK_CONDITION_CAN_BREAK,
747 DWRITE_BREAK_CONDITION_MAY_NOT_BREAK,
748 DWRITE_BREAK_CONDITION_MUST_BREAK,
749 }}
750 STRUCT!{struct DWRITE_LINE_BREAKPOINT {
751 bit_fields: UINT8,
752 }}
753 BITFIELD!{DWRITE_LINE_BREAKPOINT bit_fields: UINT8 [
754 breakConditionBefore set_breakConditionBefore[0..2],
755 breakConditionAfter set_breakConditionAfter[2..4],
756 isWhitespace set_isWhitespace[4..5],
757 isSoftHyphen set_isSoftHyphen[5..6],
758 padding set_padding[6..8],
759 ]}
760 ENUM!{enum DWRITE_NUMBER_SUBSTITUTION_METHOD {
761 DWRITE_NUMBER_SUBSTITUTION_METHOD_FROM_CULTURE,
762 DWRITE_NUMBER_SUBSTITUTION_METHOD_CONTEXTUAL,
763 DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE,
764 DWRITE_NUMBER_SUBSTITUTION_METHOD_NATIONAL,
765 DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL,
766 }}
767 RIDL!{#[uuid(0x14885cc9, 0xbab0, 0x4f90, 0xb6, 0xed, 0x5c, 0x36, 0x6a, 0x2c, 0xd0, 0x3d)]
768 interface IDWriteNumberSubstitution(IDWriteNumberSubstitutionVtbl): IUnknown(IUnknownVtbl) {}}
769 STRUCT!{struct DWRITE_SHAPING_TEXT_PROPERTIES {
770 bit_fields: UINT16,
771 }}
772 BITFIELD!{DWRITE_SHAPING_TEXT_PROPERTIES bit_fields: UINT16 [
773 isShapedAlone set_isShapedAlone[0..1],
774 reserved set_reserved[1..16],
775 ]}
776 STRUCT!{struct DWRITE_SHAPING_GLYPH_PROPERTIES {
777 bit_fields: UINT16,
778 }}
779 BITFIELD!{DWRITE_SHAPING_GLYPH_PROPERTIES bit_fields: UINT16 [
780 justification set_justification[0..4],
781 isClusterStart set_isClusterStart[4..5],
782 isDiacritic set_isDiacritic[5..6],
783 isZeroWidthSpace set_isZeroWidthSpace[6..7],
784 reserved set_reserved[7..16],
785 ]}
786 RIDL!{#[uuid(0x688e1a58, 0x5094, 0x47c8, 0xad, 0xc8, 0xfb, 0xce, 0xa6, 0x0a, 0xe9, 0x2b)]
787 interface IDWriteTextAnalysisSource(IDWriteTextAnalysisSourceVtbl): IUnknown(IUnknownVtbl) {
788 fn GetTextAtPosition(
789 textPosition: UINT32,
790 textString: *mut *const WCHAR,
791 textLength: *mut UINT32,
792 ) -> HRESULT,
793 fn GetTextBeforePosition(
794 textPosition: UINT32,
795 textString: *mut *const WCHAR,
796 textLength: *mut UINT32,
797 ) -> HRESULT,
798 fn GetParagraphReadingDirection() -> DWRITE_READING_DIRECTION,
799 fn GetLocaleName(
800 textPosition: UINT32,
801 textLength: *mut UINT32,
802 localeName: *mut *const WCHAR,
803 ) -> HRESULT,
804 fn GetNumberSubstitution(
805 textPosition: UINT32,
806 textLength: *mut UINT32,
807 numberSubstitution: *mut *mut IDWriteNumberSubstitution,
808 ) -> HRESULT,
809 }}
810 RIDL!{#[uuid(0x5810cd44, 0x0ca0, 0x4701, 0xb3, 0xfa, 0xbe, 0xc5, 0x18, 0x2a, 0xe4, 0xf6)]
811 interface IDWriteTextAnalysisSink(IDWriteTextAnalysisSinkVtbl): IUnknown(IUnknownVtbl) {
812 fn SetScriptAnalysis(
813 textPosition: UINT32,
814 textLength: UINT32,
815 scriptAnalysis: *const DWRITE_SCRIPT_ANALYSIS,
816 ) -> HRESULT,
817 fn SetLineBreakpoints(
818 textPosition: UINT32,
819 textLength: UINT32,
820 lineBreakpoints: *const DWRITE_LINE_BREAKPOINT,
821 ) -> HRESULT,
822 fn SetBidiLevel(
823 textPosition: UINT32,
824 textLength: UINT32,
825 explicitLevel: UINT8,
826 resolvedLevel: UINT8,
827 ) -> HRESULT,
828 fn SetNumberSubstitution(
829 textPosition: UINT32,
830 textLength: UINT32,
831 numberSubstitution: *mut IDWriteNumberSubstitution,
832 ) -> HRESULT,
833 }}
834 RIDL!{#[uuid(0xb7e6163e, 0x7f46, 0x43b4, 0x84, 0xb3, 0xe4, 0xe6, 0x24, 0x9c, 0x36, 0x5d)]
835 interface IDWriteTextAnalyzer(IDWriteTextAnalyzerVtbl): IUnknown(IUnknownVtbl) {
836 fn AnalyzeScript(
837 analysisSource: *mut IDWriteTextAnalysisSource,
838 textPosition: UINT32,
839 textLength: UINT32,
840 analysisSink: *mut IDWriteTextAnalysisSink,
841 ) -> HRESULT,
842 fn AnalyzeBidi(
843 analysisSource: *mut IDWriteTextAnalysisSource,
844 textPosition: UINT32,
845 textLength: UINT32,
846 analysisSink: *mut IDWriteTextAnalysisSink,
847 ) -> HRESULT,
848 fn AnalyzeNumberSubstitution(
849 analysisSource: *mut IDWriteTextAnalysisSource,
850 textPosition: UINT32,
851 textLength: UINT32,
852 analysisSink: *mut IDWriteTextAnalysisSink,
853 ) -> HRESULT,
854 fn AnalyzeLineBreakpoints(
855 analysisSource: *mut IDWriteTextAnalysisSource,
856 textPosition: UINT32,
857 textLength: UINT32,
858 analysisSink: *mut IDWriteTextAnalysisSink,
859 ) -> HRESULT,
860 fn GetGlyphs(
861 textString: *const WCHAR,
862 textLength: UINT32,
863 fontFace: *mut IDWriteFontFace,
864 isSideways: BOOL,
865 isRightToLeft: BOOL,
866 scriptAnalysis: *const DWRITE_SCRIPT_ANALYSIS,
867 localeName: *const WCHAR,
868 numberSubstitution: *mut IDWriteNumberSubstitution,
869 features: *mut *const DWRITE_TYPOGRAPHIC_FEATURES,
870 featureRangeLengths: *const UINT32,
871 featureRanges: UINT32,
872 maxGlyphCount: UINT32,
873 clusterMap: *mut UINT16,
874 textProps: *mut DWRITE_SHAPING_TEXT_PROPERTIES,
875 glyphIndices: *mut UINT16,
876 glyphProps: *mut DWRITE_SHAPING_GLYPH_PROPERTIES,
877 actualGlyphCount: *mut UINT32,
878 ) -> HRESULT,
879 fn GetGlyphPlacements(
880 textString: *const WCHAR,
881 clusterMap: *const UINT16,
882 textProps: *mut DWRITE_SHAPING_TEXT_PROPERTIES,
883 textLength: UINT32,
884 glyphIndices: *const UINT16,
885 glyphProps: *const DWRITE_SHAPING_GLYPH_PROPERTIES,
886 glyphCount: UINT32,
887 fontFace: *mut IDWriteFontFace,
888 fontEmSize: FLOAT,
889 isSideways: BOOL,
890 isRightToLeft: BOOL,
891 scriptAnalysis: *const DWRITE_SCRIPT_ANALYSIS,
892 localeName: *const WCHAR,
893 features: *mut *const DWRITE_TYPOGRAPHIC_FEATURES,
894 featureRangeLengths: *const UINT32,
895 featureRanges: UINT32,
896 glyphAdvances: *mut FLOAT,
897 glyphOffsets: *mut DWRITE_GLYPH_OFFSET,
898 ) -> HRESULT,
899 fn GetGdiCompatibleGlyphPlacements(
900 textString: *const WCHAR,
901 clusterMap: *const UINT16,
902 textProps: *mut DWRITE_SHAPING_TEXT_PROPERTIES,
903 textLength: UINT32,
904 glyphIndices: *const UINT16,
905 glyphProps: *const DWRITE_SHAPING_GLYPH_PROPERTIES,
906 glyphCount: UINT32,
907 fontFace: *mut IDWriteFontFace,
908 fontEmSize: FLOAT,
909 pixelsPerDip: FLOAT,
910 transform: *const DWRITE_MATRIX,
911 useGdiNatrual: BOOL,
912 isSideways: BOOL,
913 isRightToLeft: BOOL,
914 scriptAnalysis: *const DWRITE_SCRIPT_ANALYSIS,
915 localeName: *const WCHAR,
916 features: *mut *const DWRITE_TYPOGRAPHIC_FEATURES,
917 featureRangeLengths: *const UINT32,
918 featureRanges: UINT32,
919 glyphAdvances: *mut FLOAT,
920 glyphOffsets: *mut DWRITE_GLYPH_OFFSET,
921 ) -> HRESULT,
922 }}
923 STRUCT!{struct DWRITE_GLYPH_RUN {
924 fontFace: *mut IDWriteFontFace,
925 fontEmSize: FLOAT,
926 glyphCount: UINT32,
927 glyphIndices: *const UINT16,
928 glyphAdvances: *const FLOAT,
929 glyphOffsets: *const DWRITE_GLYPH_OFFSET,
930 isSideways: BOOL,
931 bidiLevel: UINT32,
932 }}
933 STRUCT!{struct DWRITE_GLYPH_RUN_DESCRIPTION {
934 localeName: *const WCHAR,
935 string: *const WCHAR,
936 stringLength: UINT32,
937 clusterMap: *const UINT16,
938 textPosition: UINT32,
939 }}
940 STRUCT!{struct DWRITE_UNDERLINE {
941 width: FLOAT,
942 thickness: FLOAT,
943 offset: FLOAT,
944 runHeight: FLOAT,
945 readingDirection: DWRITE_READING_DIRECTION,
946 flowDirection: DWRITE_FLOW_DIRECTION,
947 localeName: *const WCHAR,
948 measuringMode: DWRITE_MEASURING_MODE,
949 }}
950 STRUCT!{struct DWRITE_STRIKETHROUGH {
951 width: FLOAT,
952 thickness: FLOAT,
953 offset: FLOAT,
954 readingDirection: DWRITE_READING_DIRECTION,
955 flowDirection: DWRITE_FLOW_DIRECTION,
956 localeName: *const WCHAR,
957 measuringMode: DWRITE_MEASURING_MODE,
958 }}
959 STRUCT!{struct DWRITE_LINE_METRICS {
960 length: UINT32,
961 trailingWhitespaceLength: UINT32,
962 newlineLength: UINT32,
963 height: FLOAT,
964 baseline: FLOAT,
965 isTrimmed: BOOL,
966 }}
967 STRUCT!{struct DWRITE_CLUSTER_METRICS {
968 width: FLOAT,
969 length: UINT16,
970 bit_fields: UINT16,
971 }}
972 BITFIELD!{DWRITE_CLUSTER_METRICS bit_fields: UINT16 [
973 canWrapLineAfter set_canWrapLineAfter[0..1],
974 isWhitespace set_isWhitespace[1..2],
975 isNewline set_isNewline[2..3],
976 isSoftHyphen set_isSoftHyphen[3..4],
977 isRightToLeft set_isRightToLeft[4..5],
978 padding set_padding[5..16],
979 ]}
980 STRUCT!{struct DWRITE_TEXT_METRICS {
981 left: FLOAT,
982 top: FLOAT,
983 width: FLOAT,
984 widthIncludingTrailingWhitespace: FLOAT,
985 height: FLOAT,
986 layoutWidth: FLOAT,
987 layoutHeight: FLOAT,
988 maxBidiReorderingDepth: UINT32,
989 lineCount: UINT32,
990 }}
991 STRUCT!{struct DWRITE_INLINE_OBJECT_METRICS {
992 width: FLOAT,
993 height: FLOAT,
994 baseline: FLOAT,
995 supportsSideways: BOOL,
996 }}
997 STRUCT!{struct DWRITE_OVERHANG_METRICS {
998 left: FLOAT,
999 top: FLOAT,
1000 right: FLOAT,
1001 bottom: FLOAT,
1002 }}
1003 STRUCT!{struct DWRITE_HIT_TEST_METRICS {
1004 textPosition: UINT32,
1005 length: UINT32,
1006 left: FLOAT,
1007 top: FLOAT,
1008 width: FLOAT,
1009 height: FLOAT,
1010 bidiLevel: UINT32,
1011 isText: BOOL,
1012 isTrimmed: BOOL,
1013 }}
1014 RIDL!{#[uuid(0x8339fde3, 0x106f, 0x47ab, 0x83, 0x73, 0x1c, 0x62, 0x95, 0xeb, 0x10, 0xb3)]
1015 interface IDWriteInlineObject(IDWriteInlineObjectVtbl): IUnknown(IUnknownVtbl) {
1016 fn Draw(
1017 clientDrawingContext: *mut c_void,
1018 renderer: *mut IDWriteTextRenderer,
1019 originX: FLOAT,
1020 originY: FLOAT,
1021 isSideways: BOOL,
1022 isRightToLeft: BOOL,
1023 clientDrawingEffect: *mut IUnknown,
1024 ) -> HRESULT,
1025 fn GetMetrics(
1026 metrics: *mut DWRITE_INLINE_OBJECT_METRICS,
1027 ) -> HRESULT,
1028 fn GetOverhangMetrics(
1029 overhangs: *mut DWRITE_OVERHANG_METRICS,
1030 ) -> HRESULT,
1031 fn GetBreakConditions(
1032 breakConditionBefore: *mut DWRITE_BREAK_CONDITION,
1033 breakConditionAfter: *mut DWRITE_BREAK_CONDITION,
1034 ) -> HRESULT,
1035 }}
1036 RIDL!{#[uuid(0xeaf3a2da, 0xecf4, 0x4d24, 0xb6, 0x44, 0xb3, 0x4f, 0x68, 0x42, 0x02, 0x4b)]
1037 interface IDWritePixelSnapping(IDWritePixelSnappingVtbl): IUnknown(IUnknownVtbl) {
1038 fn IsPixelSnappingDisabled(
1039 clientDrawingContext: *mut c_void,
1040 isDisabled: *mut BOOL,
1041 ) -> HRESULT,
1042 fn GetCurrentTransform(
1043 clientDrawingContext: *mut c_void,
1044 transform: *mut DWRITE_MATRIX,
1045 ) -> HRESULT,
1046 fn GetPixelsPerDip(
1047 clientDrawingContext: *mut c_void,
1048 pixelsPerDip: *mut FLOAT,
1049 ) -> HRESULT,
1050 }}
1051 RIDL!{#[uuid(0xef8a8135, 0x5cc6, 0x45fe, 0x88, 0x25, 0xc5, 0xa0, 0x72, 0x4e, 0xb8, 0x19)]
1052 interface IDWriteTextRenderer(IDWriteTextRendererVtbl):
1053 IDWritePixelSnapping(IDWritePixelSnappingVtbl) {
1054 fn DrawGlyphRun(
1055 clientDrawingContext: *mut c_void,
1056 baselineOriginX: FLOAT,
1057 baselineOriginY: FLOAT,
1058 measuringMode: DWRITE_MEASURING_MODE,
1059 glyphRun: *const DWRITE_GLYPH_RUN,
1060 glyphRunDescription: *const DWRITE_GLYPH_RUN_DESCRIPTION,
1061 clientDrawingEffect: *mut IUnknown,
1062 ) -> HRESULT,
1063 fn DrawUnderline(
1064 clientDrawingContext: *mut c_void,
1065 baselineOriginX: FLOAT,
1066 baselineOriginY: FLOAT,
1067 underline: *const DWRITE_UNDERLINE,
1068 clientDrawingEffect: *mut IUnknown,
1069 ) -> HRESULT,
1070 fn DrawStrikethrough(
1071 clientDrawingContext: *mut c_void,
1072 baselineOriginX: FLOAT,
1073 baselineOriginY: FLOAT,
1074 strikethrough: *const DWRITE_STRIKETHROUGH,
1075 clientDrawingEffect: *mut IUnknown,
1076 ) -> HRESULT,
1077 fn DrawInlineObject(
1078 clientDrawingContext: *mut c_void,
1079 baselineOriginX: FLOAT,
1080 baselineOriginY: FLOAT,
1081 inlineObject: *mut IDWriteInlineObject,
1082 isSideways: BOOL,
1083 isRightToLeft: BOOL,
1084 clientDrawingEffect: *mut IUnknown,
1085 ) -> HRESULT,
1086 }}
1087 RIDL!{#[uuid(0x53737037, 0x6d14, 0x410b, 0x9b, 0xfe, 0x0b, 0x18, 0x2b, 0xb7, 0x09, 0x61)]
1088 interface IDWriteTextLayout(IDWriteTextLayoutVtbl):
1089 IDWriteTextFormat(IDWriteTextFormatVtbl) {
1090 fn SetMaxWidth(
1091 maxWidth: FLOAT,
1092 ) -> HRESULT,
1093 fn SetMaxHeight(
1094 maxHeight: FLOAT,
1095 ) -> HRESULT,
1096 fn SetFontCollection(
1097 fontCollection: *mut IDWriteFontCollection,
1098 textRange: DWRITE_TEXT_RANGE,
1099 ) -> HRESULT,
1100 fn SetFontFamilyName(
1101 fontFamilyName: *const WCHAR,
1102 textRange: DWRITE_TEXT_RANGE,
1103 ) -> HRESULT,
1104 fn SetFontWeight(
1105 fontWeight: DWRITE_FONT_WEIGHT,
1106 textRange: DWRITE_TEXT_RANGE,
1107 ) -> HRESULT,
1108 fn SetFontStyle(
1109 fontStyle: DWRITE_FONT_STYLE,
1110 textRange: DWRITE_TEXT_RANGE,
1111 ) -> HRESULT,
1112 fn SetFontStretch(
1113 fontStretch: DWRITE_FONT_STRETCH,
1114 textRange: DWRITE_TEXT_RANGE,
1115 ) -> HRESULT,
1116 fn SetFontSize(
1117 fontSize: FLOAT,
1118 textRange: DWRITE_TEXT_RANGE,
1119 ) -> HRESULT,
1120 fn SetUnderline(
1121 hasUnderline: BOOL,
1122 textRange: DWRITE_TEXT_RANGE,
1123 ) -> HRESULT,
1124 fn SetStrikethrough(
1125 hasStrikethrough: BOOL,
1126 textRange: DWRITE_TEXT_RANGE,
1127 ) -> HRESULT,
1128 fn SetDrawingEffect(
1129 drawingEffect: *mut IUnknown,
1130 textRange: DWRITE_TEXT_RANGE,
1131 ) -> HRESULT,
1132 fn SetInlineObject(
1133 inlineObject: *mut IDWriteInlineObject,
1134 textRange: DWRITE_TEXT_RANGE,
1135 ) -> HRESULT,
1136 fn SetTypography(
1137 typography: *mut IDWriteTypography,
1138 textRange: DWRITE_TEXT_RANGE,
1139 ) -> HRESULT,
1140 fn SetLocaleName(
1141 localeName: *const WCHAR,
1142 textRange: DWRITE_TEXT_RANGE,
1143 ) -> HRESULT,
1144 fn GetMaxWidth() -> FLOAT,
1145 fn GetMaxHeight() -> FLOAT,
1146 fn GetFontCollection(
1147 currentPosition: UINT32,
1148 fontCollection: *mut *mut IDWriteFontCollection,
1149 textRange: *mut DWRITE_TEXT_RANGE,
1150 ) -> HRESULT,
1151 fn GetFontFamilyNameLength(
1152 currentPosition: UINT32,
1153 nameLength: *mut UINT32,
1154 textRange: *mut DWRITE_TEXT_RANGE,
1155 ) -> HRESULT,
1156 fn GetFontFamilyName(
1157 currentPosition: UINT32,
1158 fontFamilyName: *mut WCHAR,
1159 nameSize: UINT32,
1160 textRange: *mut DWRITE_TEXT_RANGE,
1161 ) -> HRESULT,
1162 fn GetFontWeight(
1163 currentPosition: UINT32,
1164 fontWeight: *mut DWRITE_FONT_WEIGHT,
1165 textRange: *mut DWRITE_TEXT_RANGE,
1166 ) -> HRESULT,
1167 fn GetFontStyle(
1168 currentPosition: UINT32,
1169 fontStyle: *mut DWRITE_FONT_STYLE,
1170 textRange: *mut DWRITE_TEXT_RANGE,
1171 ) -> HRESULT,
1172 fn GetFontStretch(
1173 currentPosition: UINT32,
1174 fontStretch: *mut DWRITE_FONT_STRETCH,
1175 textRange: *mut DWRITE_TEXT_RANGE,
1176 ) -> HRESULT,
1177 fn GetFontSize(
1178 currentPosition: UINT32,
1179 fontSize: *mut FLOAT,
1180 textRange: *mut DWRITE_TEXT_RANGE,
1181 ) -> HRESULT,
1182 fn GetUnderline(
1183 currentPosition: UINT32,
1184 hasUnderline: *mut BOOL,
1185 textRange: *mut DWRITE_TEXT_RANGE,
1186 ) -> HRESULT,
1187 fn GetStrikethrough(
1188 currentPosition: UINT32,
1189 hasStrikethrough: *mut BOOL,
1190 textRange: *mut DWRITE_TEXT_RANGE,
1191 ) -> HRESULT,
1192 fn GetDrawingEffect(
1193 currentPosition: UINT32,
1194 drawingEffect: *mut *mut IUnknown,
1195 textRange: *mut DWRITE_TEXT_RANGE,
1196 ) -> HRESULT,
1197 fn GetInlineObject(
1198 currentPosition: UINT32,
1199 inlineObject: *mut *mut IDWriteInlineObject,
1200 textRange: *mut DWRITE_TEXT_RANGE,
1201 ) -> HRESULT,
1202 fn GetTypography(
1203 currentPosition: UINT32,
1204 typography: *mut *mut IDWriteTypography,
1205 textRange: *mut DWRITE_TEXT_RANGE,
1206 ) -> HRESULT,
1207 fn GetLocaleNameLength(
1208 currentPosition: UINT32,
1209 nameLength: *mut UINT32,
1210 textRange: *mut DWRITE_TEXT_RANGE,
1211 ) -> HRESULT,
1212 fn GetLocaleName(
1213 currentPosition: UINT32,
1214 localeName: *mut WCHAR,
1215 nameSize: UINT32,
1216 textRange: *mut DWRITE_TEXT_RANGE,
1217 ) -> HRESULT,
1218 fn Draw(
1219 clientDrawingContext: *mut c_void,
1220 renderer: *mut IDWriteTextRenderer,
1221 originX: FLOAT,
1222 originY: FLOAT,
1223 ) -> HRESULT,
1224 fn GetLineMetrics(
1225 lineMetrics: *mut DWRITE_LINE_METRICS,
1226 maxLineCount: UINT32,
1227 actualLineCount: *mut UINT32,
1228 ) -> HRESULT,
1229 fn GetMetrics(
1230 textMetrics: *mut DWRITE_TEXT_METRICS,
1231 ) -> HRESULT,
1232 fn GetOverhangMetrics(
1233 overhangs: *mut DWRITE_OVERHANG_METRICS,
1234 ) -> HRESULT,
1235 fn GetClusterMetrics(
1236 clusterMetrics: *mut DWRITE_CLUSTER_METRICS,
1237 maxClusterCount: UINT32,
1238 actualClusterCount: *mut UINT32,
1239 ) -> HRESULT,
1240 fn DetermineMinWidth(
1241 minWidth: *mut FLOAT,
1242 ) -> HRESULT,
1243 fn HitTestPoint(
1244 pointX: FLOAT,
1245 pointY: FLOAT,
1246 isTrailingHit: *mut BOOL,
1247 isInside: *mut BOOL,
1248 hitTestMetrics: *mut DWRITE_HIT_TEST_METRICS,
1249 ) -> HRESULT,
1250 fn HitTestTextPosition(
1251 textPosition: UINT32,
1252 isTrailingHit: BOOL,
1253 pointX: *mut FLOAT,
1254 pointY: *mut FLOAT,
1255 hitTestMetrics: *mut DWRITE_HIT_TEST_METRICS,
1256 ) -> HRESULT,
1257 fn HitTestTextRange(
1258 textPosition: UINT32,
1259 textLength: UINT32,
1260 originX: FLOAT,
1261 originY: FLOAT,
1262 hitTestMetrics: *mut DWRITE_HIT_TEST_METRICS,
1263 maxHitTestMetricsCount: UINT32,
1264 actualHitTestMetricsCount: *mut UINT32,
1265 ) -> HRESULT,
1266 }}
1267 RIDL!{#[uuid(0x5e5a32a3, 0x8dff, 0x4773, 0x9f, 0xf6, 0x06, 0x96, 0xea, 0xb7, 0x72, 0x67)]
1268 interface IDWriteBitmapRenderTarget(IDWriteBitmapRenderTargetVtbl): IUnknown(IUnknownVtbl) {
1269 fn DrawGlyphRun(
1270 baselineOriginX: FLOAT,
1271 baselineOriginY: FLOAT,
1272 measuringMode: DWRITE_MEASURING_MODE,
1273 glyphRun: *const DWRITE_GLYPH_RUN,
1274 renderingParams: *mut IDWriteRenderingParams,
1275 textColor: COLORREF,
1276 blackBoxRect: *mut RECT,
1277 ) -> HRESULT,
1278 fn GetMemoryDC() -> HDC,
1279 fn GetPixelsPerDip() -> FLOAT,
1280 fn SetPixelsPerDip(
1281 pixelsPerDip: FLOAT,
1282 ) -> HRESULT,
1283 fn GetCurrentTransform(
1284 transform: *mut DWRITE_MATRIX,
1285 ) -> HRESULT,
1286 fn SetCurrentTransform(
1287 transform: *const DWRITE_MATRIX,
1288 ) -> HRESULT,
1289 fn GetSize(
1290 size: *mut SIZE,
1291 ) -> HRESULT,
1292 fn Resize(
1293 width: UINT32,
1294 height: UINT32,
1295 ) -> HRESULT,
1296 }}
1297 RIDL!{#[uuid(0x1edd9491, 0x9853, 0x4299, 0x89, 0x8f, 0x64, 0x32, 0x98, 0x3b, 0x6f, 0x3a)]
1298 interface IDWriteGdiInterop(IDWriteGdiInteropVtbl): IUnknown(IUnknownVtbl) {
1299 fn CreateFontFromLOGFONT(
1300 logFont: *const LOGFONTW,
1301 font: *mut *mut IDWriteFont,
1302 ) -> HRESULT,
1303 fn ConvertFontToLOGFONT(
1304 font: *mut IDWriteFont,
1305 logFont: *mut LOGFONTW,
1306 isSystemFont: *mut BOOL,
1307 ) -> HRESULT,
1308 fn ConvertFontFaceToLOGFONT(
1309 font: *mut IDWriteFontFace,
1310 logFont: *mut LOGFONTW,
1311 ) -> HRESULT,
1312 fn CreateFontFaceFromHdc(
1313 hdc: HDC,
1314 fontFace: *mut *mut IDWriteFontFace,
1315 ) -> HRESULT,
1316 fn CreateBitmapRenderTarget(
1317 hdc: HDC,
1318 width: UINT32,
1319 height: UINT32,
1320 renderTarget: *mut *mut IDWriteBitmapRenderTarget,
1321 ) -> HRESULT,
1322 }}
1323 ENUM!{enum DWRITE_TEXTURE_TYPE {
1324 DWRITE_TEXTURE_ALIASED_1x1 = 0,
1325 DWRITE_TEXTURE_CLEARTYPE_3x1 = 1,
1326 }}
1327 pub const DWRITE_ALPHA_MAX: BYTE = 255;
1328 RIDL!{#[uuid(0x7d97dbf7, 0xe085, 0x42d4, 0x81, 0xe3, 0x6a, 0x88, 0x3b, 0xde, 0xd1, 0x18)]
1329 interface IDWriteGlyphRunAnalysis(IDWriteGlyphRunAnalysisVtbl): IUnknown(IUnknownVtbl) {
1330 fn GetAlphaTextureBounds(
1331 textureType: DWRITE_TEXTURE_TYPE,
1332 textureBounds: *mut RECT,
1333 ) -> HRESULT,
1334 fn CreateAlphaTexture(
1335 textureType: DWRITE_TEXTURE_TYPE,
1336 textureBounds: *const RECT,
1337 alphaValues: *mut BYTE,
1338 bufferSize: UINT32,
1339 ) -> HRESULT,
1340 fn GetAlphaBlendParams(
1341 renderingParams: *mut IDWriteRenderingParams,
1342 blendGamma: *mut FLOAT,
1343 blendEnhancedContrast: *mut FLOAT,
1344 blendClearTypeLevel: *mut FLOAT,
1345 ) -> HRESULT,
1346 }}
1347 RIDL!{#[uuid(0xb859ee5a, 0xd838, 0x4b5b, 0xa2, 0xe8, 0x1a, 0xdc, 0x7d, 0x93, 0xdb, 0x48)]
1348 interface IDWriteFactory(IDWriteFactoryVtbl): IUnknown(IUnknownVtbl) {
1349 fn GetSystemFontCollection(
1350 fontCollection: *mut *mut IDWriteFontCollection,
1351 checkForUpdates: BOOL,
1352 ) -> HRESULT,
1353 fn CreateCustomFontCollection(
1354 collectionLoader: *mut IDWriteFontCollectionLoader,
1355 collectionKey: *const c_void,
1356 collectionKeySize: UINT32,
1357 fontCollection: *mut *mut IDWriteFontCollection,
1358 ) -> HRESULT,
1359 fn RegisterFontCollectionLoader(
1360 fontCollectionLoader: *mut IDWriteFontCollectionLoader,
1361 ) -> HRESULT,
1362 fn UnregisterFontCollectionLoader(
1363 fontCollectionLoader: *mut IDWriteFontCollectionLoader,
1364 ) -> HRESULT,
1365 fn CreateFontFileReference(
1366 filePath: *const WCHAR,
1367 lastWriteTime: *const FILETIME,
1368 fontFile: *mut *mut IDWriteFontFile,
1369 ) -> HRESULT,
1370 fn CreateCustomFontFileReference(
1371 fontFileReferenceKey: *const c_void,
1372 fontFileReferenceKeySize: UINT32,
1373 fontFileLoader: *mut IDWriteFontFileLoader,
1374 fontFile: *mut *mut IDWriteFontFile,
1375 ) -> HRESULT,
1376 fn CreateFontFace(
1377 fontFaceType: DWRITE_FONT_FACE_TYPE,
1378 numberOfFiles: UINT32,
1379 fontFiles: *const *mut IDWriteFontFile,
1380 faceIndex: UINT32,
1381 fontFaceSimulationFlags: DWRITE_FONT_SIMULATIONS,
1382 fontFace: *mut *mut IDWriteFontFace,
1383 ) -> HRESULT,
1384 fn CreateRenderingParams(
1385 renderingParams: *mut *mut IDWriteRenderingParams,
1386 ) -> HRESULT,
1387 fn CreateMonitorRenderingParams(
1388 monitor: HMONITOR,
1389 renderingParams: *mut *mut IDWriteRenderingParams,
1390 ) -> HRESULT,
1391 fn CreateCustomRenderingParams(
1392 gamma: FLOAT,
1393 enhancedContrast: FLOAT,
1394 clearTypeLevel: FLOAT,
1395 pixelGeometry: DWRITE_PIXEL_GEOMETRY,
1396 renderingMode: DWRITE_RENDERING_MODE,
1397 renderingParams: *mut *mut IDWriteRenderingParams,
1398 ) -> HRESULT,
1399 fn RegisterFontFileLoader(
1400 fontFileLoader: *mut IDWriteFontFileLoader,
1401 ) -> HRESULT,
1402 fn UnregisterFontFileLoader(
1403 fontFileLoader: *mut IDWriteFontFileLoader,
1404 ) -> HRESULT,
1405 fn CreateTextFormat(
1406 fontFamilyName: *const WCHAR,
1407 fontCollection: *mut IDWriteFontCollection,
1408 fontWeight: DWRITE_FONT_WEIGHT,
1409 fontStyle: DWRITE_FONT_STYLE,
1410 fontStretch: DWRITE_FONT_STRETCH,
1411 fontSize: FLOAT,
1412 localeName: *const WCHAR,
1413 textFormat: *mut *mut IDWriteTextFormat,
1414 ) -> HRESULT,
1415 fn CreateTypography(
1416 typography: *mut *mut IDWriteTypography,
1417 ) -> HRESULT,
1418 fn GetGdiInterop(
1419 gdiInterop: *mut *mut IDWriteGdiInterop,
1420 ) -> HRESULT,
1421 fn CreateTextLayout(
1422 string: *const WCHAR,
1423 stringLength: UINT32,
1424 textFormat: *mut IDWriteTextFormat,
1425 maxWidth: FLOAT,
1426 maxHeight: FLOAT,
1427 textLayout: *mut *mut IDWriteTextLayout,
1428 ) -> HRESULT,
1429 fn CreateGdiCompatibleTextLayout(
1430 string: *const WCHAR,
1431 stringLength: UINT32,
1432 textFormat: *mut IDWriteTextFormat,
1433 layoutWidth: FLOAT,
1434 layoutHeight: FLOAT,
1435 pixelsPerDip: FLOAT,
1436 transform: *const DWRITE_MATRIX,
1437 useGdiNatrual: BOOL,
1438 textLayout: *mut *mut IDWriteTextLayout,
1439 ) -> HRESULT,
1440 fn CreateEllipsisTrimmingSign(
1441 textFormat: *mut IDWriteTextFormat,
1442 trimmingSign: *mut *mut IDWriteInlineObject,
1443 ) -> HRESULT,
1444 fn CreateTextAnalyzer(
1445 textAnalyzer: *mut *mut IDWriteTextAnalyzer,
1446 ) -> HRESULT,
1447 fn CreateNumberSubstitution(
1448 substitutionMethod: DWRITE_NUMBER_SUBSTITUTION_METHOD,
1449 localeName: *const WCHAR,
1450 ignoreUserOverride: BOOL,
1451 numberSubstitution: *mut *mut IDWriteNumberSubstitution,
1452 ) -> HRESULT,
1453 fn CreateGlyphRunAnalysis(
1454 glyphRun: *const DWRITE_GLYPH_RUN,
1455 pixelsPerDip: FLOAT,
1456 transform: *const DWRITE_MATRIX,
1457 renderingMode: DWRITE_RENDERING_MODE,
1458 measuringMode: DWRITE_MEASURING_MODE,
1459 baselineOriginX: FLOAT,
1460 baselineOriginY: FLOAT,
1461 glyphRunAnalysis: *mut *mut IDWriteGlyphRunAnalysis,
1462 ) -> HRESULT,
1463 }}
1464 pub const FACILITY_DWRITE: HRESULT = 0x898;
1465 pub const DWRITE_ERR_BASE: HRESULT = 0x5000;
1466 #[inline]
MAKE_DWRITE_HR(severity: HRESULT, code: HRESULT) -> HRESULT1467 pub fn MAKE_DWRITE_HR(severity: HRESULT, code: HRESULT) -> HRESULT {
1468 MAKE_HRESULT!(severity, FACILITY_DWRITE, DWRITE_ERR_BASE + code)
1469 }
1470 #[inline]
MAKE_DWRITE_HR_ERR(code: HRESULT) -> HRESULT1471 pub fn MAKE_DWRITE_HR_ERR(code: HRESULT) -> HRESULT {
1472 MAKE_DWRITE_HR(SEVERITY_ERROR, code)
1473 }
1474 extern "system" {
DWriteCreateFactory( factoryType: DWRITE_FACTORY_TYPE, iid: REFIID, factory: *mut *mut IUnknown, ) -> HRESULT1475 pub fn DWriteCreateFactory(
1476 factoryType: DWRITE_FACTORY_TYPE, iid: REFIID, factory: *mut *mut IUnknown,
1477 ) -> HRESULT;
1478 }
1479