d3drm: Avoid LPD3DRMQUATERNION.
[wine] / include / dwrite.idl
1 /*
2  * Copyright 2012 Nikolay Sivov for CodeWeavers
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 import "unknwn.idl";
20 import "dcommon.h";
21
22 interface IDWriteFactory;
23 interface IDWriteFontCollection;
24 interface IDWriteFontFamily;
25 interface IDWriteFontFace;
26 interface IDWriteInlineObject;
27
28 interface ID2D1SimplifiedGeometrySink;
29 typedef ID2D1SimplifiedGeometrySink IDWriteGeometrySink;
30
31 cpp_quote("#ifndef _WINDEF_")
32 /* already defined in windef.h but needed for WIDL */
33 typedef void *HMONITOR;
34 cpp_quote("#endif /* _WINDEF_ */")
35
36 cpp_quote("#ifdef WINE_NO_UNICODE_MACROS")
37 cpp_quote("#undef GetGlyphIndices")
38 cpp_quote("#endif")
39
40 typedef enum DWRITE_FACTORY_TYPE
41 {
42     DWRITE_FACTORY_TYPE_SHARED,
43     DWRITE_FACTORY_TYPE_ISOLATED
44 } DWRITE_FACTORY_TYPE;
45
46 typedef enum DWRITE_FONT_FILE_TYPE
47 {
48     DWRITE_FONT_FILE_TYPE_UNKNOWN,
49     DWRITE_FONT_FILE_TYPE_CFF,
50     DWRITE_FONT_FILE_TYPE_TRUETYPE,
51     DWRITE_FONT_FILE_TYPE_TRUETYPE_COLLECTION,
52     DWRITE_FONT_FILE_TYPE_TYPE1_PFM,
53     DWRITE_FONT_FILE_TYPE_TYPE1_PFB,
54     DWRITE_FONT_FILE_TYPE_VECTOR,
55     DWRITE_FONT_FILE_TYPE_BITMAP
56 } DWRITE_FONT_FILE_TYPE;
57
58 typedef enum DWRITE_FONT_FACE_TYPE
59 {
60     DWRITE_FONT_FACE_TYPE_CFF,
61     DWRITE_FONT_FACE_TYPE_TRUETYPE,
62     DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION,
63     DWRITE_FONT_FACE_TYPE_TYPE1,
64     DWRITE_FONT_FACE_TYPE_VECTOR,
65     DWRITE_FONT_FACE_TYPE_BITMAP,
66     DWRITE_FONT_FACE_TYPE_UNKNOWN
67 } DWRITE_FONT_FACE_TYPE;
68
69 typedef enum DWRITE_FONT_WEIGHT
70 {
71     DWRITE_FONT_WEIGHT_THIN = 100,
72     DWRITE_FONT_WEIGHT_EXTRA_LIGHT = 200,
73     DWRITE_FONT_WEIGHT_ULTRA_LIGHT = 200,
74     DWRITE_FONT_WEIGHT_LIGHT = 300,
75     DWRITE_FONT_WEIGHT_NORMAL = 400,
76     DWRITE_FONT_WEIGHT_REGULAR = 400,
77     DWRITE_FONT_WEIGHT_MEDIUM = 500,
78     DWRITE_FONT_WEIGHT_DEMI_BOLD = 600,
79     DWRITE_FONT_WEIGHT_SEMI_BOLD = 600,
80     DWRITE_FONT_WEIGHT_BOLD = 700,
81     DWRITE_FONT_WEIGHT_EXTRA_BOLD = 800,
82     DWRITE_FONT_WEIGHT_ULTRA_BOLD = 800,
83     DWRITE_FONT_WEIGHT_BLACK = 900,
84     DWRITE_FONT_WEIGHT_HEAVY = 900,
85     DWRITE_FONT_WEIGHT_EXTRA_BLACK = 950,
86     DWRITE_FONT_WEIGHT_ULTRA_BLACK = 950
87 } DWRITE_FONT_WEIGHT;
88
89 typedef enum DWRITE_FONT_STRETCH
90 {
91     DWRITE_FONT_STRETCH_UNDEFINED = 0,
92     DWRITE_FONT_STRETCH_ULTRA_CONDENSED = 1,
93     DWRITE_FONT_STRETCH_EXTRA_CONDENSED = 2,
94     DWRITE_FONT_STRETCH_CONDENSED = 3,
95     DWRITE_FONT_STRETCH_SEMI_CONDENSED = 4,
96     DWRITE_FONT_STRETCH_NORMAL = 5,
97     DWRITE_FONT_STRETCH_MEDIUM = 5,
98     DWRITE_FONT_STRETCH_SEMI_EXPANDED = 6,
99     DWRITE_FONT_STRETCH_EXPANDED = 7,
100     DWRITE_FONT_STRETCH_EXTRA_EXPANDED = 8,
101     DWRITE_FONT_STRETCH_ULTRA_EXPANDED = 9
102 } DWRITE_FONT_STRETCH;
103
104 typedef enum DWRITE_FONT_STYLE
105 {
106     DWRITE_FONT_STYLE_NORMAL,
107     DWRITE_FONT_STYLE_OBLIQUE,
108     DWRITE_FONT_STYLE_ITALIC
109 } DWRITE_FONT_STYLE;
110
111 typedef enum DWRITE_INFORMATIONAL_STRING_ID
112 {
113     DWRITE_INFORMATIONAL_STRING_NONE,
114     DWRITE_INFORMATIONAL_STRING_COPYRIGHT_NOTICE,
115     DWRITE_INFORMATIONAL_STRING_VERSION_STRINGS,
116     DWRITE_INFORMATIONAL_STRING_TRADEMARK,
117     DWRITE_INFORMATIONAL_STRING_MANUFACTURER,
118     DWRITE_INFORMATIONAL_STRING_DESIGNER,
119     DWRITE_INFORMATIONAL_STRING_DESIGNER_URL,
120     DWRITE_INFORMATIONAL_STRING_DESCRIPTION,
121     DWRITE_INFORMATIONAL_STRING_FONT_VENDOR_URL,
122     DWRITE_INFORMATIONAL_STRING_LICENSE_DESCRIPTION,
123     DWRITE_INFORMATIONAL_STRING_LICENSE_INFO_URL,
124     DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES,
125     DWRITE_INFORMATIONAL_STRING_WIN32_SUBFAMILY_NAMES,
126     DWRITE_INFORMATIONAL_STRING_PREFERRED_FAMILY_NAMES,
127     DWRITE_INFORMATIONAL_STRING_PREFERRED_SUBFAMILY_NAMES,
128     DWRITE_INFORMATIONAL_STRING_SAMPLE_TEXT
129 } DWRITE_INFORMATIONAL_STRING_ID;
130
131 typedef enum DWRITE_FONT_SIMULATIONS
132 {
133     DWRITE_FONT_SIMULATIONS_NONE    = 0x0000,
134     DWRITE_FONT_SIMULATIONS_BOLD    = 0x0001,
135     DWRITE_FONT_SIMULATIONS_OBLIQUE = 0x0002
136 } DWRITE_FONT_SIMULATIONS;
137
138 typedef enum DWRITE_PIXEL_GEOMETRY
139 {
140     DWRITE_PIXEL_GEOMETRY_FLAT,
141     DWRITE_PIXEL_GEOMETRY_RGB,
142     DWRITE_PIXEL_GEOMETRY_BGR
143 } DWRITE_PIXEL_GEOMETRY;
144
145 typedef enum DWRITE_RENDERING_MODE
146 {
147     DWRITE_RENDERING_MODE_DEFAULT,
148     DWRITE_RENDERING_MODE_ALIASED,
149     DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC,
150     DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL,
151     DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL,
152     DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC,
153     DWRITE_RENDERING_MODE_OUTLINE
154 } DWRITE_RENDERING_MODE;
155
156 typedef enum DWRITE_TEXT_ALIGNMENT
157 {
158     DWRITE_TEXT_ALIGNMENT_LEADING,
159     DWRITE_TEXT_ALIGNMENT_TRAILING,
160     DWRITE_TEXT_ALIGNMENT_CENTER
161 } DWRITE_TEXT_ALIGNMENT;
162
163 typedef enum DWRITE_PARAGRAPH_ALIGNMENT
164 {
165     DWRITE_PARAGRAPH_ALIGNMENT_NEAR,
166     DWRITE_PARAGRAPH_ALIGNMENT_FAR,
167     DWRITE_PARAGRAPH_ALIGNMENT_CENTER
168 } DWRITE_PARAGRAPH_ALIGNMENT;
169
170 typedef enum DWRITE_WORD_WRAPPING
171 {
172     DWRITE_WORD_WRAPPING_WRAP,
173     DWRITE_WORD_WRAPPING_NO_WRAP
174 } DWRITE_WORD_WRAPPING;
175
176 typedef enum DWRITE_READING_DIRECTION
177 {
178     DWRITE_READING_DIRECTION_LEFT_TO_RIGHT,
179     DWRITE_READING_DIRECTION_RIGHT_TO_LEFT
180 } DWRITE_READING_DIRECTION;
181
182 typedef enum DWRITE_FLOW_DIRECTION
183 {
184     DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM
185 } DWRITE_FLOW_DIRECTION;
186
187 typedef enum DWRITE_TRIMMING_GRANULARITY
188 {
189     DWRITE_TRIMMING_GRANULARITY_NONE,
190     DWRITE_TRIMMING_GRANULARITY_CHARACTER,
191     DWRITE_TRIMMING_GRANULARITY_WORD
192 } DWRITE_TRIMMING_GRANULARITY;
193
194 typedef enum DWRITE_BREAK_CONDITION
195 {
196     DWRITE_BREAK_CONDITION_NEUTRAL,
197     DWRITE_BREAK_CONDITION_CAN_BREAK,
198     DWRITE_BREAK_CONDITION_MAY_NOT_BREAK,
199     DWRITE_BREAK_CONDITION_MUST_BREAK
200 } DWRITE_BREAK_CONDITION;
201
202 typedef enum DWRITE_LINE_SPACING_METHOD
203 {
204     DWRITE_LINE_SPACING_METHOD_DEFAULT,
205     DWRITE_LINE_SPACING_METHOD_UNIFORM
206 } DWRITE_LINE_SPACING_METHOD;
207
208 typedef enum DWRITE_FONT_FEATURE_TAG
209 {
210     DWRITE_FONT_FEATURE_TAG_ALTERNATIVE_FRACTIONS           = 0x63726661, /* 'afrc' */
211     DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS_FROM_CAPITALS   = 0x63703263, /* 'c2pc' */
212     DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS_FROM_CAPITALS    = 0x63733263, /* 'c2sc' */
213     DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_ALTERNATES           = 0x746c6163, /* 'calt' */
214     DWRITE_FONT_FEATURE_TAG_CASE_SENSITIVE_FORMS            = 0x65736163, /* 'case' */
215     DWRITE_FONT_FEATURE_TAG_GLYPH_COMPOSITION_DECOMPOSITION = 0x706d6363, /* 'ccmp' */
216     DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_LIGATURES            = 0x67696c63, /* 'clig' */
217     DWRITE_FONT_FEATURE_TAG_CAPITAL_SPACING                 = 0x70737063, /* 'cpsp' */
218     DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_SWASH                = 0x68777363, /* 'cswh' */
219     DWRITE_FONT_FEATURE_TAG_CURSIVE_POSITIONING             = 0x73727563, /* 'curs' */
220     DWRITE_FONT_FEATURE_TAG_DEFAULT                         = 0x746c6664, /* 'dflt' */
221     DWRITE_FONT_FEATURE_TAG_DISCRETIONARY_LIGATURES         = 0x67696c64, /* 'dlig' */
222     DWRITE_FONT_FEATURE_TAG_EXPERT_FORMS                    = 0x74707865, /* 'expt' */
223     DWRITE_FONT_FEATURE_TAG_FRACTIONS                       = 0x63617266, /* 'frac' */
224     DWRITE_FONT_FEATURE_TAG_FULL_WIDTH                      = 0x64697766, /* 'fwid' */
225     DWRITE_FONT_FEATURE_TAG_HALF_FORMS                      = 0x666c6168, /* 'half' */
226     DWRITE_FONT_FEATURE_TAG_HALANT_FORMS                    = 0x6e6c6168, /* 'haln' */
227     DWRITE_FONT_FEATURE_TAG_ALTERNATE_HALF_WIDTH            = 0x746c6168, /* 'halt' */
228     DWRITE_FONT_FEATURE_TAG_HISTORICAL_FORMS                = 0x74736968, /* 'hist' */
229     DWRITE_FONT_FEATURE_TAG_HORIZONTAL_KANA_ALTERNATES      = 0x616e6b68, /* 'hkna' */
230     DWRITE_FONT_FEATURE_TAG_HISTORICAL_LIGATURES            = 0x67696c68, /* 'hlig' */
231     DWRITE_FONT_FEATURE_TAG_HALF_WIDTH                      = 0x64697768, /* 'hwid' */
232     DWRITE_FONT_FEATURE_TAG_HOJO_KANJI_FORMS                = 0x6f6a6f68, /* 'hojo' */
233     DWRITE_FONT_FEATURE_TAG_JIS04_FORMS                     = 0x3430706a, /* 'jp04' */
234     DWRITE_FONT_FEATURE_TAG_JIS78_FORMS                     = 0x3837706a, /* 'jp78' */
235     DWRITE_FONT_FEATURE_TAG_JIS83_FORMS                     = 0x3338706a, /* 'jp83' */
236     DWRITE_FONT_FEATURE_TAG_JIS90_FORMS                     = 0x3039706a, /* 'jp90' */
237     DWRITE_FONT_FEATURE_TAG_KERNING                         = 0x6e72656b, /* 'kern' */
238     DWRITE_FONT_FEATURE_TAG_STANDARD_LIGATURES              = 0x6167696c, /* 'liga' */
239     DWRITE_FONT_FEATURE_TAG_LINING_FIGURES                  = 0x6d756e6c, /* 'lnum' */
240     DWRITE_FONT_FEATURE_TAG_LOCALIZED_FORMS                 = 0x6c636f6c, /* 'locl' */
241     DWRITE_FONT_FEATURE_TAG_MARK_POSITIONING                = 0x6b72616d, /* 'mark' */
242     DWRITE_FONT_FEATURE_TAG_MATHEMATICAL_GREEK              = 0x6b72676d, /* 'mgrk' */
243     DWRITE_FONT_FEATURE_TAG_MARK_TO_MARK_POSITIONING        = 0x6b6d6b6d, /* 'mkmk' */
244     DWRITE_FONT_FEATURE_TAG_ALTERNATE_ANNOTATION_FORMS      = 0x746c616e, /* 'nalt' */
245     DWRITE_FONT_FEATURE_TAG_NLC_KANJI_FORMS                 = 0x6b636c6e, /* 'nlck' */
246     DWRITE_FONT_FEATURE_TAG_OLD_STYLE_FIGURES               = 0x6d756e6f, /* 'onum' */
247     DWRITE_FONT_FEATURE_TAG_ORDINALS                        = 0x6e64726f, /* 'ordn' */
248     DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_ALTERNATE_WIDTH    = 0x746c6170, /* 'palt' */
249     DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS                 = 0x70616370, /* 'pcap' */
250     DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_FIGURES            = 0x6d756e70, /* 'pnum' */
251     DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_WIDTHS             = 0x64697770, /* 'pwid' */
252     DWRITE_FONT_FEATURE_TAG_QUARTER_WIDTHS                  = 0x64697771, /* 'qwid' */
253     DWRITE_FONT_FEATURE_TAG_REQUIRED_LIGATURES              = 0x67696c72, /* 'rlig' */
254     DWRITE_FONT_FEATURE_TAG_RUBY_NOTATION_FORMS             = 0x79627572, /* 'ruby' */
255     DWRITE_FONT_FEATURE_TAG_STYLISTIC_ALTERNATES            = 0x746c6173, /* 'salt' */
256     DWRITE_FONT_FEATURE_TAG_SCIENTIFIC_INFERIORS            = 0x666e6973, /* 'sinf' */
257     DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS                  = 0x70636d73, /* 'smcp' */
258     DWRITE_FONT_FEATURE_TAG_SIMPLIFIED_FORMS                = 0x6c706d73, /* 'smpl' */
259     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1                 = 0x31307373, /* 'ss01' */
260     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_2                 = 0x32307373, /* 'ss02' */
261     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_3                 = 0x33307373, /* 'ss03' */
262     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_4                 = 0x34307373, /* 'ss04' */
263     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_5                 = 0x35307373, /* 'ss05' */
264     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_6                 = 0x36307373, /* 'ss06' */
265     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_7                 = 0x37307373, /* 'ss07' */
266     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_8                 = 0x38307373, /* 'ss08' */
267     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_9                 = 0x39307373, /* 'ss09' */
268     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_10                = 0x30317373, /* 'ss10' */
269     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_11                = 0x31317373, /* 'ss11' */
270     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_12                = 0x32317373, /* 'ss12' */
271     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_13                = 0x33317373, /* 'ss13' */
272     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_14                = 0x34317373, /* 'ss14' */
273     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_15                = 0x35317373, /* 'ss15' */
274     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_16                = 0x36317373, /* 'ss16' */
275     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_17                = 0x37317373, /* 'ss17' */
276     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_18                = 0x38317373, /* 'ss18' */
277     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_19                = 0x39317373, /* 'ss19' */
278     DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_20                = 0x30327373, /* 'ss20' */
279     DWRITE_FONT_FEATURE_TAG_SUBSCRIPT                       = 0x73627573, /* 'subs' */
280     DWRITE_FONT_FEATURE_TAG_SUPERSCRIPT                     = 0x73707573, /* 'sups' */
281     DWRITE_FONT_FEATURE_TAG_SWASH                           = 0x68737773, /* 'swsh' */
282     DWRITE_FONT_FEATURE_TAG_TITLING                         = 0x6c746974, /* 'titl' */
283     DWRITE_FONT_FEATURE_TAG_TRADITIONAL_NAME_FORMS          = 0x6d616e74, /* 'tnam' */
284     DWRITE_FONT_FEATURE_TAG_TABULAR_FIGURES                 = 0x6d756e74, /* 'tnum' */
285     DWRITE_FONT_FEATURE_TAG_TRADITIONAL_FORMS               = 0x64617274, /* 'trad' */
286     DWRITE_FONT_FEATURE_TAG_THIRD_WIDTHS                    = 0x64697774, /* 'twid' */
287     DWRITE_FONT_FEATURE_TAG_UNICASE                         = 0x63696e75, /* 'unic' */
288     DWRITE_FONT_FEATURE_TAG_SLASHED_ZERO                    = 0x6f72657a, /* 'zero' */
289 } DWRITE_FONT_FEATURE_TAG;
290
291 typedef enum DWRITE_SCRIPT_SHAPES
292 {
293     DWRITE_SCRIPT_SHAPES_DEFAULT = 0,
294     DWRITE_SCRIPT_SHAPES_NO_VISUAL = 1
295 } DWRITE_SCRIPT_SHAPES;
296
297 typedef enum DWRITE_NUMBER_SUBSTITUTION_METHOD
298 {
299     DWRITE_NUMBER_SUBSTITUTION_METHOD_FROM_CULTURE,
300     DWRITE_NUMBER_SUBSTITUTION_METHOD_CONTEXTUAL,
301     DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE,
302     DWRITE_NUMBER_SUBSTITUTION_METHOD_NATIONAL,
303     DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL
304 } DWRITE_NUMBER_SUBSTITUTION_METHOD;
305
306 typedef enum DWRITE_TEXTURE_TYPE
307 {
308     DWRITE_TEXTURE_ALIASED_1x1,
309     DWRITE_TEXTURE_CLEARTYPE_3x1
310 } DWRITE_TEXTURE_TYPE;
311
312 typedef struct DWRITE_FONT_METRICS
313 {
314     UINT16 designUnitsPerEm;
315     UINT16 ascent;
316     UINT16 descent;
317     INT16 lineGap;
318     UINT16 capHeight;
319     UINT16 xHeight;
320     INT16 underlinePosition;
321     UINT16 underlineThickness;
322     INT16 strikethroughPosition;
323     UINT16 strikethroughThickness;
324 } DWRITE_FONT_METRICS;
325
326 typedef struct DWRITE_GLYPH_METRICS
327 {
328     INT32 leftSideBearing;
329     UINT32 advanceWidth;
330     INT32 rightSideBearing;
331     INT32 topSideBearing;
332     UINT32 advanceHeight;
333     INT32 bottomSideBearing;
334     INT32 verticalOriginY;
335 } DWRITE_GLYPH_METRICS;
336
337 typedef struct DWRITE_GLYPH_OFFSET
338 {
339     FLOAT advanceOffset;
340     FLOAT ascenderOffset;
341 } DWRITE_GLYPH_OFFSET;
342
343 typedef struct DWRITE_MATRIX
344 {
345     FLOAT m11;
346     FLOAT m12;
347     FLOAT m21;
348     FLOAT m22;
349     FLOAT dx;
350     FLOAT dy;
351 } DWRITE_MATRIX;
352
353 typedef struct DWRITE_TRIMMING
354 {
355     DWRITE_TRIMMING_GRANULARITY granularity;
356     UINT32 delimiter;
357     UINT32 delimiterCount;
358 } DWRITE_TRIMMING;
359
360 typedef struct DWRITE_GLYPH_RUN
361 {
362     IDWriteFontFace* fontFace;
363     FLOAT fontEmSize;
364     UINT32 glyphCount;
365     UINT16 const* glyphIndices;
366     FLOAT const* glyphAdvances;
367     DWRITE_GLYPH_OFFSET const* glyphOffsets;
368     BOOL isSideways;
369     UINT32 bidiLevel;
370 } DWRITE_GLYPH_RUN;
371
372 typedef struct DWRITE_GLYPH_RUN_DESCRIPTION
373 {
374     WCHAR const* localeName;
375     WCHAR const* string;
376     UINT32 stringLength;
377     UINT16 const* clusterMap;
378     UINT32 textPosition;
379 } DWRITE_GLYPH_RUN_DESCRIPTION;
380
381 typedef struct DWRITE_UNDERLINE
382 {
383     FLOAT width;
384     FLOAT thickness;
385     FLOAT offset;
386     FLOAT runHeight;
387     DWRITE_READING_DIRECTION readingDirection;
388     DWRITE_FLOW_DIRECTION flowDirection;
389     WCHAR const* localeName;
390     DWRITE_MEASURING_MODE measuringMode;
391 } DWRITE_UNDERLINE;
392
393 typedef struct DWRITE_STRIKETHROUGH
394 {
395     FLOAT width;
396     FLOAT thickness;
397     FLOAT offset;
398     DWRITE_READING_DIRECTION readingDirection;
399     DWRITE_FLOW_DIRECTION flowDirection;
400     WCHAR const* localeName;
401     DWRITE_MEASURING_MODE measuringMode;
402 } DWRITE_STRIKETHROUGH;
403
404 typedef struct DWRITE_INLINE_OBJECT_METRICS
405 {
406     FLOAT width;
407     FLOAT height;
408     FLOAT baseline;
409     BOOL  supportsSideways;
410 } DWRITE_INLINE_OBJECT_METRICS;
411
412 typedef struct DWRITE_OVERHANG_METRICS
413 {
414     FLOAT left;
415     FLOAT top;
416     FLOAT right;
417     FLOAT bottom;
418 } DWRITE_OVERHANG_METRICS;
419
420 typedef struct DWRITE_FONT_FEATURE
421 {
422     DWRITE_FONT_FEATURE_TAG nameTag;
423     UINT32 parameter;
424 } DWRITE_FONT_FEATURE;
425
426 typedef struct DWRITE_TEXT_RANGE
427 {
428     UINT32 startPosition;
429     UINT32 length;
430 } DWRITE_TEXT_RANGE;
431
432 typedef struct DWRITE_LINE_METRICS
433 {
434     UINT32 length;
435     UINT32 trailingWhitespaceLength;
436     UINT32 newlineLength;
437     FLOAT height;
438     FLOAT baseline;
439     BOOL isTrimmed;
440 } DWRITE_LINE_METRICS;
441
442 typedef struct DWRITE_TEXT_METRICS
443 {
444     FLOAT left;
445     FLOAT top;
446     FLOAT width;
447     FLOAT widthIncludingTrailingWhitespace;
448     FLOAT height;
449     FLOAT layoutWidth;
450     FLOAT layoutHeight;
451     UINT32 maxBidiReorderingDepth;
452     UINT32 lineCount;
453 } DWRITE_TEXT_METRICS;
454
455 typedef struct DWRITE_CLUSTER_METRICS
456 {
457     FLOAT width;
458     UINT16 length;
459     UINT16 canWrapLineAfter : 1;
460     UINT16 isWhitespace : 1;
461     UINT16 isNewline : 1;
462     UINT16 isSoftHyphen : 1;
463     UINT16 isRightToLeft : 1;
464     UINT16 padding : 11;
465 } DWRITE_CLUSTER_METRICS;
466
467 typedef struct DWRITE_HIT_TEST_METRICS
468 {
469     UINT32 textPosition;
470     UINT32 length;
471     FLOAT left;
472     FLOAT top;
473     FLOAT width;
474     FLOAT height;
475     UINT32 bidiLevel;
476     BOOL isText;
477     BOOL isTrimmed;
478 } DWRITE_HIT_TEST_METRICS;
479
480 typedef struct DWRITE_SCRIPT_ANALYSIS
481 {
482     UINT16 script;
483     DWRITE_SCRIPT_SHAPES shapes;
484 } DWRITE_SCRIPT_ANALYSIS;
485
486 typedef struct DWRITE_LINE_BREAKPOINT
487 {
488     UINT8 breakConditionBefore : 2;
489     UINT8 breakConditionAfter : 2;
490     UINT8 isWhitespace : 1;
491     UINT8 isSoftHyphen : 1;
492     UINT8 padding : 2;
493 } DWRITE_LINE_BREAKPOINT;
494
495 typedef struct DWRITE_TYPOGRAPHIC_FEATURES
496 {
497     DWRITE_FONT_FEATURE* features;
498     UINT32 featureCount;
499 } DWRITE_TYPOGRAPHIC_FEATURES;
500
501 typedef struct DWRITE_SHAPING_TEXT_PROPERTIES
502 {
503     UINT16 isShapedAlone : 1;
504     UINT16 reserved : 15;
505 } DWRITE_SHAPING_TEXT_PROPERTIES;
506
507 typedef struct DWRITE_SHAPING_GLYPH_PROPERTIES
508 {
509     UINT16 justification : 4;
510     UINT16 isClusterStart : 1;
511     UINT16 isDiacritic : 1;
512     UINT16 isZeroWidthSpace : 1;
513     UINT16 reserved : 9;
514 } DWRITE_SHAPING_GLYPH_PROPERTIES;
515
516 [
517 local,
518 object,
519 uuid(6d4865fe-0ab8-4d91-8f62-5dd6be34a3e0)
520 ]
521 interface IDWriteFontFileStream : IUnknown
522 {
523     HRESULT ReadFileFragment(
524         void const **fragment_start,
525         UINT64 offset,
526         UINT64 fragment_size,
527         void **fragment_context);
528
529     void ReleaseFileFragment(void *fragment_context);
530     HRESULT GetFileSize(UINT64 *size);
531     HRESULT GetLastWriteTime(UINT64 *last_writetime);
532 }
533
534 [
535 local,
536 object,
537 uuid(727cad4e-d6af-4c9e-8a08-d695b11caa49)
538 ]
539 interface IDWriteFontFileLoader : IUnknown
540 {
541     HRESULT CreateStreamFromKey(
542         void const *key,
543         UINT32 key_size,
544         IDWriteFontFileStream **stream);
545 }
546
547 [
548 local,
549 object,
550 uuid(739d886a-cef5-47dc-8769-1a8b41bebbb0)
551 ]
552 interface IDWriteFontFile : IUnknown
553 {
554     HRESULT GetReferenceKey(
555         void const **key,
556         UINT32 *key_size);
557
558     HRESULT GetLoader(IDWriteFontFileLoader **loader);
559
560     HRESULT Analyze(
561         BOOL *is_supported_fonttype,
562         DWRITE_FONT_FILE_TYPE *file_type,
563         DWRITE_FONT_FACE_TYPE *face_type,
564         UINT32 *faces_num);
565 }
566
567 [
568 local,
569 object,
570 uuid(72755049-5ff7-435d-8348-4be97cfa6c7c)
571 ]
572 interface IDWriteFontFileEnumerator : IUnknown
573 {
574     HRESULT MoveNext(BOOL *has_current_file);
575     HRESULT GetCurrentFontFile(IDWriteFontFile **font_file);
576 };
577
578 [
579 local,
580 object,
581 uuid(cca920e4-52f0-492b-bfa8-29c72ee0a468)
582 ]
583 interface IDWriteFontCollectionLoader : IUnknown
584 {
585     HRESULT CreateEnumeratorFromKey(
586         IDWriteFactory* factory,
587         void const* key,
588         UINT32 key_size,
589         IDWriteFontFileEnumerator **enumerator);
590 }
591
592 [
593 local,
594 object,
595 uuid(08256209-099a-4b34-b86d-c22b110e7771)
596 ]
597 interface IDWriteLocalizedStrings : IUnknown
598 {
599     UINT32 GetCount();
600
601     HRESULT FindLocaleName(
602         WCHAR const *locale_name,
603         UINT32 *index,
604         BOOL *exists);
605
606     HRESULT GetLocaleNameLength(UINT32 index, UINT32 *length);
607     HRESULT GetLocaleName(UINT32 index, WCHAR *locale_name, UINT32 size);
608     HRESULT GetStringLength(UINT32 index, UINT32 *length);
609     HRESULT GetString(UINT32 index, WCHAR *buffer, UINT32 size);
610 }
611
612 [
613 local,
614 object,
615 uuid(2f0da53a-2add-47cd-82ee-d9ec34688e75)
616 ]
617 interface IDWriteRenderingParams : IUnknown
618 {
619     FLOAT GetGamma();
620     FLOAT GetEnhancedContrast();
621     FLOAT GetClearTypeLevel();
622     DWRITE_PIXEL_GEOMETRY GetPixelGeometry();
623     DWRITE_RENDERING_MODE GetRenderingMode();
624 }
625
626 [
627 local,
628 object,
629 uuid(5f49804d-7024-4d43-bfa9-d25984f53849)
630 ]
631 interface IDWriteFontFace : IUnknown
632 {
633     DWRITE_FONT_FACE_TYPE GetType();
634     HRESULT GetFiles(UINT32 *number_of_files, IDWriteFontFile **fontfiles);
635     UINT32 GetIndex();
636     DWRITE_FONT_SIMULATIONS GetSimulations();
637     BOOL IsSymbolFont();
638     void GetMetrics(DWRITE_FONT_METRICS *metrics);
639     UINT16 GetGlyphCount();
640
641     HRESULT GetDesignGlyphMetrics(
642         UINT16 const *glyph_indices,
643         UINT32 glyph_count,
644         DWRITE_GLYPH_METRICS *metrics,
645         [defaultvalue(FALSE)] BOOL is_sideways);
646
647     HRESULT GetGlyphIndices(
648         UINT32 const *codepoints,
649         UINT32 count,
650         UINT16 *glyph_indices);
651
652     HRESULT TryGetFontTable(
653         UINT32 table_tag,
654         const void **table_data,
655         UINT32 *table_size,
656         void **context,
657         BOOL *exists);
658
659     void ReleaseFontTable(void *table_context);
660
661     HRESULT GetGlyphRunOutline(
662         FLOAT emSize,
663         UINT16 const *glyph_indices,
664         FLOAT const* glyph_advances,
665         DWRITE_GLYPH_OFFSET const *glyph_offsets,
666         UINT32 glyph_count,
667         BOOL is_sideways,
668         BOOL is_rtl,
669         IDWriteGeometrySink *geometrysink);
670
671     HRESULT GetRecommendedRenderingMode(
672         FLOAT emSize,
673         FLOAT pixels_per_dip,
674         DWRITE_MEASURING_MODE mode,
675         IDWriteRenderingParams* params,
676         DWRITE_RENDERING_MODE* rendering_mode);
677
678     HRESULT GetGdiCompatibleMetrics(
679         FLOAT emSize,
680         FLOAT pixels_per_dip,
681         DWRITE_MATRIX const *transform,
682         DWRITE_FONT_METRICS *metrics);
683
684     HRESULT GetGdiCompatibleGlyphMetrics(
685         FLOAT emSize,
686         FLOAT pixels_per_dip,
687         DWRITE_MATRIX const *transform,
688         BOOL use_gdi_natural,
689         UINT16 const *glyph_indices,
690         UINT32 glyph_count,
691         DWRITE_GLYPH_METRICS *metrics,
692         [defaultvalue(FALSE)] BOOL is_sideways);
693 }
694
695 [
696 local,
697 object,
698 uuid(acd16696-8c14-4f5d-877e-fe3fc1d32737)
699 ]
700 interface IDWriteFont : IUnknown
701 {
702     HRESULT GetFontFamily(IDWriteFontFamily **family);
703     DWRITE_FONT_WEIGHT GetWeight();
704     DWRITE_FONT_STRETCH GetStretch();
705     DWRITE_FONT_STYLE GetStyle();
706     BOOL IsSymbolFont();
707
708     HRESULT GetFaceNames(IDWriteLocalizedStrings **names);
709     HRESULT GetInformationalStrings(
710         DWRITE_INFORMATIONAL_STRING_ID stringid,
711         IDWriteLocalizedStrings **strings,
712         BOOL *exists);
713
714     DWRITE_FONT_SIMULATIONS GetSimulations();
715     void GetMetrics(DWRITE_FONT_METRICS *metrics);
716     HRESULT HasCharacter(UINT32 value, BOOL *exists);
717     HRESULT CreateFontFace(IDWriteFontFace **face);
718 }
719
720 [
721 local,
722 object,
723 uuid(1a0d8438-1d97-4ec1-aef9-a2fb86ed6acb)
724 ]
725 interface IDWriteFontList : IUnknown
726 {
727     HRESULT GetFontCollection(IDWriteFontCollection **collection);
728     UINT32 GetFontCount();
729     HRESULT GetFont(UINT32 index, IDWriteFont **font);
730 }
731
732 [
733 local,
734 object,
735 uuid(da20d8ef-812a-4c43-9802-62ec4abd7add)
736 ]
737 interface IDWriteFontFamily : IDWriteFontList
738 {
739     HRESULT GetFamilyNames(IDWriteLocalizedStrings **names);
740
741     HRESULT GetFirstMatchingFont(
742         DWRITE_FONT_WEIGHT weight,
743         DWRITE_FONT_STRETCH stretch,
744         DWRITE_FONT_STYLE style,
745         IDWriteFont **font);
746
747     HRESULT GetMatchingFonts(
748         DWRITE_FONT_WEIGHT weight,
749         DWRITE_FONT_STRETCH stretch,
750         DWRITE_FONT_STYLE style,
751         IDWriteFontList **fonts);
752 }
753
754 [
755 local,
756 object,
757 uuid(a84cee02-3eea-4eee-a827-87c1a02a0fcc)
758 ]
759 interface IDWriteFontCollection : IUnknown
760 {
761     UINT32 GetFontFamilyCount();
762     HRESULT GetFontFamily(UINT32 index, IDWriteFontFamily **family);
763     HRESULT FindFamilyName(WCHAR const *name, UINT32 *index, BOOL *exists);
764     HRESULT GetFontFromFontFace(IDWriteFontFace *face, IDWriteFont **font);
765 }
766
767 [
768 local,
769 object,
770 uuid(eaf3a2da-ecf4-4d24-b644-b34f6842024b)
771 ]
772 interface IDWritePixelSnapping : IUnknown
773 {
774     HRESULT IsPixelSnappingDisabled(
775         void *client_drawingcontext,
776         BOOL *disabled);
777
778     HRESULT GetCurrentTransform(
779         void *client_drawingcontext,
780         DWRITE_MATRIX *transform);
781
782     HRESULT GetPixelsPerDip(
783         void *client_drawingcontext,
784         FLOAT *pixels_per_dip);
785 }
786
787 [
788 local,
789 object,
790 uuid(ef8a8135-5cc6-45fe-8825-c5a0724eb819)
791 ]
792 interface IDWriteTextRenderer : IDWritePixelSnapping
793 {
794     HRESULT DrawGlyphRun(
795         void* client_drawingcontext,
796         FLOAT baselineOriginX,
797         FLOAT baselineOriginY,
798         DWRITE_MEASURING_MODE mode,
799         DWRITE_GLYPH_RUN const *glyph_run,
800         DWRITE_GLYPH_RUN_DESCRIPTION const *run_descr,
801         IUnknown *drawing_effect);
802
803     HRESULT DrawUnderline(
804         void *client_drawingcontext,
805         FLOAT baselineOriginX,
806         FLOAT baselineOriginY,
807         DWRITE_UNDERLINE const* underline,
808         IUnknown *drawing_effect);
809
810     HRESULT DrawStrikethrough(
811         void *client_drawingcontext,
812         FLOAT baselineOriginX,
813         FLOAT baselineOriginY,
814         DWRITE_STRIKETHROUGH const* strikethrough,
815         IUnknown *drawing_effect);
816
817     HRESULT DrawInlineObject(
818         void *client_drawingcontext,
819         FLOAT originX,
820         FLOAT originY,
821         IDWriteInlineObject *object,
822         BOOL is_sideways,
823         BOOL is_rtl,
824         IUnknown *drawing_effect);
825 }
826
827 [
828 local,
829 object,
830 uuid(8339fde3-106f-47ab-8373-1c6295eb10b3)
831 ]
832 interface IDWriteInlineObject : IUnknown
833 {
834     HRESULT Draw(
835         void* client_drawingontext,
836         IDWriteTextRenderer* renderer,
837         FLOAT originX,
838         FLOAT originY,
839         BOOL is_sideways,
840         BOOL is_rtl,
841         IUnknown *drawing_effect);
842
843     HRESULT GetMetrics(DWRITE_INLINE_OBJECT_METRICS *metrics);
844     HRESULT GetOverhangMetrics(DWRITE_OVERHANG_METRICS *overhangs);
845     HRESULT GetBreakConditions(
846         DWRITE_BREAK_CONDITION* condition_before,
847         DWRITE_BREAK_CONDITION* condition_after);
848 }
849
850 [
851 local,
852 object,
853 uuid(9c906818-31d7-4fd3-a151-7c5e225db55a)
854 ]
855 interface IDWriteTextFormat : IUnknown
856 {
857     HRESULT SetTextAlignment(DWRITE_TEXT_ALIGNMENT alignment);
858     HRESULT SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT alignment);
859     HRESULT SetWordWrapping(DWRITE_WORD_WRAPPING wrapping);
860     HRESULT SetReadingDirection(DWRITE_READING_DIRECTION direction);
861     HRESULT SetFlowDirection(DWRITE_FLOW_DIRECTION direction);
862     HRESULT SetIncrementalTabStop(FLOAT tabstop);
863     HRESULT SetTrimming(DWRITE_TRIMMING const *trimming, IDWriteInlineObject *trimming_sign);
864     HRESULT SetLineSpacing(DWRITE_LINE_SPACING_METHOD spacing, FLOAT line_spacing, FLOAT baseline);
865     DWRITE_TEXT_ALIGNMENT GetTextAlignment();
866     DWRITE_PARAGRAPH_ALIGNMENT GetParagraphAlignment();
867     DWRITE_WORD_WRAPPING GetWordWrapping();
868     DWRITE_READING_DIRECTION GetReadingDirection();
869     DWRITE_FLOW_DIRECTION GetFlowDirection();
870     FLOAT GetIncrementalTabStop();
871     HRESULT GetTrimming(DWRITE_TRIMMING *options, IDWriteInlineObject **trimming_sign);
872
873     HRESULT GetLineSpacing(
874         DWRITE_LINE_SPACING_METHOD *method,
875         FLOAT *spacing,
876         FLOAT *baseline);
877
878     HRESULT GetFontCollection(IDWriteFontCollection **collection);
879     UINT32 GetFontFamilyNameLength();
880     HRESULT GetFontFamilyName(WCHAR *name, UINT32 size);
881     DWRITE_FONT_WEIGHT GetFontWeight();
882     DWRITE_FONT_STYLE GetFontStyle();
883     DWRITE_FONT_STRETCH GetFontStretch();
884     FLOAT GetFontSize();
885     UINT32 GetLocaleNameLength();
886     HRESULT GetLocaleName(WCHAR *name, UINT32 size);
887 }
888
889 [
890 local,
891 object,
892 uuid(55f1112b-1dc2-4b3c-9541-f46894ed85b6)
893 ]
894 interface IDWriteTypography : IUnknown
895 {
896     HRESULT AddFontFeature(DWRITE_FONT_FEATURE feature);
897     UINT32 GetFontFeatureCount();
898     HRESULT GetFontFeature(UINT32 index, DWRITE_FONT_FEATURE *feature);
899 }
900
901 [
902 local,
903 object,
904 uuid(5e5a32a3-8dff-4773-9ff6-0696eab77267)
905 ]
906 interface IDWriteBitmapRenderTarget : IUnknown
907 {
908     HRESULT DrawGlyphRun(
909         FLOAT baselineOriginX,
910         FLOAT baselineOriginY,
911         DWRITE_MEASURING_MODE measuring_mode,
912         DWRITE_GLYPH_RUN const* glyph_run,
913         IDWriteRenderingParams* params,
914         COLORREF textColor,
915         [defaultvalue(NULL)] RECT *blackbox_rect);
916
917     HDC GetMemoryDC();
918     FLOAT GetPixelsPerDip();
919     HRESULT SetPixelsPerDip(FLOAT pixels_per_dip);
920     HRESULT GetCurrentTransform(DWRITE_MATRIX *transform);
921     HRESULT SetCurrentTransform(DWRITE_MATRIX const *transform);
922     HRESULT GetSize(SIZE *size);
923     HRESULT Resize(UINT32 width, UINT32 height);
924 }
925
926 cpp_quote("#ifndef _WINGDI_")
927 /* already defined in wingdi.h but needed for WIDL */
928 #define LF_FACESIZE     32
929
930     typedef struct tagLOGFONTW
931     {
932         LONG   lfHeight;
933         LONG   lfWidth;
934         LONG   lfEscapement;
935         LONG   lfOrientation;
936         LONG   lfWeight;
937         BYTE   lfItalic;
938         BYTE   lfUnderline;
939         BYTE   lfStrikeOut;
940         BYTE   lfCharSet;
941         BYTE   lfOutPrecision;
942         BYTE   lfClipPrecision;
943         BYTE   lfQuality;
944         BYTE   lfPitchAndFamily;
945         WCHAR  lfFaceName[LF_FACESIZE];
946     } LOGFONTW, *PLOGFONTW, *LPLOGFONTW;
947 cpp_quote("#endif /* _WINGDI_ */")
948
949 [
950 local,
951 object,
952 uuid(1edd9491-9853-4299-898f-6432983b6f3a)
953 ]
954 interface IDWriteGdiInterop : IUnknown
955 {
956     HRESULT CreateFontFromLOGFONT(LOGFONTW const *logfont, IDWriteFont **font);
957     HRESULT ConvertFontToLOGFONT(
958         IDWriteFont* font,
959         LOGFONTW* logfont,
960         BOOL *is_systemfont);
961
962     HRESULT ConvertFontFaceToLOGFONT(IDWriteFontFace* font, LOGFONTW* logfont);
963     HRESULT CreateFontFaceFromHdc(HDC hdc, IDWriteFontFace **fontface);
964     HRESULT CreateBitmapRenderTarget(HDC hdc, UINT32 width, UINT32 height, IDWriteBitmapRenderTarget **target);
965 }
966
967 [
968 local,
969 object,
970 uuid(53737037-6d14-410b-9bfe-0b182bb70961)
971 ]
972 interface IDWriteTextLayout : IDWriteTextFormat
973 {
974     HRESULT SetMaxWidth(FLOAT maxWidth);
975     HRESULT SetMaxHeight(FLOAT maxHeight);
976     HRESULT SetFontCollection(IDWriteFontCollection* collection, DWRITE_TEXT_RANGE range);
977     HRESULT SetFontFamilyName(WCHAR const *name, DWRITE_TEXT_RANGE range);
978     HRESULT SetFontWeight(DWRITE_FONT_WEIGHT weight, DWRITE_TEXT_RANGE range);
979     HRESULT SetFontStyle(DWRITE_FONT_STYLE style, DWRITE_TEXT_RANGE range);
980     HRESULT SetFontStretch(DWRITE_FONT_STRETCH stretch, DWRITE_TEXT_RANGE range);
981     HRESULT SetFontSize(FLOAT size, DWRITE_TEXT_RANGE range);
982     HRESULT SetUnderline(BOOL underline, DWRITE_TEXT_RANGE range);
983     HRESULT SetStrikethrough(BOOL strikethrough, DWRITE_TEXT_RANGE range);
984     HRESULT SetDrawingEffect(IUnknown* effect, DWRITE_TEXT_RANGE range);
985     HRESULT SetInlineObject(IDWriteInlineObject *object, DWRITE_TEXT_RANGE range);
986     HRESULT SetTypography(IDWriteTypography* typography, DWRITE_TEXT_RANGE range);
987     HRESULT SetLocaleName(WCHAR const* locale, DWRITE_TEXT_RANGE range);
988
989     FLOAT GetMaxWidth();
990     FLOAT GetMaxHeight();
991     HRESULT GetFontCollection(
992         UINT32 pos,
993         IDWriteFontCollection** collection,
994         [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);
995
996     HRESULT GetFontFamilyNameLength(
997         UINT32 pos,
998         UINT32* len,
999         [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);
1000
1001     HRESULT GetFontFamilyName(
1002         UINT32 position,
1003         WCHAR* name,
1004         UINT32 name_size,
1005         [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);
1006
1007     HRESULT GetFontWeight(
1008         UINT32 position,
1009         DWRITE_FONT_WEIGHT *weight,
1010         [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);
1011
1012     HRESULT GetFontStyle(
1013         UINT32 currentPosition,
1014         DWRITE_FONT_STYLE *style,
1015         [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);
1016
1017     HRESULT GetFontStretch(
1018         UINT32 position,
1019         DWRITE_FONT_STRETCH *stretch,
1020         [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);
1021
1022     HRESULT GetFontSize(
1023         UINT32 position,
1024         FLOAT *size,
1025         [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);
1026
1027     HRESULT GetUnderline(
1028         UINT32 position,
1029         BOOL *has_underline,
1030         [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);
1031
1032     HRESULT GetStrikethrough(
1033         UINT32 position,
1034         BOOL *has_strikethrough,
1035         [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);
1036
1037     HRESULT GetDrawingEffect(
1038         UINT32 position,
1039         IUnknown **effect,
1040         [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);
1041
1042     HRESULT GetInlineObject(
1043         UINT32 position,
1044         IDWriteInlineObject **object,
1045         [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);
1046
1047     HRESULT GetTypography(
1048         UINT32 position,
1049         IDWriteTypography** typography,
1050         [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);
1051
1052     HRESULT GetLocaleNameLength(
1053         UINT32 position,
1054         UINT32* length,
1055         [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);
1056
1057     HRESULT GetLocaleName(
1058         UINT32 position,
1059         WCHAR* name,
1060         UINT32 name_size,
1061         [defaultvalue(NULL)] DWRITE_TEXT_RANGE *range);
1062
1063     HRESULT Draw(
1064         void *context,
1065         IDWriteTextRenderer* renderer,
1066         FLOAT originX,
1067         FLOAT originY);
1068
1069     HRESULT GetLineMetrics(
1070         DWRITE_LINE_METRICS *metrics,
1071         UINT32 max_count,
1072         UINT32 *actual_count);
1073
1074     HRESULT GetMetrics(DWRITE_TEXT_METRICS *metrics);
1075     HRESULT GetOverhangMetrics(DWRITE_OVERHANG_METRICS *overhangs);
1076     HRESULT GetClusterMetrics(
1077         DWRITE_CLUSTER_METRICS *metrics,
1078         UINT32 max_count,
1079         UINT32* act_count);
1080
1081     HRESULT DetermineMinWidth(FLOAT* min_width);
1082     HRESULT HitTestPoint(
1083         FLOAT pointX,
1084         FLOAT pointY,
1085         BOOL* is_trailinghit,
1086         BOOL* is_inside,
1087         DWRITE_HIT_TEST_METRICS *metrics);
1088
1089     HRESULT HitTestTextPosition(
1090         UINT32 textPosition,
1091         BOOL is_trailinghit,
1092         FLOAT* pointX,
1093         FLOAT* pointY,
1094         DWRITE_HIT_TEST_METRICS *metrics);
1095
1096     HRESULT HitTestTextRange(
1097         UINT32 textPosition,
1098         UINT32 textLength,
1099         FLOAT originX,
1100         FLOAT originY,
1101         DWRITE_HIT_TEST_METRICS *metrics,
1102         UINT32 max_metricscount,
1103         UINT32* actual_metricscount);
1104 }
1105
1106 [
1107 local,
1108 object,
1109 uuid(14885cc9-bab0-4f90-b6ed-5c366a2cd03d)
1110 ]
1111 interface IDWriteNumberSubstitution : IUnknown
1112 {
1113 }
1114
1115 [
1116 local,
1117 object,
1118 uuid(688e1a58-5094-47c8-adc8-fbcea60ae92b)
1119 ]
1120 interface IDWriteTextAnalysisSource : IUnknown
1121 {
1122     HRESULT GetTextAtPosition(
1123         UINT32 position,
1124         WCHAR const** text,
1125         UINT32* text_len);
1126
1127     HRESULT GetTextBeforePosition(
1128         UINT32 position,
1129         WCHAR const** text,
1130         UINT32* text_len);
1131
1132     DWRITE_READING_DIRECTION GetParagraphReadingDirection();
1133     HRESULT GetLocaleName(
1134         UINT32 position,
1135         UINT32* text_len,
1136         WCHAR const** locale);
1137
1138     HRESULT GetNumberSubstitution(
1139         UINT32 position,
1140         UINT32* text_len,
1141         IDWriteNumberSubstitution **substitution);
1142 }
1143
1144 [
1145 local,
1146 object,
1147 uuid(5810cd44-0ca0-4701-b3fa-bec5182ae4f6)
1148 ]
1149 interface IDWriteTextAnalysisSink : IUnknown
1150 {
1151     HRESULT SetScriptAnalysis(
1152         UINT32 position,
1153         UINT32 length,
1154         DWRITE_SCRIPT_ANALYSIS const* scriptanalysis);
1155
1156     HRESULT SetLineBreakpoints(
1157         UINT32 position,
1158         UINT32 length,
1159         DWRITE_LINE_BREAKPOINT const* breakpoints);
1160
1161     HRESULT SetBidiLevel(
1162         UINT32 position,
1163         UINT32 length,
1164         UINT8 explicitLevel,
1165         UINT8 resolvedLevel);
1166
1167     HRESULT SetNumberSubstitution(
1168         UINT32 position,
1169         UINT32 length,
1170         IDWriteNumberSubstitution* substitution);
1171 }
1172
1173 [
1174 local,
1175 object,
1176 uuid(b7e6163e-7f46-43b4-84b3-e4e6249c365d)
1177 ]
1178 interface IDWriteTextAnalyzer : IUnknown
1179 {
1180     HRESULT AnalyzeScript(
1181         IDWriteTextAnalysisSource* source,
1182         UINT32 position,
1183         UINT32 length,
1184         IDWriteTextAnalysisSink* sink);
1185
1186     HRESULT AnalyzeBidi(
1187         IDWriteTextAnalysisSource* source,
1188         UINT32 position,
1189         UINT32 length,
1190         IDWriteTextAnalysisSink* sink);
1191
1192     HRESULT AnalyzeNumberSubstitution(
1193         IDWriteTextAnalysisSource* source,
1194         UINT32 position,
1195         UINT32 length,
1196         IDWriteTextAnalysisSink* sink);
1197
1198     HRESULT AnalyzeLineBreakpoints(
1199         IDWriteTextAnalysisSource* source,
1200         UINT32 position,
1201         UINT32 length,
1202         IDWriteTextAnalysisSink* sink);
1203
1204     HRESULT GetGlyphs(
1205         WCHAR const* text,
1206         UINT32 length,
1207         IDWriteFontFace* font_face,
1208         BOOL is_sideways,
1209         BOOL is_rtl,
1210         DWRITE_SCRIPT_ANALYSIS const* analysis,
1211         WCHAR const* locale,
1212         IDWriteNumberSubstitution* substitution,
1213         DWRITE_TYPOGRAPHIC_FEATURES const** features,
1214         UINT32 const* feature_range_len,
1215         UINT32 feature_ranges,
1216         UINT32 max_glyph_count,
1217         UINT16* clustermap,
1218         DWRITE_SHAPING_TEXT_PROPERTIES* text_props,
1219         UINT16* glyph_indices,
1220         DWRITE_SHAPING_GLYPH_PROPERTIES* glyph_props,
1221         UINT32* actual_glyph_count);
1222
1223     HRESULT GetGlyphPlacements(
1224         WCHAR const* text,
1225         UINT16 const* clustermap,
1226         DWRITE_SHAPING_TEXT_PROPERTIES* props,
1227         UINT32 text_len,
1228         UINT16 const* glyph_indices,
1229         DWRITE_SHAPING_GLYPH_PROPERTIES const* glyph_props,
1230         UINT32 glyph_count,
1231         IDWriteFontFace * font_face,
1232         FLOAT fontEmSize,
1233         BOOL is_sideways,
1234         BOOL is_rtl,
1235         DWRITE_SCRIPT_ANALYSIS const* analysis,
1236         WCHAR const* locale,
1237         DWRITE_TYPOGRAPHIC_FEATURES const** features,
1238         UINT32 const* feature_range_len,
1239         UINT32 feature_ranges,
1240         FLOAT* glyph_advances,
1241         DWRITE_GLYPH_OFFSET* glyph_offsets);
1242
1243     HRESULT GetGdiCompatibleGlyphPlacements(
1244         WCHAR const* text,
1245         UINT16 const* clustermap,
1246         DWRITE_SHAPING_TEXT_PROPERTIES* props,
1247         UINT32 text_len,
1248         UINT16 const* glyph_indices,
1249         DWRITE_SHAPING_GLYPH_PROPERTIES const* glyph_props,
1250         UINT32 glyph_count,
1251         IDWriteFontFace * font_face,
1252         FLOAT fontEmSize,
1253         FLOAT pixels_per_dip,
1254         DWRITE_MATRIX const* transform,
1255         BOOL use_gdi_natural,
1256         BOOL is_sideways,
1257         BOOL is_rtl,
1258         DWRITE_SCRIPT_ANALYSIS const* analysis,
1259         WCHAR const* locale,
1260         DWRITE_TYPOGRAPHIC_FEATURES const** features,
1261         UINT32 const* feature_range_lengths,
1262         UINT32 feature_ranges,
1263         FLOAT* glyph_advances,
1264         DWRITE_GLYPH_OFFSET* glyph_offsets);
1265 }
1266
1267 [
1268 local,
1269 object,
1270 uuid(7d97dbf7-e085-42d4-81e3-6a883bded118)
1271 ]
1272 interface IDWriteGlyphRunAnalysis : IUnknown
1273 {
1274     HRESULT GetAlphaTextureBounds(DWRITE_TEXTURE_TYPE type, RECT* bounds);
1275     HRESULT CreateAlphaTexture(DWRITE_TEXTURE_TYPE type, RECT const* bounds, BYTE* alphaValues, UINT32 bufferSize);
1276     HRESULT GetAlphaBlendParams(
1277         IDWriteRenderingParams* renderingParams,
1278         FLOAT* blendGamma,
1279         FLOAT* blendEnhancedContrast,
1280         FLOAT* blendClearTypeLevel);
1281 }
1282
1283 [
1284 local,
1285 object,
1286 uuid(b859ee5a-d838-4b5b-a2e8-1adc7d93db48)
1287 ]
1288 interface IDWriteFactory : IUnknown
1289 {
1290     HRESULT GetSystemFontCollection(IDWriteFontCollection **collection,
1291                                     [defaultvalue(FALSE)] BOOL check_for_updates);
1292
1293     HRESULT CreateCustomFontCollection(
1294         IDWriteFontCollectionLoader *loader,
1295         void const *key,
1296         UINT32 key_size,
1297         IDWriteFontCollection **collection);
1298
1299     HRESULT RegisterFontCollectionLoader(IDWriteFontCollectionLoader *loader);
1300
1301     HRESULT UnregisterFontCollectionLoader(IDWriteFontCollectionLoader *loader);
1302
1303     HRESULT CreateFontFileReference(
1304         WCHAR const *path,
1305         FILETIME const *writetime,
1306         IDWriteFontFile **font_file);
1307
1308     HRESULT CreateCustomFontFileReference(
1309         void const *reference_key,
1310         UINT32 key_size,
1311         IDWriteFontFileLoader *loader,
1312         IDWriteFontFile **font_file);
1313
1314     HRESULT CreateFontFace(
1315         DWRITE_FONT_FACE_TYPE facetype,
1316         UINT32 files_number,
1317         IDWriteFontFile* const* font_files,
1318         UINT32 index,
1319         DWRITE_FONT_SIMULATIONS sim_flags,
1320         IDWriteFontFace **font_face);
1321
1322     HRESULT CreateRenderingParams(IDWriteRenderingParams **params);
1323
1324     HRESULT CreateMonitorRenderingParams(
1325         HMONITOR monitor,
1326         IDWriteRenderingParams **params);
1327
1328     HRESULT CreateCustomRenderingParams(
1329         FLOAT gamma,
1330         FLOAT enhancedContrast,
1331         FLOAT cleartype_level,
1332         DWRITE_PIXEL_GEOMETRY geometry,
1333         DWRITE_RENDERING_MODE mode,
1334         IDWriteRenderingParams **params);
1335
1336     HRESULT RegisterFontFileLoader(IDWriteFontFileLoader *loader);
1337
1338     HRESULT UnregisterFontFileLoader(IDWriteFontFileLoader *loader);
1339
1340     HRESULT CreateTextFormat(
1341         WCHAR const* family_name,
1342         IDWriteFontCollection *collection,
1343         DWRITE_FONT_WEIGHT weight,
1344         DWRITE_FONT_STYLE style,
1345         DWRITE_FONT_STRETCH stretch,
1346         FLOAT size,
1347         WCHAR const *locale,
1348         IDWriteTextFormat **format);
1349
1350     HRESULT CreateTypography(IDWriteTypography **typography);
1351
1352     HRESULT GetGdiInterop(IDWriteGdiInterop **gdi_interop);
1353
1354     HRESULT CreateTextLayout(
1355         WCHAR const* string,
1356         UINT32 len,
1357         IDWriteTextFormat *format,
1358         FLOAT max_width,
1359         FLOAT max_height,
1360         IDWriteTextLayout **layout);
1361
1362     HRESULT CreateGdiCompatibleTextLayout(
1363         WCHAR const* string,
1364         UINT32 len,
1365         IDWriteTextFormat *format,
1366         FLOAT layout_width,
1367         FLOAT layout_height,
1368         FLOAT pixels_per_dip,
1369         DWRITE_MATRIX const* transform,
1370         BOOL use_gdi_natural,
1371         IDWriteTextLayout **layout);
1372
1373     HRESULT CreateEllipsisTrimmingSign(
1374         IDWriteTextFormat *format,
1375         IDWriteInlineObject **trimming_sign);
1376
1377     HRESULT CreateTextAnalyzer(IDWriteTextAnalyzer **analyzer);
1378
1379     HRESULT CreateNumberSubstitution(
1380         DWRITE_NUMBER_SUBSTITUTION_METHOD method,
1381         WCHAR const* locale,
1382         BOOL ignore_user_override,
1383         IDWriteNumberSubstitution **substitution);
1384
1385     HRESULT CreateGlyphRunAnalysis(
1386         DWRITE_GLYPH_RUN const *glyph_run,
1387         FLOAT pixels_per_dip,
1388         DWRITE_MATRIX const* transform,
1389         DWRITE_RENDERING_MODE rendering_mode,
1390         DWRITE_MEASURING_MODE measuring_mode,
1391         FLOAT baseline_x,
1392         FLOAT baseline_y,
1393         IDWriteGlyphRunAnalysis **analysis);
1394 }
1395
1396 cpp_quote("HRESULT WINAPI DWriteCreateFactory(DWRITE_FACTORY_TYPE,REFIID,IUnknown**);")
1397
1398 /* error codes */
1399 cpp_quote("#define FACILITY_DWRITE 0x898")
1400 cpp_quote("#define DWRITE_ERR_BASE 0x5000")
1401 cpp_quote("#define MAKE_DWRITE_HR(severity, code) MAKE_HRESULT(severity, FACILITY_DWRITE, (DWRITE_ERR_BASE + code))")
1402 cpp_quote("#define MAKE_DWRITE_HR_ERR(code) MAKE_DWRITE_HR(SEVERITY_ERROR, code)")
1403
1404 cpp_quote("#define DWRITE_E_FILEFORMAT              MAKE_DWRITE_HR_ERR(0x0)")
1405 cpp_quote("#define DWRITE_E_UNEXPECTED              MAKE_DWRITE_HR_ERR(0x1)")
1406 cpp_quote("#define DWRITE_E_NOFONT                  MAKE_DWRITE_HR_ERR(0x2)")
1407 cpp_quote("#define DWRITE_E_FILENOTFOUND            MAKE_DWRITE_HR_ERR(0x3)")
1408 cpp_quote("#define DWRITE_E_FILEACCESS              MAKE_DWRITE_HR_ERR(0x4)")
1409 cpp_quote("#define DWRITE_E_FONTCOLLECTIONOBSOLETE  MAKE_DWRITE_HR_ERR(0x5)")
1410 cpp_quote("#define DWRITE_E_ALREADYREGISTERED       MAKE_DWRITE_HR_ERR(0x6)")