2 * Copyright 2012 Nikolay Sivov for CodeWeavers
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.
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.
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
22 #include "wine/debug.h"
23 #include "wine/heap.h"
24 #include "wine/list.h"
25 #include "wine/unicode.h"
27 static const DWRITE_MATRIX identity
=
34 static inline LPWSTR
heap_strdupW(const WCHAR
*str
)
41 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
42 ret
= heap_alloc(size
);
44 memcpy(ret
, str
, size
);
50 static inline LPWSTR
heap_strdupnW(const WCHAR
*str
, UINT32 len
)
56 ret
= heap_alloc((len
+1)*sizeof(WCHAR
));
59 memcpy(ret
, str
, len
*sizeof(WCHAR
));
67 static inline const char *debugstr_range(const DWRITE_TEXT_RANGE
*range
)
69 return wine_dbg_sprintf("%u:%u", range
->startPosition
, range
->length
);
72 static inline const char *debugstr_matrix(const DWRITE_MATRIX
*m
)
74 if (!m
) return "(null)";
75 return wine_dbg_sprintf("{%.2f,%.2f,%.2f,%.2f,%.2f,%.2f}", m
->m11
, m
->m12
, m
->m21
, m
->m22
,
79 static inline BOOL
dwrite_array_reserve(void **elements
, size_t *capacity
, size_t count
, size_t size
)
81 size_t new_capacity
, max_capacity
;
84 if (count
<= *capacity
)
87 max_capacity
= ~(SIZE_T
)0 / size
;
88 if (count
> max_capacity
)
91 new_capacity
= max(4, *capacity
);
92 while (new_capacity
< count
&& new_capacity
<= max_capacity
/ 2)
94 if (new_capacity
< count
)
95 new_capacity
= max_capacity
;
97 if (!(new_elements
= heap_realloc(*elements
, new_capacity
* size
)))
100 *elements
= new_elements
;
101 *capacity
= new_capacity
;
106 static inline const char *debugstr_tag(DWORD tag
)
108 return debugstr_an((char *)&tag
, 4);
111 const char *debugstr_sa_script(UINT16
) DECLSPEC_HIDDEN
;
113 static inline unsigned short get_table_entry(const unsigned short *table
, WCHAR ch
)
115 return table
[table
[table
[ch
>> 8] + ((ch
>> 4) & 0x0f)] + (ch
& 0xf)];
118 static inline FLOAT
get_scaled_advance_width(INT32 advance
, FLOAT emSize
, const DWRITE_FONT_METRICS
*metrics
)
120 return (FLOAT
)advance
* emSize
/ (FLOAT
)metrics
->designUnitsPerEm
;
123 static inline BOOL
is_simulation_valid(DWRITE_FONT_SIMULATIONS simulations
)
125 return (simulations
& ~(DWRITE_FONT_SIMULATIONS_NONE
| DWRITE_FONT_SIMULATIONS_BOLD
|
126 DWRITE_FONT_SIMULATIONS_OBLIQUE
)) == 0;
129 struct textlayout_desc
131 IDWriteFactory7
*factory
;
134 IDWriteTextFormat
*format
;
137 BOOL is_gdi_compatible
;
138 /* fields below are only meaningful for gdi-compatible layout */
140 const DWRITE_MATRIX
*transform
;
141 BOOL use_gdi_natural
;
144 struct glyphrunanalysis_desc
146 const DWRITE_GLYPH_RUN
*run
;
147 const DWRITE_MATRIX
*transform
;
148 DWRITE_RENDERING_MODE1 rendering_mode
;
149 DWRITE_MEASURING_MODE measuring_mode
;
150 DWRITE_GRID_FIT_MODE gridfit_mode
;
151 DWRITE_TEXT_ANTIALIAS_MODE aa_mode
;
157 IDWriteFactory7
*factory
;
158 DWRITE_FONT_FACE_TYPE face_type
;
159 IDWriteFontFile
* const *files
;
160 IDWriteFontFileStream
*stream
;
163 DWRITE_FONT_SIMULATIONS simulations
;
164 struct dwrite_font_data
*font_data
; /* could be NULL when face is created directly with IDWriteFactory::CreateFontFace() */
167 struct dwrite_fonttable
175 struct fontfacecached
178 IDWriteFontFace5
*fontface
;
181 #define GLYPH_BLOCK_SHIFT 8
182 #define GLYPH_BLOCK_SIZE (1UL << GLYPH_BLOCK_SHIFT)
183 #define GLYPH_BLOCK_MASK (GLYPH_BLOCK_SIZE - 1)
184 #define GLYPH_MAX 65536
188 FONT_IS_SYMBOL
= 1 << 0,
189 FONT_IS_MONOSPACED
= 1 << 1,
190 FONT_IS_COLORED
= 1 << 2, /* CPAL/COLR support */
191 FONTFACE_HAS_KERNING_PAIRS
= 1 << 3,
192 FONTFACE_HAS_VERTICAL_VARIANTS
= 1 << 4
195 struct dwrite_fontface
197 IDWriteFontFace5 IDWriteFontFace5_iface
;
198 IDWriteFontFaceReference IDWriteFontFaceReference_iface
;
201 IDWriteFontFileStream
*stream
;
202 IDWriteFontFile
**files
;
206 IDWriteFactory7
*factory
;
207 struct fontfacecached
*cached
;
210 DWRITE_FONT_FACE_TYPE type
;
211 DWRITE_FONT_METRICS1 metrics
;
212 DWRITE_CARET_METRICS caret
;
216 unsigned int descent
;
221 struct dwrite_fonttable cmap
;
222 struct dwrite_fonttable vdmx
;
223 struct dwrite_fonttable gasp
;
224 struct dwrite_fonttable cpal
;
225 struct dwrite_fonttable colr
;
226 DWRITE_GLYPH_METRICS
*glyphs
[GLYPH_MAX
/GLYPH_BLOCK_SIZE
];
228 DWRITE_FONT_STYLE style
;
229 DWRITE_FONT_STRETCH stretch
;
230 DWRITE_FONT_WEIGHT weight
;
231 DWRITE_PANOSE panose
;
232 FONTSIGNATURE fontsig
;
233 UINT32 glyph_image_formats
;
235 IDWriteLocalizedStrings
*info_strings
[DWRITE_INFORMATIONAL_STRING_SUPPORTED_SCRIPT_LANGUAGE_TAG
+ 1];
236 IDWriteLocalizedStrings
*family_names
;
237 IDWriteLocalizedStrings
*names
;
239 struct scriptshaping_cache
*shaping_cache
;
244 extern HRESULT
create_numbersubstitution(DWRITE_NUMBER_SUBSTITUTION_METHOD
,const WCHAR
*locale
,BOOL
,IDWriteNumberSubstitution
**) DECLSPEC_HIDDEN
;
245 extern HRESULT
create_textformat(const WCHAR
*,IDWriteFontCollection
*,DWRITE_FONT_WEIGHT
,DWRITE_FONT_STYLE
,DWRITE_FONT_STRETCH
,
246 FLOAT
,const WCHAR
*,IDWriteTextFormat
**) DECLSPEC_HIDDEN
;
247 extern HRESULT
create_textlayout(const struct textlayout_desc
*,IDWriteTextLayout
**) DECLSPEC_HIDDEN
;
248 extern HRESULT
create_trimmingsign(IDWriteFactory7
*factory
, IDWriteTextFormat
*format
,
249 IDWriteInlineObject
**sign
) DECLSPEC_HIDDEN
;
250 extern HRESULT
create_typography(IDWriteTypography
**) DECLSPEC_HIDDEN
;
251 extern HRESULT
create_localizedstrings(IDWriteLocalizedStrings
**) DECLSPEC_HIDDEN
;
252 extern HRESULT
add_localizedstring(IDWriteLocalizedStrings
*,const WCHAR
*,const WCHAR
*) DECLSPEC_HIDDEN
;
253 extern HRESULT
clone_localizedstrings(IDWriteLocalizedStrings
*iface
, IDWriteLocalizedStrings
**strings
) DECLSPEC_HIDDEN
;
254 extern void set_en_localizedstring(IDWriteLocalizedStrings
*,const WCHAR
*) DECLSPEC_HIDDEN
;
255 extern void sort_localizedstrings(IDWriteLocalizedStrings
*) DECLSPEC_HIDDEN
;
256 extern HRESULT
get_system_fontcollection(IDWriteFactory7
*factory
, IDWriteFontCollection1
**collection
) DECLSPEC_HIDDEN
;
257 extern HRESULT
get_eudc_fontcollection(IDWriteFactory7
*factory
, IDWriteFontCollection3
**collection
) DECLSPEC_HIDDEN
;
258 extern IDWriteTextAnalyzer
*get_text_analyzer(void) DECLSPEC_HIDDEN
;
259 extern HRESULT
create_font_file(IDWriteFontFileLoader
*loader
, const void *reference_key
, UINT32 key_size
, IDWriteFontFile
**font_file
) DECLSPEC_HIDDEN
;
260 extern void init_local_fontfile_loader(void) DECLSPEC_HIDDEN
;
261 extern IDWriteFontFileLoader
*get_local_fontfile_loader(void) DECLSPEC_HIDDEN
;
262 extern HRESULT
create_fontface(const struct fontface_desc
*desc
, struct list
*cached_list
,
263 IDWriteFontFace5
**fontface
) DECLSPEC_HIDDEN
;
264 extern HRESULT
create_font_collection(IDWriteFactory7
*factory
, IDWriteFontFileEnumerator
*enumerator
, BOOL is_system
,
265 IDWriteFontCollection3
**collection
) DECLSPEC_HIDDEN
;
266 extern HRESULT
create_glyphrunanalysis(const struct glyphrunanalysis_desc
*,IDWriteGlyphRunAnalysis
**) DECLSPEC_HIDDEN
;
267 extern BOOL
is_system_collection(IDWriteFontCollection
*) DECLSPEC_HIDDEN
;
268 extern HRESULT
get_local_refkey(const WCHAR
*,const FILETIME
*,void**,UINT32
*) DECLSPEC_HIDDEN
;
269 extern HRESULT
get_filestream_from_file(IDWriteFontFile
*,IDWriteFontFileStream
**) DECLSPEC_HIDDEN
;
270 extern BOOL
is_face_type_supported(DWRITE_FONT_FACE_TYPE
) DECLSPEC_HIDDEN
;
271 extern HRESULT
get_family_names_from_stream(IDWriteFontFileStream
*,UINT32
,DWRITE_FONT_FACE_TYPE
,IDWriteLocalizedStrings
**) DECLSPEC_HIDDEN
;
272 extern HRESULT
create_colorglyphenum(FLOAT
,FLOAT
,const DWRITE_GLYPH_RUN
*,const DWRITE_GLYPH_RUN_DESCRIPTION
*,DWRITE_MEASURING_MODE
,
273 const DWRITE_MATRIX
*,UINT32
,IDWriteColorGlyphRunEnumerator
**) DECLSPEC_HIDDEN
;
274 extern BOOL
lb_is_newline_char(WCHAR
) DECLSPEC_HIDDEN
;
275 extern HRESULT
create_system_fontfallback(IDWriteFactory7
*factory
, IDWriteFontFallback1
**fallback
) DECLSPEC_HIDDEN
;
276 extern void release_system_fontfallback(IDWriteFontFallback1
*fallback
) DECLSPEC_HIDDEN
;
277 extern HRESULT
create_fontfallback_builder(IDWriteFactory7
*factory
, IDWriteFontFallbackBuilder
**builder
) DECLSPEC_HIDDEN
;
278 extern HRESULT
create_matching_font(IDWriteFontCollection
*,const WCHAR
*,DWRITE_FONT_WEIGHT
,DWRITE_FONT_STYLE
,DWRITE_FONT_STRETCH
,
279 IDWriteFont
**) DECLSPEC_HIDDEN
;
280 extern HRESULT
create_fontfacereference(IDWriteFactory7
*factory
, IDWriteFontFile
*file
, UINT32 face_index
,
281 DWRITE_FONT_SIMULATIONS simulations
, DWRITE_FONT_AXIS_VALUE
const *axis_values
, UINT32 axis_values_count
,
282 IDWriteFontFaceReference1
**reference
) DECLSPEC_HIDDEN
;
283 extern HRESULT
factory_get_cached_fontface(IDWriteFactory7
*factory
, IDWriteFontFile
* const *files
, UINT32 num_files
,
284 DWRITE_FONT_SIMULATIONS simulations
, struct list
**cache
, REFIID riid
, void **obj
) DECLSPEC_HIDDEN
;
285 extern void factory_detach_fontcollection(IDWriteFactory7
*factory
, IDWriteFontCollection3
*collection
) DECLSPEC_HIDDEN
;
286 extern void factory_detach_gdiinterop(IDWriteFactory7
*factory
, IDWriteGdiInterop1
*interop
) DECLSPEC_HIDDEN
;
287 extern struct fontfacecached
*factory_cache_fontface(IDWriteFactory7
*factory
, struct list
*fontfaces
,
288 IDWriteFontFace5
*fontface
) DECLSPEC_HIDDEN
;
289 extern void get_logfont_from_font(IDWriteFont
*,LOGFONTW
*) DECLSPEC_HIDDEN
;
290 extern void get_logfont_from_fontface(IDWriteFontFace
*,LOGFONTW
*) DECLSPEC_HIDDEN
;
291 extern HRESULT
get_fontsig_from_font(IDWriteFont
*,FONTSIGNATURE
*) DECLSPEC_HIDDEN
;
292 extern HRESULT
get_fontsig_from_fontface(IDWriteFontFace
*,FONTSIGNATURE
*) DECLSPEC_HIDDEN
;
293 extern HRESULT
create_gdiinterop(IDWriteFactory7
*factory
, IDWriteGdiInterop1
**interop
) DECLSPEC_HIDDEN
;
294 extern void fontface_detach_from_cache(IDWriteFontFace5
*fontface
) DECLSPEC_HIDDEN
;
295 extern void factory_lock(IDWriteFactory7
*factory
) DECLSPEC_HIDDEN
;
296 extern void factory_unlock(IDWriteFactory7
*factory
) DECLSPEC_HIDDEN
;
297 extern HRESULT
create_inmemory_fileloader(IDWriteFontFileLoader
**) DECLSPEC_HIDDEN
;
298 extern HRESULT
create_font_resource(IDWriteFactory7
*factory
, IDWriteFontFile
*file
, UINT32 face_index
,
299 IDWriteFontResource
**resource
) DECLSPEC_HIDDEN
;
301 struct dwrite_fontface
;
303 extern float fontface_get_scaled_design_advance(struct dwrite_fontface
*fontface
, DWRITE_MEASURING_MODE measuring_mode
,
304 float emsize
, float ppdip
, const DWRITE_MATRIX
*transform
, UINT16 glyph
, BOOL is_sideways
) DECLSPEC_HIDDEN
;
305 extern struct dwrite_fontface
*unsafe_impl_from_IDWriteFontFace(IDWriteFontFace
*iface
) DECLSPEC_HIDDEN
;
307 /* Opentype font table functions */
308 struct dwrite_font_props
310 DWRITE_FONT_STYLE style
;
311 DWRITE_FONT_STRETCH stretch
;
312 DWRITE_FONT_WEIGHT weight
;
313 DWRITE_PANOSE panose
;
314 FONTSIGNATURE fontsig
;
319 struct file_stream_desc
{
320 IDWriteFontFileStream
*stream
;
321 DWRITE_FONT_FACE_TYPE face_type
;
325 extern const void* get_fontface_table(IDWriteFontFace5
*fontface
, UINT32 tag
,
326 struct dwrite_fonttable
*table
) DECLSPEC_HIDDEN
;
328 extern HRESULT
opentype_analyze_font(IDWriteFontFileStream
*,BOOL
*,DWRITE_FONT_FILE_TYPE
*,DWRITE_FONT_FACE_TYPE
*,UINT32
*) DECLSPEC_HIDDEN
;
329 extern HRESULT
opentype_try_get_font_table(const struct file_stream_desc
*stream_desc
, UINT32 tag
, const void **data
,
330 void **context
, UINT32
*size
, BOOL
*exists
) DECLSPEC_HIDDEN
;
331 extern HRESULT
opentype_cmap_get_unicode_ranges(const struct file_stream_desc
*stream_desc
, unsigned int max_count
,
332 DWRITE_UNICODE_RANGE
*ranges
, unsigned int *count
) DECLSPEC_HIDDEN
;
333 extern void opentype_get_font_properties(struct file_stream_desc
*,struct dwrite_font_props
*) DECLSPEC_HIDDEN
;
334 extern void opentype_get_font_metrics(struct file_stream_desc
*,DWRITE_FONT_METRICS1
*,DWRITE_CARET_METRICS
*) DECLSPEC_HIDDEN
;
335 extern void opentype_get_font_typo_metrics(struct file_stream_desc
*stream_desc
, unsigned int *ascent
,
336 unsigned int *descent
) DECLSPEC_HIDDEN
;
337 extern HRESULT
opentype_get_font_info_strings(const struct file_stream_desc
*stream_desc
,
338 DWRITE_INFORMATIONAL_STRING_ID id
, IDWriteLocalizedStrings
**strings
) DECLSPEC_HIDDEN
;
339 extern HRESULT
opentype_get_font_familyname(struct file_stream_desc
*,IDWriteLocalizedStrings
**) DECLSPEC_HIDDEN
;
340 extern HRESULT
opentype_get_font_facename(struct file_stream_desc
*,WCHAR
*,IDWriteLocalizedStrings
**) DECLSPEC_HIDDEN
;
341 extern HRESULT
opentype_get_typographic_features(IDWriteFontFace
*,UINT32
,UINT32
,UINT32
,UINT32
*,DWRITE_FONT_FEATURE_TAG
*) DECLSPEC_HIDDEN
;
342 extern BOOL
opentype_get_vdmx_size(const struct dwrite_fonttable
*table
, INT ppem
, UINT16
*ascent
,
343 UINT16
*descent
) DECLSPEC_HIDDEN
;
344 extern unsigned int opentype_get_cpal_palettecount(const struct dwrite_fonttable
*table
) DECLSPEC_HIDDEN
;
345 extern unsigned int opentype_get_cpal_paletteentrycount(const struct dwrite_fonttable
*table
) DECLSPEC_HIDDEN
;
346 extern HRESULT
opentype_get_cpal_entries(const struct dwrite_fonttable
*table
, unsigned int palette
,
347 unsigned int first_entry_index
, unsigned int entry_count
, DWRITE_COLOR_F
*entries
) DECLSPEC_HIDDEN
;
348 extern BOOL
opentype_has_vertical_variants(IDWriteFontFace5
*fontface
) DECLSPEC_HIDDEN
;
349 extern UINT32
opentype_get_glyph_image_formats(IDWriteFontFace5
*fontface
) DECLSPEC_HIDDEN
;
350 extern DWRITE_CONTAINER_TYPE
opentype_analyze_container_type(void const *, UINT32
) DECLSPEC_HIDDEN
;
352 struct dwrite_colorglyph
{
353 USHORT layer
; /* [0, num_layers) index indicating current layer */
354 /* base glyph record data, set once on initialization */
357 /* current layer record data, updated every time glyph is switched to next layer */
359 UINT16 palette_index
;
362 extern HRESULT
opentype_get_colr_glyph(const struct dwrite_fonttable
*table
, UINT16 glyph
,
363 struct dwrite_colorglyph
*color_glyph
) DECLSPEC_HIDDEN
;
364 extern void opentype_colr_next_glyph(const struct dwrite_fonttable
*table
,
365 struct dwrite_colorglyph
*color_glyph
) DECLSPEC_HIDDEN
;
368 GASP_GRIDFIT
= 0x0001,
369 GASP_DOGRAY
= 0x0002,
370 GASP_SYMMETRIC_GRIDFIT
= 0x0004,
371 GASP_SYMMETRIC_SMOOTHING
= 0x0008,
374 extern unsigned int opentype_get_gasp_flags(const struct dwrite_fonttable
*gasp
, float emsize
) DECLSPEC_HIDDEN
;
377 extern HRESULT
bidi_computelevels(const WCHAR
*,UINT32
,UINT8
,UINT8
*,UINT8
*) DECLSPEC_HIDDEN
;
378 extern WCHAR
bidi_get_mirrored_char(WCHAR
) DECLSPEC_HIDDEN
;
380 /* FreeType integration */
381 struct dwrite_glyphbitmap
383 IDWriteFontFace4
*fontface
;
395 extern BOOL
init_freetype(void) DECLSPEC_HIDDEN
;
396 extern void release_freetype(void) DECLSPEC_HIDDEN
;
398 extern HRESULT
freetype_get_design_glyph_metrics(struct dwrite_fontface
*fontface
, UINT16 glyph
,
399 DWRITE_GLYPH_METRICS
*metrics
) DECLSPEC_HIDDEN
;
400 extern void freetype_notify_cacheremove(IDWriteFontFace5
*fontface
) DECLSPEC_HIDDEN
;
401 extern HRESULT
freetype_get_glyphrun_outline(IDWriteFontFace5
*fontface
, float emsize
, UINT16
const *glyphs
,
402 float const *advances
, DWRITE_GLYPH_OFFSET
const *offsets
, unsigned int count
, BOOL is_rtl
,
403 IDWriteGeometrySink
*sink
) DECLSPEC_HIDDEN
;
404 extern UINT16
freetype_get_glyphcount(IDWriteFontFace5
*fontface
) DECLSPEC_HIDDEN
;
405 extern void freetype_get_glyphs(IDWriteFontFace5
*fontface
, INT charmap
, UINT32
const *codepoints
, UINT32 count
,
406 UINT16
*glyphs
) DECLSPEC_HIDDEN
;
407 extern BOOL
freetype_has_kerning_pairs(IDWriteFontFace5
*fontface
) DECLSPEC_HIDDEN
;
408 extern INT32
freetype_get_kerning_pair_adjustment(IDWriteFontFace5
*fontface
, UINT16 left
, UINT16 right
) DECLSPEC_HIDDEN
;
409 extern void freetype_get_glyph_bbox(struct dwrite_glyphbitmap
*bitmap_desc
) DECLSPEC_HIDDEN
;
410 extern BOOL
freetype_get_glyph_bitmap(struct dwrite_glyphbitmap
*) DECLSPEC_HIDDEN
;
411 extern INT
freetype_get_charmap_index(IDWriteFontFace5
*fontface
) DECLSPEC_HIDDEN
;
412 extern INT32
freetype_get_glyph_advance(IDWriteFontFace5
*fontface
, FLOAT emsize
, UINT16 index
,
413 DWRITE_MEASURING_MODE measuring_mode
, BOOL
*has_contours
) DECLSPEC_HIDDEN
;
414 extern void freetype_get_design_glyph_bbox(IDWriteFontFace4
*,UINT16
,UINT16
,RECT
*) DECLSPEC_HIDDEN
;
420 SCRIPT_JUSTIFY_ARABIC_BLANK
,
421 SCRIPT_JUSTIFY_CHARACTER
,
422 SCRIPT_JUSTIFY_RESERVED1
,
423 SCRIPT_JUSTIFY_BLANK
,
424 SCRIPT_JUSTIFY_RESERVED2
,
425 SCRIPT_JUSTIFY_RESERVED3
,
426 SCRIPT_JUSTIFY_ARABIC_NORMAL
,
427 SCRIPT_JUSTIFY_ARABIC_KASHIDA
,
428 SCRIPT_JUSTIFY_ARABIC_ALEF
,
429 SCRIPT_JUSTIFY_ARABIC_HA
,
430 SCRIPT_JUSTIFY_ARABIC_RA
,
431 SCRIPT_JUSTIFY_ARABIC_BA
,
432 SCRIPT_JUSTIFY_ARABIC_BARA
,
433 SCRIPT_JUSTIFY_ARABIC_SEEN
,
434 SCRIPT_JUSTIFY_ARABIC_SEEN_M
437 struct scriptshaping_cache
439 const struct shaping_font_ops
*font
;
445 struct dwrite_fonttable table
;
446 unsigned int script_list
;
447 unsigned int feature_list
;
448 unsigned int lookup_list
;
453 struct dwrite_fonttable table
;
454 unsigned int classdef
;
458 struct scriptshaping_context
460 struct scriptshaping_cache
*cache
;
471 const UINT16
*glyphs
;
472 const DWRITE_SHAPING_GLYPH_PROPERTIES
*glyph_props
;
476 unsigned int glyph_count
;
478 DWRITE_MEASURING_MODE measuring_mode
;
480 DWRITE_GLYPH_OFFSET
*offsets
;
483 struct shaping_font_ops
485 void (*grab_font_table
)(void *context
, UINT32 table
, const BYTE
**data
, UINT32
*size
, void **data_context
);
486 void (*release_font_table
)(void *context
, void *data_context
);
487 UINT16 (*get_font_upem
)(void *context
);
490 extern struct scriptshaping_cache
*create_scriptshaping_cache(void *context
,
491 const struct shaping_font_ops
*font_ops
) DECLSPEC_HIDDEN
;
492 extern void release_scriptshaping_cache(struct scriptshaping_cache
*) DECLSPEC_HIDDEN
;
493 extern struct scriptshaping_cache
*fontface_get_shaping_cache(struct dwrite_fontface
*fontface
) DECLSPEC_HIDDEN
;
495 struct shaping_features
501 extern void opentype_layout_scriptshaping_cache_init(struct scriptshaping_cache
*cache
) DECLSPEC_HIDDEN
;
502 extern DWORD
opentype_layout_find_script(const struct scriptshaping_cache
*cache
, DWORD kind
, DWORD tag
,
503 unsigned int *script_index
) DECLSPEC_HIDDEN
;
504 extern DWORD
opentype_layout_find_language(const struct scriptshaping_cache
*cache
, DWORD kind
, DWORD tag
,
505 unsigned int script_index
, unsigned int *language_index
) DECLSPEC_HIDDEN
;
506 extern void opentype_layout_apply_gpos_features(struct scriptshaping_context
*context
, unsigned int script_index
,
507 unsigned int language_index
, const struct shaping_features
*features
) DECLSPEC_HIDDEN
;
509 struct scriptshaping_ops
511 HRESULT (*contextual_shaping
)(struct scriptshaping_context
*context
, UINT16
*clustermap
, UINT16
*glyph_indices
, UINT32
* actual_glyph_count
);
512 HRESULT (*set_text_glyphs_props
)(struct scriptshaping_context
*context
, UINT16
*clustermap
, UINT16
*glyph_indices
,
513 UINT32 glyphcount
, DWRITE_SHAPING_TEXT_PROPERTIES
*text_props
, DWRITE_SHAPING_GLYPH_PROPERTIES
*glyph_props
);
514 const struct shaping_features
*gpos_features
;
517 extern const struct scriptshaping_ops default_shaping_ops DECLSPEC_HIDDEN
;
518 extern const struct scriptshaping_ops latn_shaping_ops DECLSPEC_HIDDEN
;
520 extern HRESULT
shape_get_positions(struct scriptshaping_context
*context
, const DWORD
*scripts
,
521 const struct shaping_features
*features
) DECLSPEC_HIDDEN
;