1 // Copyright © 2015, Connor Hilarides
2 // Licensed under the MIT License <LICENSE.md>
3 //! DirectX Typography Services public API definitions.
4 ENUM!{enum DWRITE_FONT_FILE_TYPE {
5     DWRITE_FONT_FILE_TYPE_UNKNOWN,
6     DWRITE_FONT_FILE_TYPE_CFF,
7     DWRITE_FONT_FILE_TYPE_TRUETYPE,
8     DWRITE_FONT_FILE_TYPE_TRUETYPE_COLLECTION,
9     DWRITE_FONT_FILE_TYPE_TYPE1_PFM,
10     DWRITE_FONT_FILE_TYPE_TYPE1_PFB,
11     DWRITE_FONT_FILE_TYPE_VECTOR,
12     DWRITE_FONT_FILE_TYPE_BITMAP,
13 }}
14 ENUM!{enum DWRITE_FONT_FACE_TYPE {
15     DWRITE_FONT_FACE_TYPE_CFF,
16     DWRITE_FONT_FACE_TYPE_TRUETYPE,
17     DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION,
18     DWRITE_FONT_FACE_TYPE_TYPE1,
19     DWRITE_FONT_FACE_TYPE_VECTOR,
20     DWRITE_FONT_FACE_TYPE_BITMAP,
21     DWRITE_FONT_FACE_TYPE_UNKNOWN,
22     DWRITE_FONT_FACE_TYPE_RAW_CFF,
23 }}
24 FLAGS!{enum DWRITE_FONT_SIMULATIONS {
25     DWRITE_FONT_SIMULATIONS_NONE = 0x0000,
26     DWRITE_FONT_SIMULATIONS_BOLD = 0x0001,
27     DWRITE_FONT_SIMULATIONS_OBLIQUE = 0x0002,
28 }}
29 ENUM!{enum DWRITE_FONT_WEIGHT {
30     DWRITE_FONT_WEIGHT_THIN = 100,
31     DWRITE_FONT_WEIGHT_EXTRA_LIGHT = 200,
32     DWRITE_FONT_WEIGHT_ULTRA_LIGHT = 200,
33     DWRITE_FONT_WEIGHT_LIGHT = 300,
34     DWRITE_FONT_WEIGHT_SEMI_LIGHT = 350,
35     DWRITE_FONT_WEIGHT_NORMAL = 400,
36     DWRITE_FONT_WEIGHT_REGULAR = 400,
37     DWRITE_FONT_WEIGHT_MEDIUM = 500,
38     DWRITE_FONT_WEIGHT_DEMI_BOLD = 600,
39     DWRITE_FONT_WEIGHT_SEMI_BOLD = 600,
40     DWRITE_FONT_WEIGHT_BOLD = 700,
41     DWRITE_FONT_WEIGHT_EXTRA_BOLD = 800,
42     DWRITE_FONT_WEIGHT_ULTRA_BOLD = 800,
43     DWRITE_FONT_WEIGHT_BLACK = 900,
44     DWRITE_FONT_WEIGHT_HEAVY = 900,
45     DWRITE_FONT_WEIGHT_EXTRA_BLACK = 950,
46     DWRITE_FONT_WEIGHT_ULTRA_BLACK = 950,
47 }}
48 ENUM!{enum DWRITE_FONT_STRETCH {
49     DWRITE_FONT_STRETCH_UNDEFINED = 0,
50     DWRITE_FONT_STRETCH_ULTRA_CONDENSED = 1,
51     DWRITE_FONT_STRETCH_EXTRA_CONDENSED = 2,
52     DWRITE_FONT_STRETCH_CONDENSED = 3,
53     DWRITE_FONT_STRETCH_SEMI_CONDENSED = 4,
54     DWRITE_FONT_STRETCH_NORMAL = 5,
55     DWRITE_FONT_STRETCH_MEDIUM = 5,
56     DWRITE_FONT_STRETCH_SEMI_EXPANDED = 6,
57     DWRITE_FONT_STRETCH_EXPANDED = 7,
58     DWRITE_FONT_STRETCH_EXTRA_EXPANDED = 8,
59     DWRITE_FONT_STRETCH_ULTRA_EXPANDED = 9,
60 }}
61 ENUM!{enum DWRITE_FONT_STYLE {
62     DWRITE_FONT_STYLE_NORMAL,
63     DWRITE_FONT_STYLE_OBLIQUE,
64     DWRITE_FONT_STYLE_ITALIC,
65 }}
66 ENUM!{enum DWRITE_INFORMATIONAL_STRING_ID {
67     DWRITE_INFORMATIONAL_STRING_NONE,
68     DWRITE_INFORMATIONAL_STRING_COPYRIGHT_NOTICE,
69     DWRITE_INFORMATIONAL_STRING_VERSION_STRINGS,
70     DWRITE_INFORMATIONAL_STRING_TRADEMARK,
71     DWRITE_INFORMATIONAL_STRING_MANUFACTURER,
72     DWRITE_INFORMATIONAL_STRING_DESIGNER,
73     DWRITE_INFORMATIONAL_STRING_DESIGNER_URL,
74     DWRITE_INFORMATIONAL_STRING_DESCRIPTION,
75     DWRITE_INFORMATIONAL_STRING_FONT_VENDOR_URL,
76     DWRITE_INFORMATIONAL_STRING_LICENSE_DESCRIPTION,
77     DWRITE_INFORMATIONAL_STRING_LICENSE_INFO_URL,
78     DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES,
79     DWRITE_INFORMATIONAL_STRING_WIN32_SUBFAMILY_NAMES,
80     DWRITE_INFORMATIONAL_STRING_PREFERRED_FAMILY_NAMES,
81     DWRITE_INFORMATIONAL_STRING_PREFERRED_SUBFAMILY_NAMES,
82     DWRITE_INFORMATIONAL_STRING_SAMPLE_TEXT,
83     DWRITE_INFORMATIONAL_STRING_FULL_NAME,
84     DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_NAME,
85     DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_CID_NAME,
86     DWRITE_INFORMATIONAL_STRING_WWS_FAMILY_NAME,
87     DWRITE_INFORMATIONAL_STRING_DESIGN_SCRIPT_LANGUAGE_TAG,
88     DWRITE_INFORMATIONAL_STRING_SUPPORTED_SCRIPT_LANGUAGE_TAG,
89 }}
90 STRUCT!{struct DWRITE_FONT_METRICS {
91     designUnitsPerEm: ::UINT16,
92     ascent: ::UINT16,
93     descent: ::UINT16,
94     lineGap: ::INT16,
95     capHeight: ::UINT16,
96     xHeight: ::UINT16,
97     underlinePosition: ::INT16,
98     underlineThickness: ::UINT16,
99     strikethroughPosition: ::INT16,
100     strikethroughThickness: ::UINT16,
101 }}
102 STRUCT!{struct DWRITE_GLYPH_METRICS {
103     leftSideBearing: ::INT32,
104     advanceWidth: ::UINT32,
105     rightSideBearing: ::INT32,
106     topSideBearing: ::INT32,
107     advanceHeight: ::UINT32,
108     bottomSideBearing: ::INT32,
109     verticalOriginY: ::INT32,
110 }}
111 STRUCT!{struct DWRITE_GLYPH_OFFSET {
112     advanceOffset: ::FLOAT,
113     ascenderOffset: ::FLOAT,
114 }}
115 ENUM!{enum DWRITE_FACTORY_TYPE {
116     DWRITE_FACTORY_TYPE_SHARED,
117     DWRITE_FACTORY_TYPE_ISOLATED,
118 }}
119 #[inline]
DWRITE_MAKE_OPENTYPE_TAG(a: u8, b: u8, c: u8, d: u8) -> u32120 pub fn DWRITE_MAKE_OPENTYPE_TAG(a: u8, b: u8, c: u8, d: u8) -> u32 {
121     ((d as u32) << 24) | ((c as u32) << 16) | ((b as u32) << 8) | (a as u32)
122 }
123 RIDL!{interface IDWriteFontFileLoader(IDWriteFontFileLoaderVtbl): IUnknown(IUnknownVtbl) {
124     fn CreateStreamFromKey(
125         &mut self, fontFileReferenceKey: *const ::c_void, fontFileReferenceKeySize: ::UINT32,
126         fontFileStream: *mut *mut IDWriteFontFileStream
127     ) -> ::HRESULT
128 }}
129 RIDL!{interface IDWriteLocalFontFileLoader(IDWriteLocalFontFileLoaderVtbl):
130         IDWriteFontFileLoader(IDWriteFontFileLoaderVtbl) {
131     fn GetFilePathLengthFromKey(
132         &mut self, fontFileReferenceKey: *const ::c_void, fontFileReferenceKeySize: ::UINT32,
133         filePathLength: *mut ::UINT32
134     ) -> ::HRESULT,
135     fn GetFilePathFromKey(
136         &mut self, fontFileReferenceKey: *const ::c_void, fontFileReferenceKeySize: ::UINT32,
137         filePath: *mut ::WCHAR,
138         filePathSize: ::UINT32
139     ) -> ::HRESULT,
140     fn GetLastWriteTimeFromKey(
141         &mut self, fontFileReferenceKey: *const ::c_void, fontFileReferenceKeySize: ::UINT32,
142         lastWriteTime: *mut ::FILETIME
143     ) -> ::HRESULT
144 }}
145 RIDL!{interface IDWriteFontFileStream(IDWriteFontFileStreamVtbl): IUnknown(IUnknownVtbl) {
146     fn ReadFileFragment(
147         &mut self, fragmentStart: *mut *const ::c_void, fileOffset: ::UINT64,
148         fragmentSize: ::UINT64, fragmentContext: *mut *mut ::c_void
149     ) -> ::HRESULT,
150     fn ReleaseFileFragment(&mut self, fragmentContext: *mut ::c_void) -> (),
151     fn GetFileSize(&mut self, fileSize: *mut ::UINT64) -> ::HRESULT,
152     fn GetLastWriteTime(&mut self, lastWriteTime: *mut ::UINT64) -> ::HRESULT
153 }}
154 RIDL!{interface IDWriteFontFile(IDWriteFontFileVtbl): IUnknown(IUnknownVtbl) {
155     fn GetReferenceKey(
156         &mut self, fontFileReferenceKey: *mut *const ::c_void,
157         fontFileReferenceKeySize: *mut ::UINT32
158     ) -> ::HRESULT,
159     fn GetLoader(&mut self, fontFileLoader: *mut *mut IDWriteFontFileLoader) -> ::HRESULT,
160     fn Analyze(
161         &mut self, isSupportedFontType: *mut ::BOOL, fontFileType: *mut DWRITE_FONT_FILE_TYPE,
162         fontFaceType: *mut DWRITE_FONT_FACE_TYPE, numberOfFaces: *mut ::UINT32
163     ) -> ::HRESULT
164 }}
165 ENUM!{enum DWRITE_PIXEL_GEOMETRY {
166     DWRITE_PIXEL_GEOMETRY_FLAT,
167     DWRITE_PIXEL_GEOMETRY_RGB,
168     DWRITE_PIXEL_GEOMETRY_BGR,
169 }}
170 ENUM!{enum DWRITE_RENDERING_MODE {
171     DWRITE_RENDERING_MODE_DEFAULT,
172     DWRITE_RENDERING_MODE_ALIASED,
173     DWRITE_RENDERING_MODE_GDI_CLASSIC,
174     DWRITE_RENDERING_MODE_GDI_NATURAL,
175     DWRITE_RENDERING_MODE_NATURAL,
176     DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC,
177     DWRITE_RENDERING_MODE_OUTLINE,
178     DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC = DWRITE_RENDERING_MODE_GDI_CLASSIC.0,
179     DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL = DWRITE_RENDERING_MODE_GDI_NATURAL.0,
180     DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL = DWRITE_RENDERING_MODE_NATURAL.0,
181     DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC = DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC.0,
182 }}
183 STRUCT!{struct DWRITE_MATRIX {
184     m11: ::FLOAT,
185     m12: ::FLOAT,
186     m21: ::FLOAT,
187     m22: ::FLOAT,
188     dx: ::FLOAT,
189     dy: ::FLOAT,
190 }}
191 RIDL!{interface IDWriteRenderingParams(IDWriteRenderingParamsVtbl): IUnknown(IUnknownVtbl) {
192     fn GetGamma(&mut self) -> ::FLOAT,
193     fn GetEnhancedContrast(&mut self) -> ::FLOAT,
194     fn GetClearTypeLevel(&mut self) -> ::FLOAT,
195     fn GetPixelGeometry(&mut self) -> DWRITE_PIXEL_GEOMETRY,
196     fn GetRenderingMode(&mut self) -> DWRITE_RENDERING_MODE
197 }}
198 pub type IDWriteGeometrySink = ::ID2D1SimplifiedGeometrySink;
199 RIDL!{interface IDWriteFontFace(IDWriteFontFaceVtbl): IUnknown(IUnknownVtbl) {
200     fn GetType(&mut self) -> DWRITE_FONT_FACE_TYPE,
201     fn GetFiles(
202         &mut self, numberOfFiles: *mut ::UINT32, fontFiles: *mut *mut IDWriteFontFile
203     ) -> ::HRESULT,
204     fn GetIndex(&mut self) -> ::UINT32,
205     fn GetSimulations(&mut self) -> DWRITE_FONT_SIMULATIONS,
206     fn IsSymbolFont(&mut self) -> ::BOOL,
207     fn GetMetrics(&mut self, fontFaceMetrics: *mut DWRITE_FONT_METRICS) -> (),
208     fn GetGlyphCount(&mut self) -> ::UINT16,
209     fn GetDesignGlyphMetrics(
210         &mut self, glyphIndices: *const ::UINT16, glyphCount: ::UINT32,
211         glyphMetrics: *mut DWRITE_GLYPH_METRICS, isSideways: ::BOOL
212     ) -> ::HRESULT,
213     fn GetGlyphIndices(
214         &mut self, codePoints: *const ::UINT32, codePointCount: ::UINT32,
215         glyphIndices: *mut ::UINT16
216     ) -> ::HRESULT,
217     fn TryGetFontTable(
218         &mut self, openTypeTableTag: ::UINT32, tableData: *mut *const ::c_void,
219         tableSize: *mut ::UINT32, tableContext: *mut *mut ::c_void, exists: *mut ::BOOL
220     ) -> ::HRESULT,
221     fn ReleaseFontTable(
222         &mut self, tableContext: *mut ::c_void
223     ) -> ::HRESULT,
224     fn GetGlyphRunOutline(
225         &mut self, emSize: ::FLOAT, glyphIndices: *const ::UINT16, glyphAdvances: *const ::FLOAT,
226         glyphOffsets: *const DWRITE_GLYPH_OFFSET, glyphCount: ::UINT32, isSideways: ::BOOL,
227         isRightToLeft: ::BOOL, geometrySink: *mut IDWriteGeometrySink
228     ) -> ::HRESULT,
229     fn GetRecommendedRenderingMode(
230         &mut self, emSize: ::FLOAT, pixelsPerDip: ::FLOAT, measuringMode: ::DWRITE_MEASURING_MODE,
231         renderingParams: *mut IDWriteRenderingParams, renderingMode: *mut DWRITE_RENDERING_MODE
232     ) -> ::HRESULT,
233     fn GetGdiCompatibleMetrics(
234         &mut self, emSize: ::FLOAT, pixelsPerDip: ::FLOAT, transform: *const DWRITE_MATRIX,
235         fontFaceMetrics: *mut DWRITE_FONT_METRICS
236     ) -> ::HRESULT,
237     fn GetGdiCompatibleGlyphMetrics(
238         &mut self, enSize: ::FLOAT, pixelsPerDip: ::FLOAT, transform: *const DWRITE_MATRIX,
239         useGdiNatrual: ::BOOL, glyphIndices: *const ::UINT16, glyphCount: ::UINT32,
240         glyphMetrics: *mut DWRITE_GLYPH_METRICS, isSideways: ::BOOL
241     ) -> ::HRESULT
242 }}
243 RIDL!{interface IDWriteFontCollectionLoader(IDWriteFontCollectionLoaderVtbl):
244         IUnknown(IUnknownVtbl) {
245     fn CreateEnumeratorFromKey(
246         &mut self, factory: *mut IDWriteFactory, collectionKey: *const ::c_void,
247         collectionKeySize: ::UINT32, fontFileEnumerator: *mut *mut IDWriteFontFileEnumerator
248     ) -> ::HRESULT
249 }}
250 RIDL!{interface IDWriteFontFileEnumerator(IDWriteFontFileEnumeratorVtbl): IUnknown(IUnknownVtbl) {
251     fn MoveNext(&mut self, hasCurrentFile: *mut ::BOOL) -> ::HRESULT,
252     fn GetCurrentFontFile(&mut self, fontFile: *mut *mut IDWriteFontFile) -> ::HRESULT
253 }}
254 RIDL!{interface IDWriteLocalizedStrings(IDWriteLocalizedStringsVtbl): IUnknown(IUnknownVtbl) {
255     fn GetCount(&mut self) -> ::UINT32,
256     fn FindLocaleName(
257         &mut self, localeName: *const ::WCHAR, index: *mut ::UINT32, exists: *mut ::BOOL
258     ) -> ::HRESULT,
259     fn GetLocaleNameLength(&mut self, index: ::UINT32, length: *mut ::UINT32) -> ::HRESULT,
260     fn GetLocaleName(
261         &mut self, index: ::UINT32, localeName: *mut ::WCHAR, size: ::UINT32
262     ) -> ::HRESULT,
263     fn GetStringLength(&mut self, index: ::UINT32, length: *mut ::UINT32) -> ::HRESULT,
264     fn GetString(
265         &mut self, index: ::UINT32, stringBuffer: *mut ::WCHAR, size: ::UINT32
266     ) -> ::HRESULT
267 }}
268 RIDL!{interface IDWriteFontCollection(IDWriteFontCollectionVtbl): IUnknown(IUnknownVtbl) {
269     fn GetFontFamilyCount(&mut self) -> ::UINT32,
270     fn GetFontFamily(
271         &mut self, index: ::UINT32, fontFamily: *mut *mut IDWriteFontFamily
272     ) -> ::HRESULT,
273     fn FindFamilyName(
274         &mut self, familyName: *const ::WCHAR, index: *mut ::UINT32, exists: *mut ::BOOL
275     ) -> ::HRESULT,
276     fn GetFontFromFontFace(
277         &mut self, fontFace: *mut IDWriteFontFace, font: *mut *mut IDWriteFont
278     ) -> ::HRESULT
279 }}
280 RIDL!{interface IDWriteFontList(IDWriteFontListVtbl): IUnknown(IUnknownVtbl) {
281     fn GetFontCollection(&mut self, fontCollection: *mut *mut IDWriteFontCollection) -> ::HRESULT,
282     fn GetFontCount(&mut self) -> ::UINT32,
283     fn GetFont(&mut self, index: ::UINT32, font: *mut *mut IDWriteFont) -> ::HRESULT
284 }}
285 RIDL!{interface IDWriteFontFamily(IDWriteFontFamilyVtbl): IDWriteFontList(IDWriteFontListVtbl) {
286     fn GetFamilyNames(&mut self, names: *mut *mut IDWriteLocalizedStrings) -> ::HRESULT,
287     fn GetFirstMatchingFont(
288         &mut self, weight: DWRITE_FONT_WEIGHT, stretch: DWRITE_FONT_STRETCH,
289         style: DWRITE_FONT_STYLE, matchingFont: *mut *mut IDWriteFont
290     ) -> ::HRESULT,
291     fn GetMatchingFonts(
292         &mut self, weight: DWRITE_FONT_WEIGHT, stretch: DWRITE_FONT_STRETCH,
293         style: DWRITE_FONT_STYLE, matchingFonts: *mut *mut IDWriteFontList
294     ) -> ::HRESULT
295 }}
296 RIDL!{interface IDWriteFont(IDWriteFontVtbl): IUnknown(IUnknownVtbl) {
297     fn GetFontFamily(&mut self, fontFamily: *mut *mut IDWriteFontFamily) -> ::HRESULT,
298     fn GetWeight(&mut self) -> DWRITE_FONT_WEIGHT,
299     fn GetStretch(&mut self) -> DWRITE_FONT_STRETCH,
300     fn GetStyle(&mut self) -> DWRITE_FONT_STYLE,
301     fn IsSymbolFont(&mut self) -> ::BOOL,
302     fn GetFaceNames(&mut self, names: *mut *mut IDWriteLocalizedStrings) -> ::HRESULT,
303     fn GetInformationalStrings(
304         &mut self, informationalStringId: DWRITE_INFORMATIONAL_STRING_ID,
305         informationalStrings: *mut *mut IDWriteLocalizedStrings, exists: *mut ::BOOL
306     ) -> ::HRESULT,
307     fn GetSimulations(&mut self) -> DWRITE_FONT_SIMULATIONS,
308     fn GetMetrics(&mut self, fontMetrics: *mut DWRITE_FONT_METRICS) -> (),
309     fn HasCharacter(&mut self, unicodeValue: ::UINT32, exists: *mut ::BOOL) -> ::HRESULT,
310     fn CreateFontFace(&mut self, fontFace: *mut *mut IDWriteFontFace) -> ::HRESULT
311 }}
312 ENUM!{enum DWRITE_READING_DIRECTION {
313     DWRITE_READING_DIRECTION_LEFT_TO_RIGHT = 0,
314     DWRITE_READING_DIRECTION_RIGHT_TO_LEFT = 1,
315     DWRITE_READING_DIRECTION_TOP_TO_BOTTOM = 2,
316     DWRITE_READING_DIRECTION_BOTTOM_TO_TOP = 3,
317 }}
318 ENUM!{enum DWRITE_FLOW_DIRECTION {
319     DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM = 0,
320     DWRITE_FLOW_DIRECTION_BOTTOM_TO_TOP = 1,
321     DWRITE_FLOW_DIRECTION_LEFT_TO_RIGHT = 2,
322     DWRITE_FLOW_DIRECTION_RIGHT_TO_LEFT = 3,
323 }}
324 ENUM!{enum DWRITE_TEXT_ALIGNMENT {
325     DWRITE_TEXT_ALIGNMENT_LEADING,
326     DWRITE_TEXT_ALIGNMENT_TRAILING,
327     DWRITE_TEXT_ALIGNMENT_CENTER,
328     DWRITE_TEXT_ALIGNMENT_JUSTIFIED,
329 }}
330 ENUM!{enum DWRITE_PARAGRAPH_ALIGNMENT {
331     DWRITE_PARAGRAPH_ALIGNMENT_NEAR,
332     DWRITE_PARAGRAPH_ALIGNMENT_FAR,
333     DWRITE_PARAGRAPH_ALIGNMENT_CENTER,
334 }}
335 ENUM!{enum DWRITE_WORD_WRAPPING {
336     DWRITE_WORD_WRAPPING_WRAP = 0,
337     DWRITE_WORD_WRAPPING_NO_WRAP = 1,
338     DWRITE_WORD_WRAPPING_EMERGENCY_BREAK = 2,
339     DWRITE_WORD_WRAPPING_WHOLE_WORD = 3,
340     DWRITE_WORD_WRAPPING_CHARACTER = 4,
341 }}
342 ENUM!{enum DWRITE_LINE_SPACING_METHOD {
343     DWRITE_LINE_SPACING_METHOD_DEFAULT,
344     DWRITE_LINE_SPACING_METHOD_UNIFORM,
345     DWRITE_LINE_SPACING_METHOD_PROPORTIONAL,
346 }}
347 ENUM!{enum DWRITE_TRIMMING_GRANULARITY {
348     DWRITE_TRIMMING_GRANULARITY_NONE,
349     DWRITE_TRIMMING_GRANULARITY_CHARACTER,
350     DWRITE_TRIMMING_GRANULARITY_WORD,
351 }}
352 ENUM!{enum DWRITE_FONT_FEATURE_TAG {
353     DWRITE_FONT_FEATURE_TAG_ALTERNATIVE_FRACTIONS = 0x63726661, // 'afrc'
354     DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS_FROM_CAPITALS = 0x63703263, // 'c2pc'
355     DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS_FROM_CAPITALS = 0x63733263, // 'c2sc'
356     DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_ALTERNATES = 0x746c6163, // 'calt'
357     DWRITE_FONT_FEATURE_TAG_CASE_SENSITIVE_FORMS = 0x65736163, // 'case'
358     DWRITE_FONT_FEATURE_TAG_GLYPH_COMPOSITION_DECOMPOSITION = 0x706d6363, // 'ccmp'
359     DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_LIGATURES = 0x67696c63, // 'clig'
360     DWRITE_FONT_FEATURE_TAG_CAPITAL_SPACING = 0x70737063, // 'cpsp'
361     DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_SWASH = 0x68777363, // 'cswh'
362     DWRITE_FONT_FEATURE_TAG_CURSIVE_POSITIONING = 0x73727563, // 'curs'
363     DWRITE_FONT_FEATURE_TAG_DEFAULT = 0x746c6664, // 'dflt'
364     DWRITE_FONT_FEATURE_TAG_DISCRETIONARY_LIGATURES = 0x67696c64, // 'dlig'
365     DWRITE_FONT_FEATURE_TAG_EXPERT_FORMS = 0x74707865, // 'expt'
366     DWRITE_FONT_FEATURE_TAG_FRACTIONS = 0x63617266, // 'frac'
367     DWRITE_FONT_FEATURE_TAG_FULL_WIDTH = 0x64697766, // 'fwid'
368     DWRITE_FONT_FEATURE_TAG_HALF_FORMS = 0x666c6168, // 'half'
369     DWRITE_FONT_FEATURE_TAG_HALANT_FORMS = 0x6e6c6168, // 'haln'
370     DWRITE_FONT_FEATURE_TAG_ALTERNATE_HALF_WIDTH = 0x746c6168, // 'halt'
371     DWRITE_FONT_FEATURE_TAG_HISTORICAL_FORMS = 0x74736968, // 'hist'
372     DWRITE_FONT_FEATURE_TAG_HORIZONTAL_KANA_ALTERNATES = 0x616e6b68, // 'hkna'
373     DWRITE_FONT_FEATURE_TAG_HISTORICAL_LIGATURES = 0x67696c68, // 'hlig'
374     DWRITE_FONT_FEATURE_TAG_HALF_WIDTH = 0x64697768, // 'hwid'
375     DWRITE_FONT_FEATURE_TAG_HOJO_KANJI_FORMS = 0x6f6a6f68, // 'hojo'
376     DWRITE_FONT_FEATURE_TAG_JIS04_FORMS = 0x3430706a, // 'jp04'
377     DWRITE_FONT_FEATURE_TAG_JIS78_FORMS = 0x3837706a, // 'jp78'
378     DWRITE_FONT_FEATURE_TAG_JIS83_FORMS = 0x3338706a, // 'jp83'
379     DWRITE_FONT_FEATURE_TAG_JIS90_FORMS = 0x3039706a, // 'jp90'
380     DWRITE_FONT_FEATURE_TAG_KERNING = 0x6e72656b, // 'kern'
381     DWRITE_FONT_FEATURE_TAG_STANDARD_LIGATURES = 0x6167696c, // 'liga'
382     DWRITE_FONT_FEATURE_TAG_LINING_FIGURES = 0x6d756e6c, // 'lnum'
383     DWRITE_FONT_FEATURE_TAG_LOCALIZED_FORMS = 0x6c636f6c, // 'locl'
384     DWRITE_FONT_FEATURE_TAG_MARK_POSITIONING = 0x6b72616d, // 'mark'
385     DWRITE_FONT_FEATURE_TAG_MATHEMATICAL_GREEK = 0x6b72676d, // 'mgrk'
386     DWRITE_FONT_FEATURE_TAG_MARK_TO_MARK_POSITIONING = 0x6b6d6b6d, // 'mkmk'
387     DWRITE_FONT_FEATURE_TAG_ALTERNATE_ANNOTATION_FORMS = 0x746c616e, // 'nalt'
388     DWRITE_FONT_FEATURE_TAG_NLC_KANJI_FORMS = 0x6b636c6e, // 'nlck'
389     DWRITE_FONT_FEATURE_TAG_OLD_STYLE_FIGURES = 0x6d756e6f, // 'onum'
390     DWRITE_FONT_FEATURE_TAG_ORDINALS = 0x6e64726f, // 'ordn'
391     DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_ALTERNATE_WIDTH = 0x746c6170, // 'palt'
392     DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS = 0x70616370, // 'pcap'
393     DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_FIGURES = 0x6d756e70, // 'pnum'
394     DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_WIDTHS = 0x64697770, // 'pwid'
395     DWRITE_FONT_FEATURE_TAG_QUARTER_WIDTHS = 0x64697771, // 'qwid'
396     DWRITE_FONT_FEATURE_TAG_REQUIRED_LIGATURES = 0x67696c72, // 'rlig'
397     DWRITE_FONT_FEATURE_TAG_RUBY_NOTATION_FORMS = 0x79627572, // 'ruby'
398     DWRITE_FONT_FEATURE_TAG_STYLISTIC_ALTERNATES = 0x746c6173, // 'salt'
399     DWRITE_FONT_FEATURE_TAG_SCIENTIFIC_INFERIORS = 0x666e6973, // 'sinf'
400     DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS = 0x70636d73, // 'smcp'
401     DWRITE_FONT_FEATURE_TAG_SIMPLIFIED_FORMS = 0x6c706d73, // 'smpl'
402     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1 = 0x31307373, // 'ss01'
403     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_2 = 0x32307373, // 'ss02'
404     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_3 = 0x33307373, // 'ss03'
405     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_4 = 0x34307373, // 'ss04'
406     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_5 = 0x35307373, // 'ss05'
407     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_6 = 0x36307373, // 'ss06'
408     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_7 = 0x37307373, // 'ss07'
409     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_8 = 0x38307373, // 'ss08'
410     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_9 = 0x39307373, // 'ss09'
411     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_10 = 0x30317373, // 'ss10'
412     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_11 = 0x31317373, // 'ss11'
413     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_12 = 0x32317373, // 'ss12'
414     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_13 = 0x33317373, // 'ss13'
415     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_14 = 0x34317373, // 'ss14'
416     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_15 = 0x35317373, // 'ss15'
417     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_16 = 0x36317373, // 'ss16'
418     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_17 = 0x37317373, // 'ss17'
419     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_18 = 0x38317373, // 'ss18'
420     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_19 = 0x39317373, // 'ss19'
421     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_20 = 0x30327373, // 'ss20'
422     DWRITE_FONT_FEATURE_TAG_SUBSCRIPT = 0x73627573, // 'subs'
423     DWRITE_FONT_FEATURE_TAG_SUPERSCRIPT = 0x73707573, // 'sups'
424     DWRITE_FONT_FEATURE_TAG_SWASH = 0x68737773, // 'swsh'
425     DWRITE_FONT_FEATURE_TAG_TITLING = 0x6c746974, // 'titl'
426     DWRITE_FONT_FEATURE_TAG_TRADITIONAL_NAME_FORMS = 0x6d616e74, // 'tnam'
427     DWRITE_FONT_FEATURE_TAG_TABULAR_FIGURES = 0x6d756e74, // 'tnum'
428     DWRITE_FONT_FEATURE_TAG_TRADITIONAL_FORMS = 0x64617274, // 'trad'
429     DWRITE_FONT_FEATURE_TAG_THIRD_WIDTHS = 0x64697774, // 'twid'
430     DWRITE_FONT_FEATURE_TAG_UNICASE = 0x63696e75, // 'unic'
431     DWRITE_FONT_FEATURE_TAG_VERTICAL_WRITING = 0x74726576, // 'vert'
432     DWRITE_FONT_FEATURE_TAG_VERTICAL_ALTERNATES_AND_ROTATION = 0x32747276, // 'vrt2'
433     DWRITE_FONT_FEATURE_TAG_SLASHED_ZERO = 0x6f72657a, // 'zero'
434 }}
435 STRUCT!{struct DWRITE_TEXT_RANGE {
436     startPosition: ::UINT32,
437     length: ::UINT32,
438 }}
439 STRUCT!{struct DWRITE_FONT_FEATURE {
440     nameTag: DWRITE_FONT_FEATURE_TAG,
441     parameter: ::UINT32,
442 }}
443 STRUCT!{struct DWRITE_TYPOGRAPHIC_FEATURES {
444     features: *mut DWRITE_FONT_FEATURE,
445     featureCount: ::UINT32,
446 }}
447 STRUCT!{struct DWRITE_TRIMMING {
448     granularity: DWRITE_TRIMMING_GRANULARITY,
449     delimiter: ::UINT32,
450     delimiterCount: ::UINT32,
451 }}
452 RIDL!{interface IDWriteTextFormat(IDWriteTextFormatVtbl): IUnknown(IUnknownVtbl) {
453     fn SetTextAlignment(&mut self, textAlignment: DWRITE_TEXT_ALIGNMENT) -> ::HRESULT,
454     fn SetParagraphAlignment(
455         &mut self, paragraphAlignment: DWRITE_PARAGRAPH_ALIGNMENT
456     ) -> ::HRESULT,
457     fn SetWordWrapping(&mut self, wordWrapping: DWRITE_WORD_WRAPPING) -> ::HRESULT,
458     fn SetReadingDirection(&mut self, readingDirection: DWRITE_READING_DIRECTION) -> ::HRESULT,
459     fn SetFlowDirection(&mut self, flowDirection: DWRITE_FLOW_DIRECTION) -> ::HRESULT,
460     fn SetIncrementalTabStop(&mut self, incrementalTabStop: ::FLOAT) -> ::HRESULT,
461     fn SetTrimming(
462         &mut self, trimmingOptions: *const DWRITE_TRIMMING, trimmingSign: *mut IDWriteInlineObject
463     ) -> ::HRESULT,
464     fn SetLineSpacing(
465         &mut self, lineSpacingMethod: DWRITE_LINE_SPACING_METHOD, lineSpacing: ::FLOAT,
466         baseLine: ::FLOAT
467     ) -> ::HRESULT,
468     fn GetTextAlignment(&mut self) -> DWRITE_TEXT_ALIGNMENT,
469     fn GetParagraphAlignment(&mut self) -> DWRITE_PARAGRAPH_ALIGNMENT,
470     fn GetWordWrapping(&mut self) -> DWRITE_WORD_WRAPPING,
471     fn GetReadingDirection(&mut self) -> DWRITE_READING_DIRECTION,
472     fn GetFlowDirection(&mut self) -> DWRITE_FLOW_DIRECTION,
473     fn GetIncrementalTabStop(&mut self) -> ::FLOAT,
474     fn GetTrimming(
475         &mut self, trimmingOptions: *mut DWRITE_TRIMMING,
476         trimmingSign: *mut *mut IDWriteInlineObject
477     ) -> ::HRESULT,
478     fn GetLineSpacing(
479         &mut self, lineSpacingMethod: *mut DWRITE_LINE_SPACING_METHOD, lineSpacing: *mut ::FLOAT,
480         baseline: *mut ::FLOAT
481     ) -> ::HRESULT,
482     fn GetFontCollection(&mut self, fontCollection: *mut *mut IDWriteFontCollection) -> ::HRESULT,
483     fn GetFontFamilyNameLength(&mut self) -> ::UINT32,
484     fn GetFontFamilyName(&mut self, fontFamilyName: *mut ::WCHAR, nameSize: ::UINT32) -> ::HRESULT,
485     fn GetFontWeight(&mut self) -> DWRITE_FONT_WEIGHT,
486     fn GetFontStyle(&mut self) -> DWRITE_FONT_STYLE,
487     fn GetFontStretch(&mut self) -> DWRITE_FONT_STRETCH,
488     fn GetFontSize(&mut self) -> ::FLOAT,
489     fn GetLocaleNameLength(&mut self) -> ::UINT32,
490     fn GetLocaleName(&mut self, localeName: *mut ::WCHAR, nameSize: ::UINT32) -> ::HRESULT
491 }}
492 RIDL!{interface IDWriteTypography(IDWriteTypographyVtbl): IUnknown(IUnknownVtbl) {
493     fn AddFontFeature(&mut self, fontFeature: DWRITE_FONT_FEATURE) -> ::HRESULT,
494     fn GetFontFeatureCount(&mut self) -> ::UINT32,
495     fn GetFontFeature(
496         &mut self, fontFeatureIndex: ::UINT32, fontFeature: *mut DWRITE_FONT_FEATURE
497     ) -> ::HRESULT
498 }}
499 FLAGS!{enum DWRITE_SCRIPT_SHAPES {
500     DWRITE_SCRIPT_SHAPES_DEFAULT = 0,
501     DWRITE_SCRIPT_SHAPES_NO_VISUAL = 1,
502 }}
503 STRUCT!{struct DWRITE_SCRIPT_ANALYSIS {
504     script: ::UINT16,
505     shapes: DWRITE_SCRIPT_SHAPES,
506 }}
507 ENUM!{enum DWRITE_BREAK_CONDITION {
508     DWRITE_BREAK_CONDITION_NEUTRAL,
509     DWRITE_BREAK_CONDITION_CAN_BREAK,
510     DWRITE_BREAK_CONDITION_MAY_NOT_BREAK,
511     DWRITE_BREAK_CONDITION_MUST_BREAK,
512 }}
513 STRUCT!{struct DWRITE_LINE_BREAKPOINT {
514     bit_fields: ::UINT8,
515 }}
516 BITFIELD!{DWRITE_LINE_BREAKPOINT bit_fields: ::UINT8 [
517     breakConditionBefore set_breakConditionBefore[0..2],
518     breakConditionAfter set_breakConditionAfter[2..4],
519     isWhitespace set_isWhitespace[4..5],
520     isSoftHyphen set_isSoftHyphen[5..6],
521     padding set_padding[6..8],
522 ]}
523 ENUM!{enum DWRITE_NUMBER_SUBSTITUTION_METHOD {
524     DWRITE_NUMBER_SUBSTITUTION_METHOD_FROM_CULTURE,
525     DWRITE_NUMBER_SUBSTITUTION_METHOD_CONTEXTUAL,
526     DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE,
527     DWRITE_NUMBER_SUBSTITUTION_METHOD_NATIONAL,
528     DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL,
529 }}
530 RIDL!{interface IDWriteNumberSubstitution(IDWriteNumberSubstitutionVtbl): IUnknown(IUnknownVtbl) {
531 }}
532 STRUCT!{struct DWRITE_SHAPING_TEXT_PROPERTIES {
533     bit_fields: ::UINT16,
534 }}
535 BITFIELD!{DWRITE_SHAPING_TEXT_PROPERTIES bit_fields: ::UINT16 [
536     isShapedAlone set_isShapedAlone[0..1],
537     reserved set_reserved[1..16],
538 ]}
539 STRUCT!{struct DWRITE_SHAPING_GLYPH_PROPERTIES {
540     bit_fields: ::UINT16,
541 }}
542 BITFIELD!{DWRITE_SHAPING_GLYPH_PROPERTIES bit_fields: ::UINT16 [
543     justification set_justification[0..4],
544     isClusterStart set_isClusterStart[4..5],
545     isDiacritic set_isDiacritic[5..6],
546     isZeroWidthSpace set_isZeroWidthSpace[6..7],
547     reserved set_reserved[7..16],
548 ]}
549 RIDL!{interface IDWriteTextAnalysisSource(IDWriteTextAnalysisSourceVtbl): IUnknown(IUnknownVtbl) {
550     fn GetTextAtPosition(
551         &mut self, textPosition: ::UINT32, textString: *mut *const ::WCHAR,
552         textLength: *mut ::UINT32
553     ) -> ::HRESULT,
554     fn GetTextBeforePosition(
555         &mut self, textPosition: ::UINT32, textString: *mut *const ::WCHAR,
556         textLength: *mut ::UINT32
557     ) -> ::HRESULT,
558     fn GetParagraphReadingDirection(&mut self) -> DWRITE_READING_DIRECTION,
559     fn GetLocaleName(
560         &mut self, textPosition: ::UINT32, textLength: *mut ::UINT32,
561         localeName: *mut *const ::WCHAR
562     ) -> ::HRESULT,
563     fn GetNumberSubstitution(
564         &mut self, textPosition: ::UINT32, textLength: *mut ::UINT32,
565         numberSubstitution: *mut *mut IDWriteNumberSubstitution
566     ) -> ::HRESULT
567 }}
568 RIDL!{interface IDWriteTextAnalysisSink(IDWriteTextAnalysisSinkVtbl): IUnknown(IUnknownVtbl) {
569     fn SetScriptAnalysis(
570         &mut self, textPosition: ::UINT32, textLength: ::UINT32,
571         scriptAnalysis: *const DWRITE_SCRIPT_ANALYSIS
572     ) -> ::HRESULT,
573     fn SetLineBreakpoints(
574         &mut self, textPosition: ::UINT32, textLength: ::UINT32,
575         lineBreakpoints: *const DWRITE_LINE_BREAKPOINT
576     ) -> ::HRESULT,
577     fn SetBidiLevel(
578         &mut self, textPosition: ::UINT32, textLength: ::UINT32, explicitLevel: ::UINT8,
579         resolvedLevel: ::UINT8
580     ) -> ::HRESULT,
581     fn SetNumberSubstitution(
582         &mut self, textPosition: ::UINT32, textLength: ::UINT32,
583         numberSubstitution: *mut IDWriteNumberSubstitution
584     ) -> ::HRESULT
585 }}
586 RIDL!{interface IDWriteTextAnalyzer(IDWriteTextAnalyzerVtbl): IUnknown(IUnknownVtbl) {
587     fn AnalyzeScript(
588         &mut self, analysisSource: *mut IDWriteTextAnalysisSource, textPosition: ::UINT32,
589         textLength: ::UINT32, analysisSink: *mut IDWriteTextAnalysisSink
590     ) -> ::HRESULT,
591     fn AnalyzeBidi(
592         &mut self, analysisSource: *mut IDWriteTextAnalysisSource, textPosition: ::UINT32,
593         textLength: ::UINT32, analysisSink: *mut IDWriteTextAnalysisSink
594     ) -> ::HRESULT,
595     fn AnalyzeNumberSubstitution(
596         &mut self, analysisSource: *mut IDWriteTextAnalysisSource, textPosition: ::UINT32,
597         textLength: ::UINT32, analysisSink: *mut IDWriteTextAnalysisSink
598     ) -> ::HRESULT,
599     fn AnalyzeLineBreakpoints(
600         &mut self, analysisSource: *mut IDWriteTextAnalysisSource, textPosition: ::UINT32,
601         textLength: ::UINT32, analysisSink: *mut IDWriteTextAnalysisSink
602     ) -> ::HRESULT,
603     fn GetGlyphs(
604         &mut self, textString: *const ::WCHAR, textLength: ::UINT32,
605         fontFace: *mut IDWriteFontFace, isSideways: ::BOOL, isRightToLeft: ::BOOL,
606         scriptAnalysis: *const DWRITE_SCRIPT_ANALYSIS, localeName: *const ::WCHAR,
607         numberSubstitution: *mut IDWriteNumberSubstitution,
608         features: *mut *const DWRITE_TYPOGRAPHIC_FEATURES, featureRangeLengths: *const ::UINT32,
609         featureRanges: ::UINT32, maxGlyphCount: ::UINT32, clusterMap: *mut ::UINT16,
610         textProps: *mut DWRITE_SHAPING_TEXT_PROPERTIES, glyphIndices: *mut ::UINT16,
611         glyphProps: *mut DWRITE_SHAPING_GLYPH_PROPERTIES, actualGlyphCount: *mut ::UINT32
612     ) -> ::HRESULT,
613     fn GetGlyphPlacements(
614         &mut self, textString: *const ::WCHAR, clusterMap: *const ::UINT16,
615         textProps: *mut DWRITE_SHAPING_TEXT_PROPERTIES, textLength: ::UINT32,
616         glyphIndices: *const ::UINT16, glyphProps: *const DWRITE_SHAPING_GLYPH_PROPERTIES,
617         glyphCount: ::UINT32, fontFace: *mut IDWriteFontFace, fontEmSize: ::FLOAT,
618         isSideways: ::BOOL, isRightToLeft: ::BOOL, scriptAnalysis: *const DWRITE_SCRIPT_ANALYSIS,
619         localeName: *const ::WCHAR, features: *mut *const DWRITE_TYPOGRAPHIC_FEATURES,
620         featureRangeLengths: *const ::UINT32, featureRanges: ::UINT32, glyphAdvances: *mut ::FLOAT,
621         glyphOffsets: *mut DWRITE_GLYPH_OFFSET
622     ) -> ::HRESULT,
623     fn GetGdiCompatibleGlyphPlacements(
624         &mut self, textString: *const ::WCHAR, clusterMap: *const ::UINT16,
625         textProps: *mut DWRITE_SHAPING_TEXT_PROPERTIES, textLength: ::UINT32,
626         glyphIndices: *const ::UINT16, glyphProps: *const DWRITE_SHAPING_GLYPH_PROPERTIES,
627         glyphCount: ::UINT32, fontFace: *mut IDWriteFontFace, fontEmSize: ::FLOAT,
628         pixelsPerDip: ::FLOAT, transform: *const DWRITE_MATRIX, useGdiNatrual: ::BOOL,
629         isSideways: ::BOOL, isRightToLeft: ::BOOL, scriptAnalysis: *const DWRITE_SCRIPT_ANALYSIS,
630         localeName: *const ::WCHAR, features: *mut *const DWRITE_TYPOGRAPHIC_FEATURES,
631         featureRangeLengths: *const ::UINT32, featureRanges: ::UINT32, glyphAdvances: *mut ::FLOAT,
632         glyphOffsets: *mut DWRITE_GLYPH_OFFSET
633     ) -> ::HRESULT
634 }}
635 STRUCT!{struct DWRITE_GLYPH_RUN {
636     fontFace: *mut IDWriteFontFace,
637     fontEmSize: ::FLOAT,
638     glyphCount: ::UINT32,
639     glyphIndices: *const ::UINT16,
640     glyphAdvances: *const ::FLOAT,
641     glyphOffsets: *const DWRITE_GLYPH_OFFSET,
642     isSideways: ::BOOL,
643     bidiLevel: ::UINT32,
644 }}
645 STRUCT!{struct DWRITE_GLYPH_RUN_DESCRIPTION {
646     localeName: *const ::WCHAR,
647     string: *const ::WCHAR,
648     stringLength: ::UINT32,
649     clusterMap: *const ::UINT16,
650     textPosition: ::UINT32,
651 }}
652 STRUCT!{struct DWRITE_UNDERLINE {
653     width: ::FLOAT,
654     thickness: ::FLOAT,
655     offset: ::FLOAT,
656     runHeight: ::FLOAT,
657     readingDirection: DWRITE_READING_DIRECTION,
658     flowDirection: DWRITE_FLOW_DIRECTION,
659     localeName: *const ::WCHAR,
660     measuringMode: ::DWRITE_MEASURING_MODE,
661 }}
662 STRUCT!{struct DWRITE_STRIKETHROUGH {
663     width: ::FLOAT,
664     thickness: ::FLOAT,
665     offset: ::FLOAT,
666     readingDirection: DWRITE_READING_DIRECTION,
667     flowDirection: DWRITE_FLOW_DIRECTION,
668     localeName: *const ::WCHAR,
669     measuringMode: ::DWRITE_MEASURING_MODE,
670 }}
671 STRUCT!{struct DWRITE_LINE_METRICS {
672     length: ::UINT32,
673     trailingWhitespaceLength: ::UINT32,
674     newlineLength: ::UINT32,
675     height: ::FLOAT,
676     baseline: ::FLOAT,
677     isTrimmed: ::BOOL,
678 }}
679 STRUCT!{struct DWRITE_CLUSTER_METRICS {
680     width: ::FLOAT,
681     length: ::UINT16,
682     bit_fields: ::UINT16,
683 }}
684 BITFIELD!{DWRITE_CLUSTER_METRICS bit_fields: ::UINT16 [
685     canWrapLineAfter set_canWrapLineAfter[0..1],
686     isWhitespace set_isWhitespace[1..2],
687     isNewline set_isNewline[2..3],
688     isSoftHyphen set_isSoftHyphen[3..4],
689     isRightToLeft set_isRightToLeft[4..5],
690     padding set_padding[5..16],
691 ]}
692 STRUCT!{struct DWRITE_TEXT_METRICS {
693     left: ::FLOAT,
694     top: ::FLOAT,
695     width: ::FLOAT,
696     widthIncludingTrailingWhitespace: ::FLOAT,
697     height: ::FLOAT,
698     layoutWidth: ::FLOAT,
699     layoutHeight: ::FLOAT,
700     maxBidiReorderingDepth: ::UINT32,
701     lineCount: ::UINT32,
702 }}
703 STRUCT!{struct DWRITE_INLINE_OBJECT_METRICS {
704     width: ::FLOAT,
705     height: ::FLOAT,
706     baseline: ::FLOAT,
707     supportsSideways: ::BOOL,
708 }}
709 STRUCT!{struct DWRITE_OVERHANG_METRICS {
710     left: ::FLOAT,
711     top: ::FLOAT,
712     right: ::FLOAT,
713     bottom: ::FLOAT,
714 }}
715 STRUCT!{struct DWRITE_HIT_TEST_METRICS {
716     textPosition: ::UINT32,
717     length: ::UINT32,
718     left: ::FLOAT,
719     top: ::FLOAT,
720     width: ::FLOAT,
721     height: ::FLOAT,
722     bidiLevel: ::UINT32,
723     isText: ::BOOL,
724     isTrimmed: ::BOOL,
725 }}
726 RIDL!{interface IDWriteInlineObject(IDWriteInlineObjectVtbl): IUnknown(IUnknownVtbl) {
727     fn Draw(
728         &mut self, clientDrawingContext: *mut ::c_void, renderer: *mut IDWriteTextRenderer,
729         originX: ::FLOAT, originY: ::FLOAT, isSideways: ::BOOL, isRightToLeft: ::BOOL,
730         clientDrawingEffect: *mut ::IUnknown
731     ) -> ::HRESULT,
732     fn GetMetrics(&mut self, metrics: *mut DWRITE_INLINE_OBJECT_METRICS) -> ::HRESULT,
733     fn GetOverhangMetrics(&mut self, overhangs: *mut DWRITE_OVERHANG_METRICS) -> ::HRESULT,
734     fn GetBreakConditions(
735         &mut self, breakConditionBefore: *mut DWRITE_BREAK_CONDITION,
736         breakConditionAfter: *mut DWRITE_BREAK_CONDITION
737     ) -> ::HRESULT
738 }}
739 RIDL!{interface IDWritePixelSnapping(IDWritePixelSnappingVtbl): IUnknown(IUnknownVtbl) {
740     fn IsPixelSnappingDisabled(
741         &mut self, clientDrawingContext: *mut ::c_void, isDisabled: *mut ::BOOL
742     ) -> ::HRESULT,
743     fn GetCurrentTransform(
744         &mut self, clientDrawingContext: *mut ::c_void, transform: *mut DWRITE_MATRIX
745     ) -> ::HRESULT,
746     fn GetPixelsPerDip(
747         &mut self, clientDrawingContext: *mut ::c_void, pixelsPerDip: *mut ::FLOAT
748     ) -> ::HRESULT
749 }}
750 RIDL!{interface IDWriteTextRenderer(IDWriteTextRendererVtbl):
751         IDWritePixelSnapping(IDWritePixelSnappingVtbl) {
752     fn DrawGlyphRun(
753         &mut self, clientDrawingContext: *mut ::c_void, baselineOriginX: ::FLOAT,
754         baselineOriginY: ::FLOAT, measuringMode: ::DWRITE_MEASURING_MODE,
755         glyphRun: *const DWRITE_GLYPH_RUN,
756         glyphRunDescription: *const DWRITE_GLYPH_RUN_DESCRIPTION,
757         clientDrawingEffect: *mut ::IUnknown
758     ) -> ::HRESULT,
759     fn DrawUnderline(
760         &mut self, clientDrawingContext: *mut ::c_void, baselineOriginX: ::FLOAT,
761         baselineOriginY: ::FLOAT, underline: *const DWRITE_UNDERLINE,
762         clientDrawingEffect: *mut ::IUnknown
763     ) -> ::HRESULT,
764     fn DrawStrikethrough(
765         &mut self, clientDrawingContext: *mut ::c_void, baselineOriginX: ::FLOAT,
766         baselineOriginY: ::FLOAT, strikethrough: *const DWRITE_STRIKETHROUGH,
767         clientDrawingEffect: *mut ::IUnknown
768     ) -> ::HRESULT,
769     fn DrawInlineObject(
770         &mut self, clientDrawingContext: *mut ::c_void, baselineOriginX: ::FLOAT,
771         baselineOriginY: ::FLOAT, inlineObject: *mut IDWriteInlineObject,
772         isSideways: ::BOOL, isRightToLeft: ::BOOL, clientDrawingEffect: *mut ::IUnknown
773     ) -> ::HRESULT
774 }}
775 RIDL!{interface IDWriteTextLayout(IDWriteTextLayoutVtbl):
776         IDWriteTextFormat(IDWriteTextFormatVtbl) {
777     fn SetMaxWidth(&mut self, maxWidth: ::FLOAT) -> ::HRESULT,
778     fn SetMaxHeight(&mut self, maxHeight: ::FLOAT) -> ::HRESULT,
779     fn SetFontCollection(
780         &mut self, fontCollection: *mut IDWriteFontCollection, textRange: DWRITE_TEXT_RANGE
781     ) -> ::HRESULT,
782     fn SetFontFamilyName(
783         &mut self, fontFamilyName: *const ::WCHAR, textRange: DWRITE_TEXT_RANGE
784     ) -> ::HRESULT,
785     fn SetFontWeight(
786         &mut self, fontWeight: DWRITE_FONT_WEIGHT, textRange: DWRITE_TEXT_RANGE
787     ) -> ::HRESULT,
788     fn SetFontStyle(
789         &mut self, fontStyle: DWRITE_FONT_STYLE, textRange: DWRITE_TEXT_RANGE
790     ) -> ::HRESULT,
791     fn SetFontStretch(
792         &mut self, fontStretch: DWRITE_FONT_STRETCH, textRange: DWRITE_TEXT_RANGE
793     ) -> ::HRESULT,
794     fn SetFontSize(&mut self, fontSize: ::FLOAT, textRange: DWRITE_TEXT_RANGE) -> ::HRESULT,
795     fn SetUnderline(&mut self, hasUnderline: ::BOOL, textRange: DWRITE_TEXT_RANGE) -> ::HRESULT,
796     fn SetStrikethrough(
797         &mut self, hasStrikethrough: ::BOOL, textRange: DWRITE_TEXT_RANGE
798     ) -> ::HRESULT,
799     fn SetDrawingEffect(
800         &mut self, drawingEffect: *mut ::IUnknown, textRange: DWRITE_TEXT_RANGE
801     ) -> ::HRESULT,
802     fn SetInlineObject(
803         &mut self, inlineObject: *mut IDWriteInlineObject, textRange: DWRITE_TEXT_RANGE
804     ) -> ::HRESULT,
805     fn SetTypography(
806         &mut self, typography: *mut IDWriteTypography, textRange: DWRITE_TEXT_RANGE
807     ) -> ::HRESULT,
808     fn SetLocaleName(
809         &mut self, localeName: *const ::WCHAR, textRange: DWRITE_TEXT_RANGE
810     ) -> ::HRESULT,
811     fn GetMaxWidth(&mut self) -> ::FLOAT,
812     fn GetMaxHeight(&mut self) -> ::FLOAT,
813     fn GetFontCollection(
814         &mut self, currentPosition: ::UINT32, fontCollection: *mut *mut IDWriteFontCollection,
815         textRange: *mut DWRITE_TEXT_RANGE
816     ) -> ::HRESULT,
817     fn GetFontFamilyNameLength(
818         &mut self, currentPosition: ::UINT32, nameLength: *mut ::UINT32,
819         textRange: *mut DWRITE_TEXT_RANGE
820     ) -> ::HRESULT,
821     fn GetFontFamilyName(
822         &mut self, currentPosition: ::UINT32, fontFamilyName: *mut ::WCHAR,
823         nameSize: ::UINT32, textRange: *mut DWRITE_TEXT_RANGE
824     ) -> ::HRESULT,
825     fn GetFontWeight(
826         &mut self, currentPosition: ::UINT32, fontWeight: *mut DWRITE_FONT_WEIGHT,
827         textRange: *mut DWRITE_TEXT_RANGE
828     ) -> ::HRESULT,
829     fn GetFontStyle(
830         &mut self, currentPosition: ::UINT32, fontStyle: *mut DWRITE_FONT_STYLE,
831         textRange: *mut DWRITE_TEXT_RANGE
832     ) -> ::HRESULT,
833     fn GetFontStretch(
834         &mut self, currentPosition: ::UINT32, fontStretch: *mut DWRITE_FONT_STRETCH,
835         textRange: *mut DWRITE_TEXT_RANGE
836     ) -> ::HRESULT,
837     fn GetFontSize(
838         &mut self, currentPosition: ::UINT32, fontSize: *mut ::FLOAT,
839         textRange: *mut DWRITE_TEXT_RANGE
840     ) -> ::HRESULT,
841     fn GetUnderline(
842         &mut self, currentPosition: ::UINT32, hasUnderline: *mut ::BOOL,
843         textRange: *mut DWRITE_TEXT_RANGE
844     ) -> ::HRESULT,
845     fn GetStrikethrough(
846         &mut self, currentPosition: ::UINT32, hasStrikethrough: *mut ::BOOL,
847         textRange: *mut DWRITE_TEXT_RANGE
848     ) -> ::HRESULT,
849     fn GetDrawingEffect(
850         &mut self, currentPosition: ::UINT32, drawingEffect: *mut *mut ::IUnknown,
851         textRange: *mut DWRITE_TEXT_RANGE
852     ) -> ::HRESULT,
853     fn GetInlineObject(
854         &mut self, currentPosition: ::UINT32, inlineObject: *mut *mut IDWriteInlineObject,
855         textRange: *mut DWRITE_TEXT_RANGE
856     ) -> ::HRESULT,
857     fn GetTypography(
858         &mut self, currentPosition: ::UINT32, typography: *mut *mut IDWriteTypography,
859         textRange: *mut DWRITE_TEXT_RANGE
860     ) -> ::HRESULT,
861     fn GetLocaleNameLength(
862         &mut self, currentPosition: ::UINT32, nameLength: *mut ::UINT32,
863         textRange: *mut DWRITE_TEXT_RANGE
864     ) -> ::HRESULT,
865     fn GetLocaleName(
866         &mut self, currentPosition: ::UINT32, localeName: *mut ::WCHAR, nameSize: ::UINT32,
867         textRange: *mut DWRITE_TEXT_RANGE
868     ) -> ::HRESULT,
869     fn Draw(
870         &mut self, clientDrawingContext: *mut ::c_void, renderer: *mut IDWriteTextRenderer,
871         originX: ::FLOAT, originY: ::FLOAT
872     ) -> ::HRESULT,
873     fn GetLineMetrics(
874         &mut self, lineMetrics: *mut DWRITE_LINE_METRICS, maxLineCount: ::UINT32,
875         actualLineCount: *mut ::UINT32
876     ) -> ::HRESULT,
877     fn GetMetrics(&mut self, textMetrics: *mut DWRITE_TEXT_METRICS) -> ::HRESULT,
878     fn GetOverhangMetrics(&mut self, overhangs: *mut DWRITE_OVERHANG_METRICS) -> ::HRESULT,
879     fn GetClusterMetrics(
880         &mut self, clusterMetrics: *mut DWRITE_CLUSTER_METRICS, maxClusterCount: ::UINT32,
881         actualClusterCount: *mut ::UINT32
882     ) -> ::HRESULT,
883     fn DetermineMinWidth(&mut self, minWidth: *mut ::FLOAT) -> ::HRESULT,
884     fn HitTestPoint(
885         &mut self, pointX: ::FLOAT, pointY: ::FLOAT, isTrailingHit: *mut ::BOOL,
886         isInside: *mut ::BOOL, hitTestMetrics: *mut DWRITE_HIT_TEST_METRICS
887     ) -> ::HRESULT,
888     fn HitTestTextPosition(
889         &mut self, textPosition: ::UINT32, isTrailingHit: ::BOOL, pointX: *mut ::FLOAT,
890         pointY: *mut ::FLOAT, hitTestMetrics: *mut DWRITE_HIT_TEST_METRICS
891     ) -> ::HRESULT,
892     fn HitTestTextRange(
893         &mut self, textPosition: ::UINT32, textLength: ::UINT32, originX: ::FLOAT,
894         originY: ::FLOAT, hitTestMetrics: *mut DWRITE_HIT_TEST_METRICS,
895         maxHitTestMetricsCount: ::UINT32, actualHitTestMetricsCount: *mut ::UINT32
896     ) -> ::HRESULT
897 }}
898 RIDL!{interface IDWriteBitmapRenderTarget(IDWriteBitmapRenderTargetVtbl): IUnknown(IUnknownVtbl) {
899     fn DrawGlyphRun(
900         &mut self, baselineOriginX: ::FLOAT, baselineOriginY: ::FLOAT,
901         measuringMode: ::DWRITE_MEASURING_MODE, glyphRun: *const ::DWRITE_GLYPH_RUN,
902         renderingParams: *mut IDWriteRenderingParams, textColor: ::COLORREF,
903         blackBoxRect: *mut ::RECT
904     ) -> ::HRESULT,
905     fn GetMemoryDC(&mut self) -> ::HDC,
906     fn GetPixelsPerDip(&mut self) -> ::FLOAT,
907     fn SetPixelsPerDip(&mut self, pixelsPerDip: ::FLOAT) -> ::HRESULT,
908     fn GetCurrentTransform(&mut self, transform: *mut DWRITE_MATRIX) -> ::HRESULT,
909     fn SetCurrentTransform(&mut self, transform: *const DWRITE_MATRIX) -> ::HRESULT,
910     fn GetSize(&mut self, size: *mut ::SIZE) -> ::HRESULT,
911     fn Resize(&mut self, width: ::UINT32, height: ::UINT32) -> ::HRESULT
912 }}
913 RIDL!{interface IDWriteGdiInterop(IDWriteGdiInteropVtbl): IUnknown(IUnknownVtbl) {
914     fn CreateFontFromLOGFONT(
915         &mut self, logFont: *const ::LOGFONTW, font: *mut *mut IDWriteFont
916     ) -> ::HRESULT,
917     fn ConvertFontToLOGFONT(
918         &mut self, font: *mut IDWriteFont, logFont: *mut ::LOGFONTW, isSystemFont: *mut ::BOOL
919     ) -> ::HRESULT,
920     fn ConvertFontFaceToLOGFONT(
921         &mut self, font: *mut IDWriteFontFace, logFont: *mut ::LOGFONTW
922     ) -> ::HRESULT,
923     fn CreateFontFaceFromHdc(
924         &mut self, hdc: ::HDC, fontFace: *mut *mut IDWriteFontFace
925     ) -> ::HRESULT,
926     fn CreateBitmapRenderTarget(
927         &mut self, hdc: ::HDC, width: ::UINT32, height: ::UINT32,
928         renderTarget: *mut *mut IDWriteBitmapRenderTarget
929     ) -> ::HRESULT
930 }}
931 ENUM!{enum DWRITE_TEXTURE_TYPE {
932     DWRITE_TEXTURE_ALIASED_1x1 = 0,
933     DWRITE_TEXTURE_CLEARTYPE_3x1 = 1,
934 }}
935 pub const DWRITE_ALPHA_MAX: ::BYTE = 255;
936 RIDL!{interface IDWriteGlyphRunAnalysis(IDWriteGlyphRunAnalysisVtbl): IUnknown(IUnknownVtbl) {
937     fn GetAlphaTextureBounds(
938         &mut self, textureType: DWRITE_TEXTURE_TYPE, textureBounds: *mut ::RECT
939     ) -> ::HRESULT,
940     fn CreateAlphaTexture(
941         &mut self, textureType: DWRITE_TEXTURE_TYPE, textureBounds: *const ::RECT,
942         alphaValues: *mut ::BYTE, bufferSize: ::UINT32
943     ) -> ::HRESULT,
944     fn GetAlphaBlendParams(
945         &mut self, renderingParams: *mut IDWriteRenderingParams, blendGamma: *mut ::FLOAT,
946         blendEnhancedContrast: *mut ::FLOAT, blendClearTypeLevel: *mut ::FLOAT
947     ) -> ::HRESULT
948 }}
949 RIDL!{interface IDWriteFactory(IDWriteFactoryVtbl): IUnknown(IUnknownVtbl) {
950     fn GetSystemFontCollection(
951         &mut self, fontCollection: *mut *mut IDWriteFontCollection, checkForUpdates: ::BOOL
952     ) -> ::HRESULT,
953     fn CreateCustomFontCollection(
954         &mut self, collectionLoader: *mut IDWriteFontCollectionLoader,
955         collectionKey: *const ::c_void, collectionKeySize: ::UINT32,
956         fontCollection: *mut *mut IDWriteFontCollection
957     ) -> ::HRESULT,
958     fn RegisterFontCollectionLoader(
959         &mut self, fontCollectionLoader: *mut IDWriteFontCollectionLoader
960     ) -> ::HRESULT,
961     fn UnregisterFontCollectionLoader(
962         &mut self, fontCollectionLoader: *mut IDWriteFontCollectionLoader
963     ) -> ::HRESULT,
964     fn CreateFontFileReference(
965         &mut self, filePath: *const ::WCHAR, lastWriteTime: *const ::FILETIME,
966         fontFile: *mut *mut IDWriteFontFile
967     ) -> ::HRESULT,
968     fn CreateCustomFontFileReference(
969         &mut self, fontFileReferenceKey: *const ::c_void, fontFileReferenceKeySize: ::UINT32,
970         fontFileLoader: *mut IDWriteFontFileLoader, fontFile: *mut *mut IDWriteFontFile
971     ) -> ::HRESULT,
972     fn CreateFontFace(
973         &mut self, fontFaceType: DWRITE_FONT_FACE_TYPE, numberOfFiles: ::UINT32,
974         fontFiles: *const *mut IDWriteFontFile, faceIndex: ::UINT32,
975         fontFaceSimulationFlags: DWRITE_FONT_SIMULATIONS, fontFace: *mut *mut IDWriteFontFace
976     ) -> ::HRESULT,
977     fn CreateRenderingParams(
978         &mut self, renderingParams: *mut *mut IDWriteRenderingParams
979     ) -> ::HRESULT,
980     fn CreateMonitorRenderingParams(
981         &mut self, monitor: ::HMONITOR, renderingParams: *mut *mut IDWriteRenderingParams
982     ) -> ::HRESULT,
983     fn CreateCustomRenderingParams(
984         &mut self, gamma: ::FLOAT, enhancedContrast: ::FLOAT, clearTypeLevel: ::FLOAT,
985         pixelGeometry: DWRITE_PIXEL_GEOMETRY, renderingMode: DWRITE_RENDERING_MODE,
986         renderingParams: *mut *mut IDWriteRenderingParams
987     ) -> ::HRESULT,
988     fn RegisterFontFileLoader(
989         &mut self, fontFileLoader: *mut IDWriteFontFileLoader
990     ) -> ::HRESULT,
991     fn UnregisterFontFileLoader(
992         &mut self, fontFileLoader: *mut IDWriteFontFileLoader
993     ) -> ::HRESULT,
994     fn CreateTextFormat(
995         &mut self, fontFamilyName: *const ::WCHAR, fontCollection: *mut IDWriteFontCollection,
996         fontWeight: DWRITE_FONT_WEIGHT, fontStyle: DWRITE_FONT_STYLE,
997         fontStretch: DWRITE_FONT_STRETCH, fontSize: ::FLOAT, localeName: *const ::WCHAR,
998         textFormat: *mut *mut IDWriteTextFormat
999     ) -> ::HRESULT,
1000     fn CreateTypography(&mut self, typography: *mut *mut IDWriteTypography) -> ::HRESULT,
1001     fn GetGdiInterop(&mut self, gdiInterop: *mut *mut IDWriteGdiInterop) -> ::HRESULT,
1002     fn CreateTextLayout(
1003         &mut self, string: *const ::WCHAR, stringLength: ::UINT32,
1004         textFormat: *mut IDWriteTextFormat, maxWidth: ::FLOAT, maxHeight: ::FLOAT,
1005         textLayout: *mut *mut IDWriteTextLayout
1006     ) -> ::HRESULT,
1007     fn CreateGdiCompatibleTextLayout(
1008         &mut self, string: *const ::WCHAR, stringLength: ::UINT32,
1009         textFormat: *mut IDWriteTextFormat, layoutWidth: ::FLOAT, layoutHeight: ::FLOAT,
1010         pixelsPerDip: ::FLOAT, transform: *const DWRITE_MATRIX, useGdiNatrual: ::BOOL,
1011         textLayout: *mut *mut IDWriteTextLayout
1012     ) -> ::HRESULT,
1013     fn CreateEllipsisTrimmingSign(
1014         &mut self, textFormat: *mut IDWriteTextFormat, trimmingSign: *mut *mut IDWriteInlineObject
1015     ) -> ::HRESULT,
1016     fn CreateTextAnalyzer(&mut self, textAnalyzer: *mut *mut IDWriteTextAnalyzer) -> ::HRESULT,
1017     fn CreateNumberSubstitution(
1018         &mut self, substitutionMethod: DWRITE_NUMBER_SUBSTITUTION_METHOD,
1019         localeName: *const ::WCHAR, ignoreUserOverride: ::BOOL,
1020         numberSubstitution: *mut *mut IDWriteNumberSubstitution
1021     ) -> ::HRESULT,
1022     fn CreateGlyphRunAnalysis(
1023         &mut self, glyphRun: *const DWRITE_GLYPH_RUN, pixelsPerDip: ::FLOAT,
1024         transform: *const DWRITE_MATRIX, renderingMode: DWRITE_RENDERING_MODE,
1025         measuringMode: ::DWRITE_MEASURING_MODE, baselineOriginX: ::FLOAT,
1026         baselineOriginY: ::FLOAT, glyphRunAnalysis: *mut *mut IDWriteGlyphRunAnalysis
1027     ) -> ::HRESULT
1028 }}
1029 pub const FACILITY_DWRITE: ::HRESULT = 0x898;
1030 pub const DWRITE_ERR_BASE: ::HRESULT = 0x5000;
1031 #[inline]
MAKE_DWRITE_HR(severity: ::HRESULT, code: ::HRESULT) -> ::HRESULT1032 pub fn MAKE_DWRITE_HR(severity: ::HRESULT, code: ::HRESULT) -> ::HRESULT {
1033     ::MAKE_HRESULT(severity, FACILITY_DWRITE, DWRITE_ERR_BASE + code)
1034 }
1035 #[inline]
MAKE_DWRITE_HR_ERR(code: ::HRESULT) -> ::HRESULT1036 pub fn MAKE_DWRITE_HR_ERR(code: ::HRESULT) -> ::HRESULT {
1037     MAKE_DWRITE_HR(::SEVERITY_ERROR, code)
1038 }
1039