]>
Commit | Line | Data |
---|---|---|
ff7c6d11 XL |
1 | // Licensed under the Apache License, Version 2.0 |
2 | // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
3 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. | |
4 | // All files in the project carrying such notice may not be copied, modified, or distributed | |
5 | // except according to those terms. | |
6 | //! Mappings for the content of dwrite_2.h | |
7 | use ctypes::{c_void, wchar_t}; | |
8 | use shared::basetsd::{UINT16, UINT32, UINT8}; | |
9 | use shared::d3d9types::D3DCOLORVALUE; | |
10 | use shared::minwindef::{BOOL, FLOAT}; | |
11 | use um::dcommon::DWRITE_MEASURING_MODE; | |
12 | use um::dwrite::{ | |
13 | DWRITE_FONT_FEATURE_TAG, DWRITE_FONT_STRETCH, DWRITE_FONT_STYLE, DWRITE_FONT_WEIGHT, | |
14 | DWRITE_GLYPH_RUN, DWRITE_GLYPH_RUN_DESCRIPTION, DWRITE_MATRIX, DWRITE_PIXEL_GEOMETRY, | |
15 | DWRITE_RENDERING_MODE, DWRITE_SCRIPT_ANALYSIS, DWRITE_STRIKETHROUGH, DWRITE_UNDERLINE, | |
16 | IDWriteFont, IDWriteFontCollection, IDWriteFontFace, IDWriteGlyphRunAnalysis, | |
17 | IDWriteInlineObject, IDWriteRenderingParams, IDWriteTextAnalysisSource, IDWriteTextFormat, | |
18 | IDWriteTextFormatVtbl, IDWriteTextRenderer, IDWriteTextRendererVtbl, | |
19 | }; | |
20 | use um::dwrite_1::{ | |
21 | DWRITE_GLYPH_ORIENTATION_ANGLE, DWRITE_OUTLINE_THRESHOLD, DWRITE_TEXT_ANTIALIAS_MODE, | |
22 | DWRITE_UNICODE_RANGE, DWRITE_VERTICAL_GLYPH_ORIENTATION, IDWriteFactory1, | |
23 | IDWriteFactory1Vtbl, IDWriteFont1, IDWriteFont1Vtbl, IDWriteFontFace1, IDWriteFontFace1Vtbl, | |
24 | IDWriteRenderingParams1, IDWriteRenderingParams1Vtbl, IDWriteTextAnalyzer1, | |
25 | IDWriteTextAnalyzer1Vtbl, IDWriteTextLayout1, IDWriteTextLayout1Vtbl, | |
26 | }; | |
27 | use um::unknwnbase::{IUnknown, IUnknownVtbl}; | |
28 | use um::winnt::{HRESULT, WCHAR}; | |
29 | ENUM!{enum DWRITE_OPTICAL_ALIGNMENT { | |
30 | DWRITE_OPTICAL_ALIGNMENT_NONE = 0x0, // 0 | |
31 | DWRITE_OPTICAL_ALIGNMENT_NO_SIDE_BEARINGS = 0x1, // 1 | |
32 | }} | |
33 | ENUM!{enum DWRITE_GRID_FIT_MODE { | |
34 | DWRITE_GRID_FIT_MODE_DEFAULT = 0x0, // 0 | |
35 | DWRITE_GRID_FIT_MODE_DISABLED = 0x1, // 1 | |
36 | DWRITE_GRID_FIT_MODE_ENABLED = 0x2, // 2 | |
37 | }} | |
38 | STRUCT!{struct DWRITE_TEXT_METRICS1 { | |
39 | left: FLOAT, | |
40 | top: FLOAT, | |
41 | width: FLOAT, | |
42 | widthIncludingTrailingWhitespace: FLOAT, | |
43 | height: FLOAT, | |
44 | layoutWidth: FLOAT, | |
45 | layoutHeight: FLOAT, | |
46 | maxBidiReorderingDepth: UINT32, | |
47 | lineCount: UINT32, | |
48 | heightIncludingTrailingWhitespace: FLOAT, | |
49 | }} | |
50 | RIDL!{#[uuid(0xd3e0e934, 0x22a0, 0x427e, 0xaa, 0xe4, 0x7d, 0x95, 0x74, 0xb5, 0x9d, 0xb1)] | |
51 | interface IDWriteTextRenderer1(IDWriteTextRenderer1Vtbl): | |
52 | IDWriteTextRenderer(IDWriteTextRendererVtbl) { | |
53 | fn DrawGlyphRun( | |
54 | clientDrawingContext: *mut c_void, | |
55 | baselineOriginX: FLOAT, | |
56 | baselineOriginY: FLOAT, | |
57 | orientationAngle: DWRITE_GLYPH_ORIENTATION_ANGLE, | |
58 | measuringMode: DWRITE_MEASURING_MODE, | |
59 | glyphRun: *const DWRITE_GLYPH_RUN, | |
60 | glyphRunDescription: *const DWRITE_GLYPH_RUN_DESCRIPTION, | |
61 | clientDrawingEffect: *mut IUnknown, | |
62 | ) -> HRESULT, | |
63 | fn DrawUnderline( | |
64 | clientDrawingContext: *mut c_void, | |
65 | baselineOriginX: FLOAT, | |
66 | baselineOriginY: FLOAT, | |
67 | orientationAngle: DWRITE_GLYPH_ORIENTATION_ANGLE, | |
68 | underline: *const DWRITE_UNDERLINE, | |
69 | clientDrawingEffect: *mut IUnknown, | |
70 | ) -> HRESULT, | |
71 | fn DrawStrikethrough( | |
72 | clientDrawingContext: *mut c_void, | |
73 | baselineOriginX: FLOAT, | |
74 | baselineOriginY: FLOAT, | |
75 | orientationAngle: DWRITE_GLYPH_ORIENTATION_ANGLE, | |
76 | strikethrough: *const DWRITE_STRIKETHROUGH, | |
77 | clientDrawingEffect: *mut IUnknown, | |
78 | ) -> HRESULT, | |
79 | fn DrawInlineObject( | |
80 | clientDrawingContext: *mut c_void, | |
81 | originX: FLOAT, | |
82 | originY: FLOAT, | |
83 | orientationAngle: DWRITE_GLYPH_ORIENTATION_ANGLE, | |
84 | inlineObject: *mut IDWriteInlineObject, | |
85 | isSideways: BOOL, | |
86 | isRightToLeft: BOOL, | |
87 | clientDrawingEffect: *mut IUnknown, | |
88 | ) -> HRESULT, | |
89 | }} | |
90 | RIDL!{#[uuid(0x5f174b49, 0x0d8b, 0x4cfb, 0x8b, 0xca, 0xf1, 0xcc, 0xe9, 0xd0, 0x6c, 0x67)] | |
91 | interface IDWriteTextFormat1(IDWriteTextFormat1Vtbl): | |
92 | IDWriteTextFormat(IDWriteTextFormatVtbl) { | |
93 | fn SetVerticalGlyphOrientation( | |
94 | glyphOrientation: DWRITE_VERTICAL_GLYPH_ORIENTATION, | |
95 | ) -> HRESULT, | |
96 | fn GetVerticalGlyphOrientation() -> DWRITE_VERTICAL_GLYPH_ORIENTATION, | |
97 | fn SetLastLineWrapping( | |
98 | isLastLineWrappingEnabled: BOOL, | |
99 | ) -> HRESULT, | |
100 | fn GetLastLineWrapping() -> BOOL, | |
101 | fn SetOpticalAlignment( | |
102 | opticalAlignment: DWRITE_OPTICAL_ALIGNMENT, | |
103 | ) -> HRESULT, | |
104 | fn GetOpticalAlignment() -> DWRITE_OPTICAL_ALIGNMENT, | |
105 | fn SetFontFallback( | |
106 | fontFallback: *mut IDWriteFontFallback, | |
107 | ) -> HRESULT, | |
108 | fn GetFontFallback( | |
109 | fontFallback: *mut *mut IDWriteFontFallback, | |
110 | ) -> HRESULT, | |
111 | }} | |
112 | RIDL!{#[uuid(0x1093c18f, 0x8d5e, 0x43f0, 0xb0, 0x64, 0x09, 0x17, 0x31, 0x1b, 0x52, 0x5e)] | |
113 | interface IDWriteTextLayout2(IDWriteTextLayout2Vtbl): | |
114 | IDWriteTextLayout1(IDWriteTextLayout1Vtbl) { | |
115 | fn GetMetrics( | |
116 | textMetrics: *mut DWRITE_TEXT_METRICS1, | |
117 | ) -> HRESULT, | |
118 | fn SetVerticalGlyphOrientation( | |
119 | glyphOrientation: DWRITE_VERTICAL_GLYPH_ORIENTATION, | |
120 | ) -> HRESULT, | |
121 | fn GetVerticalGlyphOrientation() -> DWRITE_VERTICAL_GLYPH_ORIENTATION, | |
122 | fn SetLastLineWrapping( | |
123 | isLastLineWrappingEnabled: BOOL, | |
124 | ) -> HRESULT, | |
125 | fn GetLastLineWrapping() -> BOOL, | |
126 | fn SetOpticalAlignment( | |
127 | opticalAlignment: DWRITE_OPTICAL_ALIGNMENT, | |
128 | ) -> HRESULT, | |
129 | fn GetOpticalAlignment() -> DWRITE_OPTICAL_ALIGNMENT, | |
130 | fn SetFontFallback( | |
131 | fontFallback: *mut IDWriteFontFallback, | |
132 | ) -> HRESULT, | |
133 | fn GetFontFallback( | |
134 | fontFallback: *mut *mut IDWriteFontFallback, | |
135 | ) -> HRESULT, | |
136 | }} | |
137 | RIDL!{#[uuid(0x553a9ff3, 0x5693, 0x4df7, 0xb5, 0x2b, 0x74, 0x80, 0x6f, 0x7f, 0x2e, 0xb9)] | |
138 | interface IDWriteTextAnalyzer2(IDWriteTextAnalyzer2Vtbl): | |
139 | IDWriteTextAnalyzer1(IDWriteTextAnalyzer1Vtbl) { | |
140 | fn GetGlyphOrientationTransform( | |
141 | glyphOrientationAngle: DWRITE_GLYPH_ORIENTATION_ANGLE, | |
142 | isSideways: BOOL, | |
143 | originX: FLOAT, | |
144 | originY: FLOAT, | |
145 | transform: *mut DWRITE_MATRIX, | |
146 | ) -> HRESULT, | |
147 | fn GetTypographicFeatures( | |
148 | fontFace: *mut IDWriteFontFace, | |
149 | scriptAnalysis: DWRITE_SCRIPT_ANALYSIS, | |
150 | localeName: *const WCHAR, | |
151 | maxTagCount: UINT32, | |
152 | actualTagCount: *mut UINT32, | |
153 | tags: *mut DWRITE_FONT_FEATURE_TAG, | |
154 | ) -> HRESULT, | |
155 | fn CheckTypographicFeature( | |
156 | fontFace: *mut IDWriteFontFace, | |
157 | scriptAnalysis: DWRITE_SCRIPT_ANALYSIS, | |
158 | localeName: *const WCHAR, | |
159 | featureTag: DWRITE_FONT_FEATURE_TAG, | |
160 | glyphCount: UINT32, | |
161 | glyphIndices: *const UINT16, | |
162 | featureApplies: *mut UINT8, | |
163 | ) -> HRESULT, | |
164 | }} | |
165 | RIDL!{#[uuid(0xefa008f9, 0xf7a1, 0x48bf, 0xb0, 0x5c, 0xf2, 0x24, 0x71, 0x3c, 0xc0, 0xff)] | |
166 | interface IDWriteFontFallback(IDWriteFontFallbackVtbl): IUnknown(IUnknownVtbl) { | |
167 | fn MapCharacters( | |
168 | analysisSource: *mut IDWriteTextAnalysisSource, | |
169 | textPosition: UINT32, | |
170 | textLength: UINT32, | |
171 | baseFontCollection: *mut IDWriteFontCollection, | |
172 | baseFamilyName: *mut wchar_t, | |
173 | baseWeight: DWRITE_FONT_WEIGHT, | |
174 | baseStyle: DWRITE_FONT_STYLE, | |
175 | baseStretch: DWRITE_FONT_STRETCH, | |
176 | mappedLength: *mut UINT32, | |
177 | mappedFont: *mut *mut IDWriteFont, | |
178 | scale: *mut FLOAT, | |
179 | ) -> HRESULT, | |
180 | }} | |
181 | RIDL!{#[uuid(0xfd882d06, 0x8aba, 0x4fb8, 0xb8, 0x49, 0x8b, 0xe8, 0xb7, 0x3e, 0x14, 0xde)] | |
182 | interface IDWriteFontFallbackBuilder(IDWriteFontFallbackBuilderVtbl): | |
183 | IUnknown(IUnknownVtbl) { | |
184 | fn AddMapping( | |
185 | ranges: *const DWRITE_UNICODE_RANGE, | |
186 | rangesCount: UINT32, | |
187 | targetFamilyNames: *mut *const WCHAR, | |
188 | targetFamilyNamesCount: UINT32, | |
189 | fontCollection: *mut IDWriteFontCollection, | |
190 | localeName: *const WCHAR, | |
191 | baseFamilyName: *const WCHAR, | |
192 | scale: FLOAT, | |
193 | ) -> HRESULT, | |
194 | fn AddMappings( | |
195 | fontFallback: *mut IDWriteFontFallback, | |
196 | ) -> HRESULT, | |
197 | fn CreateFontFallback( | |
198 | fontFallback: *mut *mut IDWriteFontFallback, | |
199 | ) -> HRESULT, | |
200 | }} | |
201 | pub type DWRITE_COLOR_F = D3DCOLORVALUE; | |
202 | RIDL!{#[uuid(0x29748ed6, 0x8c9c, 0x4a6a, 0xbe, 0x0b, 0xd9, 0x12, 0xe8, 0x53, 0x89, 0x44)] | |
203 | interface IDWriteFont2(IDWriteFont2Vtbl): IDWriteFont1(IDWriteFont1Vtbl) { | |
204 | fn IsColorFont() -> BOOL, | |
205 | }} | |
206 | RIDL!{#[uuid(0xd8b768ff, 0x64bc, 0x4e66, 0x98, 0x2b, 0xec, 0x8e, 0x87, 0xf6, 0x93, 0xf7)] | |
207 | interface IDWriteFontFace2(IDWriteFontFace2Vtbl): | |
208 | IDWriteFontFace1(IDWriteFontFace1Vtbl) { | |
209 | fn IsColorFont() -> BOOL, | |
210 | fn GetColorPaletteCount() -> UINT32, | |
211 | fn GetPaletteEntryCount() -> UINT32, | |
212 | fn GetPaletteEntries( | |
213 | colorPaletteIndex: UINT32, | |
214 | firstEntryIndex: UINT32, | |
215 | entryCount: UINT32, | |
216 | paletteEntries: *mut DWRITE_COLOR_F, | |
217 | ) -> HRESULT, | |
218 | fn GetRecommendedRenderingMode( | |
219 | fontEmSize: FLOAT, | |
220 | dpiX: FLOAT, | |
221 | dpiY: FLOAT, | |
222 | transform: *const DWRITE_MATRIX, | |
223 | isSideways: BOOL, | |
224 | outlineThreshold: DWRITE_OUTLINE_THRESHOLD, | |
225 | measuringMode: DWRITE_MEASURING_MODE, | |
226 | renderingParams: *mut IDWriteRenderingParams, | |
227 | renderingMode: *mut DWRITE_RENDERING_MODE, | |
228 | gridFitMode: *mut DWRITE_GRID_FIT_MODE, | |
229 | ) -> HRESULT, | |
230 | }} | |
231 | STRUCT!{struct DWRITE_COLOR_GLYPH_RUN { | |
232 | glyphRun: DWRITE_GLYPH_RUN, | |
233 | glyphRunDescription: *mut DWRITE_GLYPH_RUN_DESCRIPTION, | |
234 | baselineOriginX: FLOAT, | |
235 | baselineOriginY: FLOAT, | |
236 | runColor: DWRITE_COLOR_F, | |
237 | paletteIndex: UINT16, | |
238 | }} | |
239 | RIDL!{#[uuid(0xd31fbe17, 0xf157, 0x41a2, 0x8d, 0x24, 0xcb, 0x77, 0x9e, 0x05, 0x60, 0xe8)] | |
240 | interface IDWriteColorGlyphRunEnumerator(IDWriteColorGlyphRunEnumeratorVtbl): | |
241 | IUnknown(IUnknownVtbl) { | |
242 | fn MoveNext( | |
243 | hasRun: *mut BOOL, | |
244 | ) -> HRESULT, | |
245 | fn GetCurrentRun( | |
246 | colorGlyphRun: *mut *const DWRITE_COLOR_GLYPH_RUN, | |
247 | ) -> HRESULT, | |
248 | }} | |
249 | RIDL!{#[uuid(0xf9d711c3, 0x9777, 0x40ae, 0x87, 0xe8, 0x3e, 0x5a, 0xf9, 0xbf, 0x09, 0x48)] | |
250 | interface IDWriteRenderingParams2(IDWriteRenderingParams2Vtbl): | |
251 | IDWriteRenderingParams1(IDWriteRenderingParams1Vtbl) { | |
252 | fn GetGridFitMode() -> DWRITE_GRID_FIT_MODE, | |
253 | }} | |
254 | RIDL!{#[uuid(0x0439fc60, 0xca44, 0x4994, 0x8d, 0xee, 0x3a, 0x9a, 0xf7, 0xb7, 0x32, 0xec)] | |
255 | interface IDWriteFactory2(IDWriteFactory2Vtbl): IDWriteFactory1(IDWriteFactory1Vtbl) { | |
256 | fn GetSystemFontFallback( | |
257 | fontFallback: *mut *mut IDWriteFontFallback, | |
258 | ) -> HRESULT, | |
259 | fn CreateFontFallbackBuilder( | |
260 | fontFallbackBuilder: *mut *mut IDWriteFontFallbackBuilder, | |
261 | ) -> HRESULT, | |
262 | fn TranslateColorGlyphRun( | |
263 | baselineOriginX: FLOAT, | |
264 | baselineOriginY: FLOAT, | |
265 | glyphRun: *const DWRITE_GLYPH_RUN, | |
266 | glyphRunDescription: *const DWRITE_GLYPH_RUN_DESCRIPTION, | |
267 | measuringMode: DWRITE_MEASURING_MODE, | |
268 | worldToDeviceTransform: *const DWRITE_MATRIX, | |
269 | colorPaletteIndex: UINT32, | |
270 | colorLayers: *mut *mut IDWriteColorGlyphRunEnumerator, | |
271 | ) -> HRESULT, | |
272 | fn CreateCustomRenderingParams( | |
273 | gamma: FLOAT, | |
274 | enhancedContrast: FLOAT, | |
275 | grayscaleEnhancedContrast: FLOAT, | |
276 | clearTypeLevel: FLOAT, | |
277 | pixelGeometry: DWRITE_PIXEL_GEOMETRY, | |
278 | renderingMode: DWRITE_RENDERING_MODE, | |
279 | gridFitMode: DWRITE_GRID_FIT_MODE, | |
280 | renderingParams: *mut *mut IDWriteRenderingParams2, | |
281 | ) -> HRESULT, | |
282 | fn CreateGlyphRunAnalysis( | |
283 | glyphRun: *const DWRITE_GLYPH_RUN, | |
284 | transform: *const DWRITE_MATRIX, | |
285 | renderingMode: DWRITE_RENDERING_MODE, | |
286 | measuringMode: DWRITE_MEASURING_MODE, | |
287 | gridFitMode: DWRITE_GRID_FIT_MODE, | |
288 | antialiasMode: DWRITE_TEXT_ANTIALIAS_MODE, | |
289 | baselineOriginX: FLOAT, | |
290 | baselineOriginY: FLOAT, | |
291 | glyphRunAnalysis: *mut *mut IDWriteGlyphRunAnalysis, | |
292 | ) -> HRESULT, | |
293 | }} |