ReactOS 0.4.17-dev-934-g091855f
dwrite_private.h File Reference
#include "dwrite_3.h"
#include "d2d1.h"
#include "winternl.h"
#include "wine/debug.h"
#include "wine/list.h"
#include "wine/rbtree.h"
Include dependency graph for dwrite_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MATRIX_2X2
 
struct  textlayout_desc
 
struct  glyphrunanalysis_desc
 
struct  fontface_desc
 
struct  dwrite_fonttable
 
struct  fontfacecached
 
struct  dwrite_cmap
 
struct  dwrite_fontface
 
struct  dwrite_textformat_data
 
struct  dwrite_textformat
 
struct  dwrite_font_props
 
struct  file_stream_desc
 
struct  tag_array
 
struct  ot_gsubgpos_table
 
struct  dwrite_var_axis
 
struct  dwrite_colorglyph
 
struct  bidi_char
 
struct  dwrite_glyphbitmap
 
struct  dwrite_outline
 
struct  scriptshaping_cache
 
struct  shaping_glyph_info
 
struct  shaping_glyph_properties
 
struct  shaping_feature
 
struct  shaping_stage
 
struct  shaping_features
 
struct  shaper
 
struct  scriptshaping_context
 
struct  shaping_font_ops
 

Macros

#define MS_GSUB_TAG   DWRITE_MAKE_OPENTYPE_TAG('G','S','U','B')
 
#define MS_GPOS_TAG   DWRITE_MAKE_OPENTYPE_TAG('G','P','O','S')
 
#define GLYPH_BLOCK_SHIFT   8
 
#define GLYPH_BLOCK_SIZE   (1UL << GLYPH_BLOCK_SHIFT)
 
#define GLYPH_BLOCK_MASK   (GLYPH_BLOCK_SIZE - 1)
 
#define GLYPH_MAX   65536
 
#define MAX_SHAPING_STAGE   16
 

Typedefs

typedef struct MATRIX_2X2 MATRIX_2X2
 
typedef UINT16(* p_cmap_get_glyph_func) (const struct dwrite_cmap *cmap, unsigned int ch)
 
typedef unsigned int(* p_cmap_get_ranges_func) (const struct dwrite_cmap *cmap, unsigned int max_count, DWRITE_UNICODE_RANGE *ranges)
 
typedef UINT64(* p_dwrite_fontface_get_font_object) (struct dwrite_fontface *fontface)
 
typedef void(* p_apply_context_lookup) (struct scriptshaping_context *context, unsigned int lookup_index)
 
typedef void(* stage_func) (struct scriptshaping_context *context, const struct shaping_features *features)
 

Enumerations

enum  font_flags {
  FONT_IS_SYMBOL = 0x00000001 , FONT_IS_MONOSPACED = 0x00000002 , FONT_IS_COLORED = 0x00000004 , FONTFACE_KERNING_PAIRS = 0x00000008 ,
  FONTFACE_NO_KERNING_PAIRS = 0x00000010 , FONTFACE_VERTICAL_VARIANTS = 0x00000020 , FONTFACE_NO_VERTICAL_VARIANTS = 0x00000040
}
 
enum  gasp_flags { GASP_GRIDFIT = 0x0001 , GASP_DOGRAY = 0x0002 , GASP_SYMMETRIC_GRIDFIT = 0x0004 , GASP_SYMMETRIC_SMOOTHING = 0x0008 }
 
enum  dwrite_outline_tags { OUTLINE_BEGIN_FIGURE , OUTLINE_END_FIGURE , OUTLINE_LINE , OUTLINE_BEZIER }
 
enum  SCRIPT_JUSTIFY {
  SCRIPT_JUSTIFY_NONE , SCRIPT_JUSTIFY_ARABIC_BLANK , SCRIPT_JUSTIFY_CHARACTER , SCRIPT_JUSTIFY_RESERVED1 ,
  SCRIPT_JUSTIFY_BLANK , SCRIPT_JUSTIFY_RESERVED2 , SCRIPT_JUSTIFY_RESERVED3 , SCRIPT_JUSTIFY_ARABIC_NORMAL ,
  SCRIPT_JUSTIFY_ARABIC_KASHIDA , SCRIPT_JUSTIFY_ARABIC_ALEF , SCRIPT_JUSTIFY_ARABIC_HA , SCRIPT_JUSTIFY_ARABIC_RA ,
  SCRIPT_JUSTIFY_ARABIC_BA , SCRIPT_JUSTIFY_ARABIC_BARA , SCRIPT_JUSTIFY_ARABIC_SEEN , SCRIPT_JUSTIFY_ARABIC_SEEN_M
}
 
enum  shaping_feature_flags {
  FEATURE_GLOBAL = 0x1 , FEATURE_GLOBAL_SEARCH = 0x2 , FEATURE_MANUAL_ZWNJ = 0x4 , FEATURE_MANUAL_ZWJ = 0x8 ,
  FEATURE_MANUAL_JOINERS = FEATURE_MANUAL_ZWNJ | FEATURE_MANUAL_ZWJ , FEATURE_HAS_FALLBACK = 0x10 , FEATURE_NEEDS_FALLBACK = 0x20
}
 

Functions

static LPWSTR heap_strdupnW (const WCHAR *str, UINT32 len)
 
static const char * debugstr_range (const DWRITE_TEXT_RANGE *range)
 
static const char * debugstr_matrix (const DWRITE_MATRIX *m)
 
static BOOL dwrite_array_reserve (void **elements, size_t *capacity, size_t count, size_t size)
 
const char * debugstr_sa_script (UINT16)
 
static unsigned short get_table_entry_16 (const unsigned short *table, WCHAR ch)
 
static unsigned short get_table_entry_32 (const unsigned short *table, UINT ch)
 
static BOOL is_simulation_valid (DWRITE_FONT_SIMULATIONS simulations)
 
static void dwrite_matrix_multiply (DWRITE_MATRIX *a, const DWRITE_MATRIX *b)
 
void dwrite_cmap_init (struct dwrite_cmap *cmap, IDWriteFontFile *file, unsigned int face_index, DWRITE_FONT_FACE_TYPE face_type)
 
void dwrite_cmap_release (struct dwrite_cmap *cmap)
 
UINT16 opentype_cmap_get_glyph (const struct dwrite_cmap *cmap, unsigned int ch)
 
HRESULT opentype_cmap_get_unicode_ranges (const struct dwrite_cmap *cmap, unsigned int max_count, DWRITE_UNICODE_RANGE *ranges, unsigned int *count)
 
HRESULT create_numbersubstitution (DWRITE_NUMBER_SUBSTITUTION_METHOD, const WCHAR *locale, BOOL, IDWriteNumberSubstitution **)
 
HRESULT create_text_format (const WCHAR *family_name, IDWriteFontCollection *collection, DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STYLE style, DWRITE_FONT_STRETCH stretch, float size, const WCHAR *locale, REFIID riid, void **out)
 
HRESULT create_textlayout (const struct textlayout_desc *, IDWriteTextLayout **)
 
HRESULT create_trimmingsign (IDWriteFactory7 *factory, IDWriteTextFormat *format, IDWriteInlineObject **sign)
 
HRESULT create_typography (IDWriteTypography **)
 
HRESULT create_localizedstrings (IDWriteLocalizedStrings **)
 
HRESULT add_localizedstring (IDWriteLocalizedStrings *, const WCHAR *, const WCHAR *)
 
HRESULT clone_localizedstrings (IDWriteLocalizedStrings *iface, IDWriteLocalizedStrings **strings)
 
void set_en_localizedstring (IDWriteLocalizedStrings *, const WCHAR *)
 
void sort_localizedstrings (IDWriteLocalizedStrings *)
 
unsigned int get_localizedstrings_count (IDWriteLocalizedStrings *strings)
 
BOOL localizedstrings_contains (IDWriteLocalizedStrings *strings, const WCHAR *str)
 
HRESULT get_system_fontcollection (IDWriteFactory7 *factory, DWRITE_FONT_FAMILY_MODEL family_model, IDWriteFontCollection **collection)
 
HRESULT get_eudc_fontcollection (IDWriteFactory7 *factory, IDWriteFontCollection3 **collection)
 
IDWriteTextAnalyzer2 * get_text_analyzer (void)
 
HRESULT create_font_file (IDWriteFontFileLoader *loader, const void *reference_key, UINT32 key_size, IDWriteFontFile **font_file)
 
void init_local_fontfile_loader (void)
 
IDWriteFontFileLoader * get_local_fontfile_loader (void)
 
HRESULT create_fontface (const struct fontface_desc *desc, struct list *cached_list, IDWriteFontFace5 **fontface)
 
HRESULT create_font_collection (IDWriteFactory7 *factory, IDWriteFontFileEnumerator *enumerator, BOOL is_system, IDWriteFontCollection3 **collection)
 
HRESULT create_glyphrunanalysis (const struct glyphrunanalysis_desc *, IDWriteGlyphRunAnalysis **)
 
BOOL is_system_collection (IDWriteFontCollection *)
 
HRESULT get_local_refkey (const WCHAR *, const FILETIME *, void **, UINT32 *)
 
HRESULT get_filestream_from_file (IDWriteFontFile *, IDWriteFontFileStream **)
 
BOOL is_face_type_supported (DWRITE_FONT_FACE_TYPE)
 
HRESULT get_family_names_from_stream (IDWriteFontFileStream *, UINT32, DWRITE_FONT_FACE_TYPE, IDWriteLocalizedStrings **)
 
HRESULT create_colorglyphenum (D2D1_POINT_2F origin, const DWRITE_GLYPH_RUN *run, const DWRITE_GLYPH_RUN_DESCRIPTION *desc, DWRITE_GLYPH_IMAGE_FORMATS formats, DWRITE_MEASURING_MODE mode, const DWRITE_MATRIX *transform, UINT32 palette, IDWriteColorGlyphRunEnumerator1 **enumerator)
 
BOOL lb_is_newline_char (WCHAR)
 
HRESULT create_system_fontfallback (IDWriteFactory7 *factory, IDWriteFontFallback1 **fallback)
 
void release_system_fontfallback (IDWriteFontFallback1 *fallback)
 
void release_system_fallback_data (void)
 
HRESULT create_fontfallback_builder (IDWriteFactory7 *factory, IDWriteFontFallbackBuilder **builder)
 
HRESULT create_matching_font (IDWriteFontCollection *collection, const WCHAR *family, DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STYLE style, DWRITE_FONT_STRETCH stretch, REFIID riid, void **obj)
 
HRESULT create_fontfacereference (IDWriteFactory7 *factory, IDWriteFontFile *file, UINT32 face_index, DWRITE_FONT_SIMULATIONS simulations, DWRITE_FONT_AXIS_VALUE const *axis_values, UINT32 axis_values_count, IDWriteFontFaceReference1 **reference)
 
HRESULT factory_get_cached_fontface (IDWriteFactory7 *factory, IDWriteFontFile *const *files, UINT32 num_files, DWRITE_FONT_SIMULATIONS simulations, struct list **cache, REFIID riid, void **obj)
 
void factory_detach_fontcollection (IDWriteFactory7 *factory, IDWriteFontCollection3 *collection)
 
void factory_detach_gdiinterop (IDWriteFactory7 *factory, IDWriteGdiInterop1 *interop)
 
struct fontfacecached * factory_cache_fontface (IDWriteFactory7 *factory, struct list *fontfaces, IDWriteFontFace5 *fontface)
 
void get_logfont_from_font (IDWriteFont *, LOGFONTW *)
 
void get_logfont_from_fontface (IDWriteFontFace *, LOGFONTW *)
 
HRESULT get_fontsig_from_font (IDWriteFont *, FONTSIGNATURE *)
 
HRESULT get_fontsig_from_fontface (IDWriteFontFace *, FONTSIGNATURE *)
 
HRESULT create_gdiinterop (IDWriteFactory7 *factory, IDWriteGdiInterop1 **interop)
 
void fontface_detach_from_cache (IDWriteFontFace5 *fontface)
 
void factory_lock (IDWriteFactory7 *factory)
 
void factory_unlock (IDWriteFactory7 *factory)
 
HRESULT create_inmemory_fileloader (IDWriteInMemoryFontFileLoader **loader)
 
HRESULT create_font_resource (IDWriteFactory7 *factory, IDWriteFontFile *file, UINT32 face_index, IDWriteFontResource **resource)
 
HRESULT create_fontset_builder (IDWriteFactory7 *factory, IDWriteFontSetBuilder2 **ret)
 
HRESULT compute_glyph_origins (DWRITE_GLYPH_RUN const *run, DWRITE_MEASURING_MODE measuring_mode, D2D1_POINT_2F baseline_origin, DWRITE_MATRIX const *transform, D2D1_POINT_2F *origins)
 
HRESULT create_font_collection_from_set (IDWriteFactory7 *factory, IDWriteFontSet *set, DWRITE_FONT_FAMILY_MODEL family_model, REFGUID riid, void **ret)
 
HRESULT create_system_fontset (IDWriteFactory7 *factory, REFIID riid, void **obj)
 
float fontface_get_scaled_design_advance (struct dwrite_fontface *fontface, DWRITE_MEASURING_MODE measuring_mode, float emsize, float ppdip, const DWRITE_MATRIX *transform, UINT16 glyph, BOOL is_sideways)
 
struct dwrite_fontface * unsafe_impl_from_IDWriteFontFace (IDWriteFontFace *iface)
 
struct dwrite_textformat * unsafe_impl_from_IDWriteTextFormat (IDWriteTextFormat *iface)
 
void release_format_data (struct dwrite_textformat_data *data)
 
HRESULT format_set_vertical_orientation (struct dwrite_textformat_data *format, DWRITE_VERTICAL_GLYPH_ORIENTATION orientation, BOOL *changed)
 
HRESULT format_set_fontfallback (struct dwrite_textformat_data *format, IDWriteFontFallback *fallback)
 
HRESULT format_get_fontfallback (const struct dwrite_textformat_data *format, IDWriteFontFallback **fallback)
 
HRESULT format_set_font_axisvalues (struct dwrite_textformat_data *format, DWRITE_FONT_AXIS_VALUE const *axis_values, unsigned int num_values)
 
HRESULT format_get_font_axisvalues (struct dwrite_textformat_data *format, DWRITE_FONT_AXIS_VALUE *axis_values, unsigned int num_values)
 
HRESULT format_set_optical_alignment (struct dwrite_textformat_data *format, DWRITE_OPTICAL_ALIGNMENT alignment)
 
HRESULT format_set_trimming (struct dwrite_textformat_data *format, DWRITE_TRIMMING const *trimming, IDWriteInlineObject *trimming_sign, BOOL *changed)
 
HRESULT format_set_flowdirection (struct dwrite_textformat_data *format, DWRITE_FLOW_DIRECTION direction, BOOL *changed)
 
HRESULT format_set_readingdirection (struct dwrite_textformat_data *format, DWRITE_READING_DIRECTION direction, BOOL *changed)
 
HRESULT format_set_wordwrapping (struct dwrite_textformat_data *format, DWRITE_WORD_WRAPPING wrapping, BOOL *changed)
 
HRESULT format_set_paralignment (struct dwrite_textformat_data *format, DWRITE_PARAGRAPH_ALIGNMENT alignment, BOOL *changed)
 
HRESULT format_set_textalignment (struct dwrite_textformat_data *format, DWRITE_TEXT_ALIGNMENT alignment, BOOL *changed)
 
HRESULT format_set_linespacing (struct dwrite_textformat_data *format, DWRITE_LINE_SPACING const *spacing, BOOL *changed)
 
const void * get_fontface_table (IDWriteFontFace5 *fontface, UINT32 tag, struct dwrite_fonttable *table)
 
HRESULT opentype_analyze_font (IDWriteFontFileStream *, BOOL *, DWRITE_FONT_FILE_TYPE *, DWRITE_FONT_FACE_TYPE *, UINT32 *)
 
HRESULT opentype_try_get_font_table (const struct file_stream_desc *stream_desc, UINT32 tag, const void **data, void **context, UINT32 *size, BOOL *exists)
 
void opentype_get_font_properties (const struct file_stream_desc *stream_desc, struct dwrite_font_props *props)
 
void opentype_get_font_metrics (struct file_stream_desc *, DWRITE_FONT_METRICS1 *, DWRITE_CARET_METRICS *)
 
void opentype_get_font_typo_metrics (struct file_stream_desc *stream_desc, unsigned int *ascent, unsigned int *descent)
 
HRESULT opentype_get_font_info_strings (const struct file_stream_desc *stream_desc, DWRITE_INFORMATIONAL_STRING_ID id, IDWriteLocalizedStrings **strings)
 
HRESULT opentype_get_font_familyname (const struct file_stream_desc *desc, DWRITE_FONT_FAMILY_MODEL family_model, IDWriteLocalizedStrings **names)
 
HRESULT opentype_get_font_facename (struct file_stream_desc *, WCHAR *, IDWriteLocalizedStrings **)
 
void opentype_get_typographic_features (struct ot_gsubgpos_table *table, unsigned int script_index, unsigned int language_index, struct tag_array *tags)
 
BOOL opentype_get_vdmx_size (const struct dwrite_fonttable *table, INT ppem, UINT16 *ascent, UINT16 *descent)
 
unsigned int opentype_get_cpal_palettecount (const struct dwrite_fonttable *table)
 
unsigned int opentype_get_cpal_paletteentrycount (const struct dwrite_fonttable *table)
 
HRESULT opentype_get_cpal_entries (const struct dwrite_fonttable *table, unsigned int palette, unsigned int first_entry_index, unsigned int entry_count, DWRITE_COLOR_F *entries)
 
UINT32 opentype_get_glyph_image_formats (IDWriteFontFace5 *fontface)
 
DWRITE_CONTAINER_TYPE opentype_analyze_container_type (void const *, UINT32)
 
HRESULT opentype_get_kerning_pairs (struct dwrite_fontface *fontface, unsigned int count, const UINT16 *glyphs, INT32 *values)
 
BOOL opentype_has_kerning_pairs (struct dwrite_fontface *fontface)
 
HRESULT opentype_get_font_var_axis (const struct file_stream_desc *stream_desc, struct dwrite_var_axis **axis, unsigned int *axis_count)
 
HRESULT opentype_get_colr_glyph (const struct dwrite_fonttable *table, UINT16 glyph, struct dwrite_colorglyph *color_glyph)
 
void opentype_colr_next_glyph (const struct dwrite_fonttable *table, struct dwrite_colorglyph *color_glyph)
 
unsigned int opentype_get_gasp_flags (const struct dwrite_fonttable *gasp, float emsize)
 
HRESULT bidi_computelevels (struct bidi_char *chars, unsigned int count, UINT8 baselevel)
 
void shape_enable_feature (struct shaping_features *features, unsigned int tag, unsigned int flags)
 
void shape_add_feature_full (struct shaping_features *features, unsigned int tag, unsigned int flags, unsigned int value)
 
unsigned int shape_get_feature_1_mask (const struct shaping_features *features, unsigned int tag)
 
void shape_start_next_stage (struct shaping_features *features, stage_func func)
 
struct scriptshaping_cache * create_scriptshaping_cache (void *context, const struct shaping_font_ops *font_ops)
 
void release_scriptshaping_cache (struct scriptshaping_cache *)
 
struct scriptshaping_cache * fontface_get_shaping_cache (struct dwrite_fontface *fontface)
 
void opentype_layout_scriptshaping_cache_init (struct scriptshaping_cache *cache)
 
unsigned int opentype_layout_find_script (const struct scriptshaping_cache *cache, unsigned int kind, DWORD tag, unsigned int *script_index)
 
unsigned int opentype_layout_find_language (const struct scriptshaping_cache *cache, unsigned int kind, DWORD tag, unsigned int script_index, unsigned int *language_index)
 
void opentype_layout_apply_gsub_features (struct scriptshaping_context *context, unsigned int script_index, unsigned int language_index, struct shaping_features *features)
 
void opentype_layout_apply_gpos_features (struct scriptshaping_context *context, unsigned int script_index, unsigned int language_index, struct shaping_features *features)
 
BOOL opentype_layout_check_feature (struct scriptshaping_context *context, unsigned int script_index, unsigned int language_index, struct shaping_feature *feature, unsigned int glyph_count, const UINT16 *glyphs, UINT8 *feature_applies)
 
void opentype_layout_unsafe_to_break (struct scriptshaping_context *context, unsigned int start, unsigned int end)
 
BOOL opentype_has_vertical_variants (struct dwrite_fontface *fontface)
 
HRESULT opentype_get_vertical_glyph_variants (struct dwrite_fontface *fontface, unsigned int glyph_count, const UINT16 *nominal_glyphs, UINT16 *glyphs)
 
HRESULT shape_get_glyphs (struct scriptshaping_context *context, const unsigned int *scripts)
 
HRESULT shape_get_positions (struct scriptshaping_context *context, const unsigned int *scripts)
 
HRESULT shape_get_typographic_features (struct scriptshaping_context *context, const unsigned int *scripts, unsigned int max_tagcount, unsigned int *actual_tagcount, DWRITE_FONT_FEATURE_TAG *tags)
 
HRESULT shape_check_typographic_feature (struct scriptshaping_context *context, const unsigned int *scripts, unsigned int tag, unsigned int glyph_count, const UINT16 *glyphs, UINT8 *feature_applies)
 
void dwrite_fontface_get_glyph_bbox (IDWriteFontFace *fontface, struct dwrite_glyphbitmap *bitmap)
 

Variables

static const DWRITE_MATRIX identity
 
static const MATRIX_2X2 identity_2x2
 
const struct shaper arabic_shaper
 
HMODULE dwrite_module
 

Macro Definition Documentation

◆ GLYPH_BLOCK_MASK

#define GLYPH_BLOCK_MASK   (GLYPH_BLOCK_SIZE - 1)

Definition at line 194 of file dwrite_private.h.

◆ GLYPH_BLOCK_SHIFT

#define GLYPH_BLOCK_SHIFT   8

Definition at line 192 of file dwrite_private.h.

◆ GLYPH_BLOCK_SIZE

#define GLYPH_BLOCK_SIZE   (1UL << GLYPH_BLOCK_SHIFT)

Definition at line 193 of file dwrite_private.h.

◆ GLYPH_MAX

#define GLYPH_MAX   65536

Definition at line 195 of file dwrite_private.h.

◆ MAX_SHAPING_STAGE

#define MAX_SHAPING_STAGE   16

Definition at line 699 of file dwrite_private.h.

◆ MS_GPOS_TAG

#define MS_GPOS_TAG   DWRITE_MAKE_OPENTYPE_TAG('G','P','O','S')

Definition at line 31 of file dwrite_private.h.

◆ MS_GSUB_TAG

#define MS_GSUB_TAG   DWRITE_MAKE_OPENTYPE_TAG('G','S','U','B')

Definition at line 30 of file dwrite_private.h.

Typedef Documentation

◆ MATRIX_2X2

◆ p_apply_context_lookup

typedef void(* p_apply_context_lookup) (struct scriptshaping_context *context, unsigned int lookup_index)

Definition at line 674 of file dwrite_private.h.

◆ p_cmap_get_glyph_func

typedef UINT16(* p_cmap_get_glyph_func) (const struct dwrite_cmap *cmap, unsigned int ch)

Definition at line 210 of file dwrite_private.h.

◆ p_cmap_get_ranges_func

typedef unsigned int(* p_cmap_get_ranges_func) (const struct dwrite_cmap *cmap, unsigned int max_count, DWRITE_UNICODE_RANGE *ranges)

Definition at line 211 of file dwrite_private.h.

◆ p_dwrite_fontface_get_font_object

typedef UINT64(* p_dwrite_fontface_get_font_object) (struct dwrite_fontface *fontface)

Definition at line 255 of file dwrite_private.h.

◆ stage_func

typedef void(* stage_func) (struct scriptshaping_context *context, const struct shaping_features *features)

Definition at line 703 of file dwrite_private.h.

Enumeration Type Documentation

◆ dwrite_outline_tags

Enumerator
OUTLINE_BEGIN_FIGURE 
OUTLINE_END_FIGURE 
OUTLINE_LINE 
OUTLINE_BEZIER 

Definition at line 584 of file dwrite_private.h.

585{
590};
@ OUTLINE_BEZIER
@ OUTLINE_END_FIGURE
@ OUTLINE_BEGIN_FIGURE
@ OUTLINE_LINE

◆ font_flags

Enumerator
FONT_IS_SYMBOL 
FONT_IS_MONOSPACED 
FONT_IS_COLORED 
FONTFACE_KERNING_PAIRS 
FONTFACE_NO_KERNING_PAIRS 
FONTFACE_VERTICAL_VARIANTS 
FONTFACE_NO_VERTICAL_VARIANTS 

Definition at line 197 of file dwrite_private.h.

198{
199 FONT_IS_SYMBOL = 0x00000001,
200 FONT_IS_MONOSPACED = 0x00000002,
201 FONT_IS_COLORED = 0x00000004, /* CPAL/COLR support */
202 FONTFACE_KERNING_PAIRS = 0x00000008,
203 FONTFACE_NO_KERNING_PAIRS = 0x00000010,
204 FONTFACE_VERTICAL_VARIANTS = 0x00000020,
206};
@ FONT_IS_COLORED
@ FONTFACE_KERNING_PAIRS
@ FONTFACE_VERTICAL_VARIANTS
@ FONTFACE_NO_VERTICAL_VARIANTS
@ FONT_IS_SYMBOL
@ FONT_IS_MONOSPACED
@ FONTFACE_NO_KERNING_PAIRS

◆ gasp_flags

Enumerator
GASP_GRIDFIT 
GASP_DOGRAY 
GASP_SYMMETRIC_GRIDFIT 
GASP_SYMMETRIC_SMOOTHING 

Definition at line 552 of file dwrite_private.h.

552 {
553 GASP_GRIDFIT = 0x0001,
554 GASP_DOGRAY = 0x0002,
555 GASP_SYMMETRIC_GRIDFIT = 0x0004,
557};
@ GASP_DOGRAY
@ GASP_SYMMETRIC_GRIDFIT
@ GASP_GRIDFIT
@ GASP_SYMMETRIC_SMOOTHING

◆ SCRIPT_JUSTIFY

Enumerator
SCRIPT_JUSTIFY_NONE 
SCRIPT_JUSTIFY_ARABIC_BLANK 
SCRIPT_JUSTIFY_CHARACTER 
SCRIPT_JUSTIFY_RESERVED1 
SCRIPT_JUSTIFY_BLANK 
SCRIPT_JUSTIFY_RESERVED2 
SCRIPT_JUSTIFY_RESERVED3 
SCRIPT_JUSTIFY_ARABIC_NORMAL 
SCRIPT_JUSTIFY_ARABIC_KASHIDA 
SCRIPT_JUSTIFY_ARABIC_ALEF 
SCRIPT_JUSTIFY_ARABIC_HA 
SCRIPT_JUSTIFY_ARABIC_RA 
SCRIPT_JUSTIFY_ARABIC_BA 
SCRIPT_JUSTIFY_ARABIC_BARA 
SCRIPT_JUSTIFY_ARABIC_SEEN 
SCRIPT_JUSTIFY_ARABIC_SEEN_M 

Definition at line 610 of file dwrite_private.h.

611{
628};
@ SCRIPT_JUSTIFY_ARABIC_RA
@ SCRIPT_JUSTIFY_ARABIC_HA
@ SCRIPT_JUSTIFY_RESERVED3
@ SCRIPT_JUSTIFY_ARABIC_SEEN
@ SCRIPT_JUSTIFY_ARABIC_BLANK
@ SCRIPT_JUSTIFY_ARABIC_NORMAL
@ SCRIPT_JUSTIFY_RESERVED1
@ SCRIPT_JUSTIFY_ARABIC_BA
@ SCRIPT_JUSTIFY_RESERVED2
@ SCRIPT_JUSTIFY_ARABIC_SEEN_M
@ SCRIPT_JUSTIFY_NONE
@ SCRIPT_JUSTIFY_ARABIC_BARA
@ SCRIPT_JUSTIFY_BLANK
@ SCRIPT_JUSTIFY_CHARACTER
@ SCRIPT_JUSTIFY_ARABIC_ALEF
@ SCRIPT_JUSTIFY_ARABIC_KASHIDA

◆ shaping_feature_flags

Enumerator
FEATURE_GLOBAL 
FEATURE_GLOBAL_SEARCH 
FEATURE_MANUAL_ZWNJ 
FEATURE_MANUAL_ZWJ 
FEATURE_MANUAL_JOINERS 
FEATURE_HAS_FALLBACK 
FEATURE_NEEDS_FALLBACK 

Definition at line 676 of file dwrite_private.h.

677{
678 FEATURE_GLOBAL = 0x1,
681 FEATURE_MANUAL_ZWJ = 0x8,
685};
@ FEATURE_NEEDS_FALLBACK
@ FEATURE_MANUAL_ZWNJ
@ FEATURE_GLOBAL_SEARCH
@ FEATURE_MANUAL_ZWJ
@ FEATURE_GLOBAL
@ FEATURE_MANUAL_JOINERS
@ FEATURE_HAS_FALLBACK

Function Documentation

◆ add_localizedstring()

HRESULT add_localizedstring ( IDWriteLocalizedStrings *  iface,
const WCHAR *  locale,
const WCHAR *  string 
)

Definition at line 466 of file main.c.

467{
469 size_t i, count = strings->count;
470
471 /* Make sure there's no duplicates, unless it's empty. This is used by dlng/slng entries of 'meta' table. */
472 if (*locale)
473 {
474 for (i = 0; i < count; i++)
475 if (!wcsicmp(strings->data[i].locale, locale))
476 return S_OK;
477 }
478
479 if (!dwrite_array_reserve((void **)&strings->data, &strings->size, strings->count + 1, sizeof(*strings->data)))
480 return E_OUTOFMEMORY;
481
482 strings->data[count].locale = wcsdup(locale);
483 strings->data[count].string = wcsdup(string);
484 if (!strings->data[count].locale || !strings->data[count].string)
485 {
486 free(strings->data[count].locale);
487 free(strings->data[count].string);
488 return E_OUTOFMEMORY;
489 }
490 wcslwr(strings->data[count].locale);
491
492 strings->count++;
493
494 return S_OK;
495}
Definition: _locale.h:75
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define free
Definition: debug_ros.c:5
static struct localizedstrings * impl_from_IDWriteLocalizedStrings(IDWriteLocalizedStrings *iface)
Definition: main.c:275
#define wcsicmp
Definition: compat.h:15
static wchar_t * wcslwr(wchar_t *str)
Definition: string.h:96
static wchar_t * wcsdup(const wchar_t *str)
Definition: string.h:94
static BOOL dwrite_array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei const GLchar *const * strings
Definition: glext.h:7622
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define S_OK
Definition: intsafe.h:52

Referenced by eudc_collection_add_family(), fontcollection_add_replacement(), init_font_data_from_font(), opentype_decode_namerecord(), and opentype_get_font_strings_from_meta().

◆ bidi_computelevels()

HRESULT bidi_computelevels ( struct bidi_char *  chars,
unsigned int  count,
UINT8  baselevel 
)

Definition at line 1070 of file bidi.c.

1071{
1072 IsolatedRun *iso_run, *next;
1073 struct list IsolatingRuns;
1074 HRESULT hr;
1075
1076 if (TRACE_ON(bidi)) bidi_dump_types("start ", chars, 0, count);
1077
1078 bidi_resolve_explicit(chars, count, baselevel);
1079
1080 if (TRACE_ON(bidi)) bidi_dump_types("after explicit", chars, 0, count);
1081
1082 /* X10/BD13: Compute Isolating runs */
1083 if (FAILED(hr = bidi_compute_isolating_runs_set(chars, count, baselevel, &IsolatingRuns)))
1084 {
1085 WARN("Failed to compute isolating runs set, hr %#lx.\n", hr);
1086 return hr;
1087 }
1088
1089 LIST_FOR_EACH_ENTRY_SAFE(iso_run, next, &IsolatingRuns, IsolatedRun, entry)
1090 {
1091 if (TRACE_ON(bidi)) iso_dump_types("run", iso_run);
1092
1093 bidi_resolve_weak(iso_run);
1094 if (TRACE_ON(bidi)) iso_dump_types("after weak", iso_run);
1095
1096 bidi_resolve_neutrals(iso_run);
1097 if (TRACE_ON(bidi)) iso_dump_types("after neutrals", iso_run);
1098
1099 list_remove(&iso_run->entry);
1100 free(iso_run);
1101 }
1102
1103 if (TRACE_ON(bidi)) bidi_dump_types("before implicit", chars, 0, count);
1105
1106 bidi_resolve_resolved(chars, count, baselevel);
1107
1108 return S_OK;
1109}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
#define WARN(fmt,...)
Definition: precomp.h:61
Definition: list.h:39
HRESULT hr
Definition: delayimp.cpp:582
static void bidi_resolve_implicit(struct bidi_char *chars, unsigned int count)
Definition: bidi.c:854
static void bidi_resolve_explicit(struct bidi_char *chars, unsigned int count, UINT8 baselevel)
Definition: bidi.c:197
static void iso_dump_types(const char *header, IsolatedRun *run)
Definition: bidi.c:475
static void bidi_dump_types(const char *header, const struct bidi_char *chars, UINT32 start, UINT32 end)
Definition: bidi.c:139
static void bidi_resolve_weak(IsolatedRun *iso_run)
Definition: bidi.c:509
static void bidi_resolve_resolved(struct bidi_char *chars, unsigned int count, UINT8 baselevel)
Definition: bidi.c:898
static void bidi_resolve_neutrals(IsolatedRun *run)
Definition: bidi.c:719
static HRESULT bidi_compute_isolating_runs_set(struct bidi_char *chars, unsigned int count, UINT8 baselevel, struct list *set)
Definition: bidi.c:932
#define TRACE_ON(x)
Definition: compat.h:75
#define FAILED(hr)
Definition: intsafe.h:51
uint32_t entry
Definition: isohybrid.c:63
static unsigned __int64 next
Definition: rand_nt.c:6
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:242
struct list entry
Definition: bidi.c:449

Referenced by dwritetextanalyzer_AnalyzeBidi().

◆ clone_localizedstrings()

HRESULT clone_localizedstrings ( IDWriteLocalizedStrings *  iface,
IDWriteLocalizedStrings **  strings 
)

Definition at line 497 of file main.c.

498{
499 struct localizedstrings *strings, *strings_clone;
500 size_t i;
501
502 *ret = NULL;
503
504 if (!iface)
505 return S_FALSE;
506
508 if (!(strings_clone = calloc(1, sizeof(*strings_clone))))
509 return E_OUTOFMEMORY;
510
511 if (!dwrite_array_reserve((void **)&strings_clone->data, &strings_clone->size, strings->count,
512 sizeof(*strings_clone->data)))
513 {
514 free(strings_clone);
515 return E_OUTOFMEMORY;
516 }
517
519 strings_clone->refcount = 1;
520 strings_clone->count = strings->count;
521
522 for (i = 0; i < strings_clone->count; ++i)
523 {
524 strings_clone->data[i].locale = wcsdup(strings->data[i].locale);
525 strings_clone->data[i].string = wcsdup(strings->data[i].string);
526 }
527
528 *ret = &strings_clone->IDWriteLocalizedStrings_iface;
529
530 return S_OK;
531}
#define NULL
Definition: types.h:112
static const IDWriteLocalizedStringsVtbl localizedstringsvtbl
Definition: main.c:436
return ret
Definition: mutex.c:147
#define calloc
Definition: rosglue.h:14
LONG refcount
Definition: main.c:268
IDWriteLocalizedStrings IDWriteLocalizedStrings_iface
Definition: main.c:267
size_t count
Definition: main.c:272
struct localizedpair * data
Definition: main.c:270
size_t size
Definition: main.c:271
#define S_FALSE
Definition: winerror.h:3451

Referenced by dwritefont_GetFaceNames(), dwritefontface3_GetFaceNames(), dwritefontface3_GetFamilyNames(), dwritefontfamily_GetFamilyNames(), and get_font_info_strings().

◆ compute_glyph_origins()

HRESULT compute_glyph_origins ( DWRITE_GLYPH_RUN const *  run,
DWRITE_MEASURING_MODE  measuring_mode,
D2D1_POINT_2F  baseline_origin,
DWRITE_MATRIX const *  transform,
D2D1_POINT_2F *  origins 
)

Definition at line 1726 of file main.c.

1728{
1729 struct dwrite_fontface *font_obj;
1730 unsigned int i;
1731 float advance;
1732
1733 font_obj = unsafe_impl_from_IDWriteFontFace(run->fontFace);
1734
1735 for (i = 0; i < run->glyphCount; ++i)
1736 {
1737 origins[i] = baseline_origin;
1738
1739 if (run->bidiLevel & 1)
1740 {
1741 advance = fontface_get_scaled_design_advance(font_obj, measuring_mode, run->fontEmSize,
1742 1.0f, transform, run->glyphIndices[i], run->isSideways);
1743
1744 origins[i].x -= advance;
1745
1746 if (run->glyphOffsets)
1747 {
1748 origins[i].x -= run->glyphOffsets[i].advanceOffset;
1749 origins[i].y -= run->glyphOffsets[i].ascenderOffset;
1750 }
1751
1752 baseline_origin.x -= run->glyphAdvances ? run->glyphAdvances[i] : advance;
1753 }
1754 else
1755 {
1756 if (run->glyphOffsets)
1757 {
1758 origins[i].x += run->glyphOffsets[i].advanceOffset;
1759 origins[i].y -= run->glyphOffsets[i].ascenderOffset;
1760 }
1761
1762 baseline_origin.x += run->glyphAdvances ? run->glyphAdvances[i] :
1763 fontface_get_scaled_design_advance(font_obj, measuring_mode, run->fontEmSize, 1.0f, transform,
1764 run->glyphIndices[i], run->isSideways);
1765
1766 }
1767 }
1768
1769 return S_OK;
1770}
_STLP_MOVE_TO_STD_NAMESPACE void _STLP_CALL advance(_InputIterator &__i, _Distance __n)
float fontface_get_scaled_design_advance(struct dwrite_fontface *fontface, DWRITE_MEASURING_MODE measuring_mode, float emsize, float ppdip, const DWRITE_MATRIX *transform, UINT16 glyph, BOOL is_sideways)
Definition: font.c:6384
struct dwrite_fontface * unsafe_impl_from_IDWriteFontFace(IDWriteFontFace *iface)
Definition: font.c:2536
GLuint GLenum GLenum transform
Definition: glext.h:9407

Referenced by create_glyphrunanalysis(), dwritefactory4_ComputeGlyphOrigins(), dwritefactory4_ComputeGlyphOrigins_(), dwritefontface_GetGlyphRunOutline(), and layout_get_erun_bbox().

◆ create_colorglyphenum()

◆ create_font_collection()

HRESULT create_font_collection ( IDWriteFactory7 *  factory,
IDWriteFontFileEnumerator *  enumerator,
BOOL  is_system,
IDWriteFontCollection3 **  collection 
)

Definition at line 4649 of file font.c.

4651{
4652 struct fontfile_enum {
4653 struct list entry;
4655 };
4656 struct fontfile_enum *fileenum, *fileenum2;
4658 struct list scannedfiles;
4659 BOOL current = FALSE;
4660 HRESULT hr = S_OK;
4661 size_t i;
4662
4663 *ret = NULL;
4664
4665 if (!(collection = calloc(1, sizeof(*collection))))
4666 return E_OUTOFMEMORY;
4667
4669 if (FAILED(hr))
4670 {
4672 return hr;
4673 }
4674
4675 *ret = &collection->IDWriteFontCollection3_iface;
4676
4677 TRACE("building font collection:\n");
4678
4679 list_init(&scannedfiles);
4680 while (hr == S_OK) {
4681 DWRITE_FONT_FACE_TYPE face_type;
4683 BOOL supported, same = FALSE;
4687
4688 current = FALSE;
4689 hr = IDWriteFontFileEnumerator_MoveNext(enumerator, &current);
4690 if (FAILED(hr) || !current)
4691 break;
4692
4693 hr = IDWriteFontFileEnumerator_GetCurrentFontFile(enumerator, &file);
4694 if (FAILED(hr))
4695 break;
4696
4697 /* check if we've scanned this file already */
4698 LIST_FOR_EACH_ENTRY(fileenum, &scannedfiles, struct fontfile_enum, entry) {
4699 if ((same = is_same_fontfile(fileenum->file, file)))
4700 break;
4701 }
4702
4703 if (same) {
4704 IDWriteFontFile_Release(file);
4705 continue;
4706 }
4707
4709 IDWriteFontFile_Release(file);
4710 continue;
4711 }
4712
4713 /* Unsupported formats are skipped. */
4714 hr = opentype_analyze_font(stream, &supported, &file_type, &face_type, &face_count);
4715 if (FAILED(hr) || !supported || face_count == 0) {
4716 TRACE("Unsupported font (%p, 0x%08lx, %d, %u)\n", file, hr, supported, face_count);
4717 IDWriteFontFileStream_Release(stream);
4718 IDWriteFontFile_Release(file);
4719 hr = S_OK;
4720 continue;
4721 }
4722
4723 /* add to scanned list */
4724 fileenum = malloc(sizeof(*fileenum));
4725 fileenum->file = file;
4726 list_add_tail(&scannedfiles, &fileenum->entry);
4727
4728 for (i = 0; i < face_count; ++i)
4729 {
4731 struct fontface_desc desc;
4732 WCHAR familyW[255];
4733 UINT32 index;
4734
4735 desc.factory = factory;
4736 desc.face_type = face_type;
4737 desc.file = file;
4738 desc.stream = stream;
4739 desc.index = i;
4740 desc.simulations = DWRITE_FONT_SIMULATIONS_NONE;
4741 desc.font_data = NULL;
4742
4743 /* Allocate an initialize new font data structure. */
4745 if (FAILED(hr))
4746 {
4747 /* move to next one */
4748 hr = S_OK;
4749 continue;
4750 }
4751
4752 fontstrings_get_en_string(font_data->family_names, familyW, ARRAY_SIZE(familyW));
4753
4754 /* ignore dot named faces */
4755 if (familyW[0] == '.')
4756 {
4757 WARN("Ignoring face %s\n", debugstr_w(familyW));
4759 continue;
4760 }
4761
4763 if (index != ~0u)
4765 else {
4766 struct dwrite_fontfamily_data *family_data;
4767
4768 /* create and init new family */
4769 hr = init_fontfamily_data(font_data->family_names, &family_data);
4770 if (hr == S_OK) {
4771 /* add font to family, family - to collection */
4772 hr = fontfamily_add_font(family_data, font_data);
4773 if (hr == S_OK)
4774 hr = fontcollection_add_family(collection, family_data);
4775
4776 if (FAILED(hr))
4777 release_fontfamily_data(family_data);
4778 }
4779 }
4780
4781 if (FAILED(hr))
4782 {
4784 break;
4785 }
4786 }
4787
4788 IDWriteFontFileStream_Release(stream);
4789 }
4790
4791 LIST_FOR_EACH_ENTRY_SAFE(fileenum, fileenum2, &scannedfiles, struct fontfile_enum, entry)
4792 {
4793 IDWriteFontFile_Release(fileenum->file);
4794 list_remove(&fileenum->entry);
4795 free(fileenum);
4796 }
4797
4798 for (i = 0; i < collection->count; ++i)
4799 {
4802 }
4803
4804 if (is_system)
4806
4807 return hr;
4808}
#define index(s, c)
Definition: various.h:29
#define ARRAY_SIZE(A)
Definition: main.h:20
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
static void list_init(struct list_entry *head)
Definition: list.h:51
#define malloc
Definition: debug_ros.c:4
#define FALSE
Definition: types.h:117
static void fontfamily_add_oblique_simulated_face(struct dwrite_fontfamily_data *family)
Definition: font.c:4499
HRESULT get_filestream_from_file(IDWriteFontFile *file, IDWriteFontFileStream **stream)
Definition: font.c:3563
static void fontcollection_add_replacements(struct dwrite_fontcollection *collection)
Definition: font.c:4603
static HRESULT init_font_collection(struct dwrite_fontcollection *collection, IDWriteFactory7 *factory, DWRITE_FONT_FAMILY_MODEL family_model, BOOL is_system)
Definition: font.c:3551
static HRESULT fontcollection_add_family(struct dwrite_fontcollection *collection, struct dwrite_fontfamily_data *family)
Definition: font.c:3538
static void release_font_data(struct dwrite_font_data *data)
Definition: font.c:726
static HRESULT fontfamily_add_font(struct dwrite_fontfamily_data *family_data, struct dwrite_font_data *font_data)
Definition: font.c:3520
static HRESULT init_fontfamily_data(IDWriteLocalizedStrings *familyname, struct dwrite_fontfamily_data **ret)
Definition: font.c:4408
static void release_fontfamily_data(struct dwrite_fontfamily_data *data)
Definition: font.c:750
static HRESULT init_font_data(const struct fontface_desc *desc, DWRITE_FONT_FAMILY_MODEL family_model, struct dwrite_font_data **ret)
Definition: font.c:4298
static UINT32 collection_find_family(struct dwrite_fontcollection *collection, const WCHAR *name)
Definition: font.c:3315
static BOOL is_same_fontfile(IDWriteFontFile *left, IDWriteFontFile *right)
Definition: font.c:770
static void fontstrings_get_en_string(IDWriteLocalizedStrings *strings, WCHAR *buffer, UINT32 size)
Definition: font.c:3588
static void fontfamily_add_bold_simulated_face(struct dwrite_fontfamily_data *family)
Definition: font.c:4424
DWRITE_FONT_FILE_TYPE
Definition: dwrite.idl:47
DWRITE_FONT_FACE_TYPE
Definition: dwrite.idl:60
@ DWRITE_FONT_SIMULATIONS_NONE
Definition: dwrite.idl:146
@ DWRITE_FONT_FAMILY_MODEL_WEIGHT_STRETCH_STYLE
Definition: dwrite_3.idl:171
HRESULT opentype_analyze_font(IDWriteFontFileStream *, BOOL *, DWRITE_FONT_FILE_TYPE *, DWRITE_FONT_FACE_TYPE *, UINT32 *)
Definition: opentype.c:1492
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint index
Definition: glext.h:6031
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define debugstr_w
Definition: kernel32.h:32
struct task_struct * current
Definition: linux.c:32
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
int face_count
Definition: d3drm.c:3529
short WCHAR
Definition: pedump.c:58
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:236
FD_TYPE file_type(FDSC **curr, char *fixed)
Definition: file.c:221
#define TRACE(s)
Definition: solgame.cpp:4
Definition: main.c:439
Definition: fci.c:123
IDWriteFactory7 * factory
IDWriteFontFile * file
DWRITE_FONT_FACE_TYPE face_type
IDWriteFontFileStream * stream
Definition: parse.h:23
uint32_t UINT32
Definition: typedefs.h:59

Referenced by dwritefactory_CreateCustomFontCollection(), and get_system_fontcollection().

◆ create_font_collection_from_set()

HRESULT create_font_collection_from_set ( IDWriteFactory7 *  factory,
IDWriteFontSet *  set,
DWRITE_FONT_FAMILY_MODEL  family_model,
REFGUID  riid,
void **  ret 
)

Definition at line 4857 of file font.c.

4859{
4862 HRESULT hr = S_OK;
4863 size_t i;
4864
4865 *ret = NULL;
4866
4867 if (!(collection = calloc(1, sizeof(*collection))))
4868 return E_OUTOFMEMORY;
4869
4871 {
4873 return hr;
4874 }
4875
4876 for (i = 0; i < set->count; ++i)
4877 {
4878 const struct dwrite_fontset_entry *entry = set->entries[i];
4880 struct fontface_desc desc;
4881
4882 if (FAILED(get_filestream_from_file(entry->desc.file, &stream)))
4883 {
4884 WARN("Failed to get file stream.\n");
4885 continue;
4886 }
4887
4888 desc.factory = factory;
4889 desc.face_type = entry->desc.face_type;
4890 desc.file = entry->desc.file;
4891 desc.stream = stream;
4892 desc.index = entry->desc.face_index;
4893 desc.simulations = entry->desc.simulations;
4894 desc.font_data = NULL;
4895
4897 WARN("Failed to add font collection element, hr %#lx.\n", hr);
4898
4899 IDWriteFontFileStream_Release(stream);
4900 }
4901
4903 {
4904 for (i = 0; i < collection->count; ++i)
4905 {
4908 }
4909 }
4910
4911 hr = IDWriteFontCollection3_QueryInterface(&collection->IDWriteFontCollection3_iface, riid, ret);
4912 IDWriteFontCollection3_Release(&collection->IDWriteFontCollection3_iface);
4913
4914 return hr;
4915}
Definition: _set.h:50
_STLP_TEMPLATE_FOR_CONT_EXT size_type count(const _KT &__x) const
Definition: _set.h:193
static HRESULT collection_add_font_entry(struct dwrite_fontcollection *collection, const struct fontface_desc *desc)
Definition: font.c:4810
static struct dwrite_fontset * unsafe_impl_from_IDWriteFontSet(IDWriteFontSet *iface)
Definition: font.c:8099
REFIID riid
Definition: atlbase.h:39
DWRITE_FONT_FAMILY_MODEL family_model
Definition: font.c:345
Definition: font.c:476

Referenced by dwritefactory3_CreateFontCollectionFromFontSet(), dwritefactory6_CreateFontCollectionFromFontSet(), and get_system_fontcollection().

◆ create_font_file()

HRESULT create_font_file ( IDWriteFontFileLoader *  loader,
const void *  reference_key,
UINT32  key_size,
IDWriteFontFile **  font_file 
)

Definition at line 5400 of file font.c.

5402{
5403 struct dwrite_fontfile *file;
5404 void *key;
5405
5406 *ret = NULL;
5407
5408 file = calloc(1, sizeof(*file));
5409 key = malloc(key_size);
5410 if (!file || !key)
5411 {
5412 free(file);
5413 free(key);
5414 return E_OUTOFMEMORY;
5415 }
5416
5417 file->IDWriteFontFile_iface.lpVtbl = &dwritefontfilevtbl;
5418 file->refcount = 1;
5419 IDWriteFontFileLoader_AddRef(loader);
5420 file->loader = loader;
5421 file->stream = NULL;
5422 file->reference_key = key;
5423 memcpy(file->reference_key, reference_key, key_size);
5424 file->key_size = key_size;
5425
5426 *ret = &file->IDWriteFontFile_iface;
5427
5428 return S_OK;
5429}
static const IDWriteFontFileVtbl dwritefontfilevtbl
Definition: font.c:5390
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
UINT32 key_size
Definition: font.c:435
void * reference_key
Definition: font.c:434
IDWriteFontFileLoader * loader
Definition: font.c:433
Definition: copy.c:22
Definition: loader.c:72

Referenced by dwritefactory_CreateCustomFontFileReference(), and dwritefactory_CreateFontFileReference().

◆ create_font_resource()

HRESULT create_font_resource ( IDWriteFactory7 *  factory,
IDWriteFontFile *  file,
UINT32  face_index,
IDWriteFontResource **  resource 
)

Definition at line 7583 of file font.c.

7585{
7587 struct file_stream_desc stream_desc;
7590 unsigned int face_count;
7591 BOOL supported = FALSE;
7592 HRESULT hr;
7593
7594 *ret = NULL;
7595
7596 if (FAILED(hr = IDWriteFontFile_Analyze(file, &supported, &file_type, &face_type, &face_count)))
7597 return hr;
7598
7599 if (!supported)
7600 return DWRITE_E_FILEFORMAT;
7601
7602 if (!(resource = calloc(1, sizeof(*resource))))
7603 return E_OUTOFMEMORY;
7604
7605 resource->IDWriteFontResource_iface.lpVtbl = &fontresourcevtbl;
7606 resource->refcount = 1;
7607 resource->face_index = face_index;
7608 resource->file = file;
7609 IDWriteFontFile_AddRef(resource->file);
7610 resource->factory = factory;
7611 IDWriteFactory7_AddRef(resource->factory);
7612
7613 get_filestream_from_file(file, &stream_desc.stream);
7614 stream_desc.face_type = face_type;
7615 stream_desc.face_index = face_index;
7616
7617 opentype_get_font_var_axis(&stream_desc, &resource->axis, &resource->axis_count);
7618
7619 if (stream_desc.stream)
7620 IDWriteFontFileStream_Release(stream_desc.stream);
7621
7622 *ret = &resource->IDWriteFontResource_iface;
7623
7624 return S_OK;
7625}
static const IDWriteFontResourceVtbl fontresourcevtbl
Definition: font.c:7564
HRESULT opentype_get_font_var_axis(const struct file_stream_desc *stream_desc, struct dwrite_var_axis **axis, unsigned int *axis_count)
Definition: opentype.c:6693
#define resource
Definition: kernel32.h:9
DWRITE_FONT_FACE_TYPE face_type
#define DWRITE_E_FILEFORMAT
Definition: winerror.h:7334

Referenced by dwritefactory6_CreateFontResource().

◆ create_fontface()

HRESULT create_fontface ( const struct fontface_desc *  desc,
struct list *  cached_list,
IDWriteFontFace5 **  fontface 
)

Definition at line 5473 of file font.c.

5474{
5475 struct file_stream_desc stream_desc;
5477 struct dwrite_fontface *fontface;
5478 HRESULT hr;
5479 int i;
5480
5481 *ret = NULL;
5482
5483 if (!(fontface = calloc(1, sizeof(*fontface))))
5484 return E_OUTOFMEMORY;
5485
5486 fontface->IDWriteFontFace5_iface.lpVtbl = &dwritefontfacevtbl;
5488 fontface->refcount = 1;
5489 fontface->type = desc->face_type;
5490 fontface->vdmx.exists = TRUE;
5491 fontface->gasp.exists = TRUE;
5492 fontface->cpal.exists = TRUE;
5493 fontface->colr.exists = TRUE;
5494 fontface->kern.exists = TRUE;
5495 fontface->index = desc->index;
5496 fontface->simulations = desc->simulations;
5497 fontface->factory = desc->factory;
5498 IDWriteFactory7_AddRef(fontface->factory);
5499 fontface->file = desc->file;
5500 IDWriteFontFile_AddRef(fontface->file);
5501 fontface->stream = desc->stream;
5502 IDWriteFontFileStream_AddRef(fontface->stream);
5503 InitializeCriticalSection(&fontface->cs);
5504 fontface_cache_init(fontface);
5505
5506 stream_desc.stream = fontface->stream;
5507 stream_desc.face_type = desc->face_type;
5508 stream_desc.face_index = desc->index;
5509 opentype_get_font_metrics(&stream_desc, &fontface->metrics, &fontface->caret);
5510 opentype_get_font_typo_metrics(&stream_desc, &fontface->typo_metrics.ascent, &fontface->typo_metrics.descent);
5511 if (desc->simulations & DWRITE_FONT_SIMULATIONS_OBLIQUE) {
5512 /* TODO: test what happens if caret is already slanted */
5513 if (fontface->caret.slopeRise == 1) {
5514 fontface->caret.slopeRise = fontface->metrics.designUnitsPerEm;
5515 fontface->caret.slopeRun = fontface->caret.slopeRise / 3;
5516 }
5517 }
5519
5520 /* Font properties are reused from font object when 'normal' face creation path is used:
5521 collection -> family -> matching font -> fontface.
5522
5523 If face is created directly from factory we have to go through properties resolution.
5524 */
5525 if (desc->font_data)
5526 {
5527 font_data = addref_font_data(desc->font_data);
5528 }
5529 else
5530 {
5532 if (FAILED(hr))
5533 {
5534 IDWriteFontFace5_Release(&fontface->IDWriteFontFace5_iface);
5535 return hr;
5536 }
5537 }
5538
5539 fontface->weight = font_data->weight;
5540 fontface->style = font_data->style;
5541 fontface->stretch = font_data->stretch;
5542 fontface->panose = font_data->panose;
5543 fontface->fontsig = font_data->fontsig;
5544 fontface->lf = font_data->lf;
5546 fontface->names = font_data->names;
5547 if (fontface->names)
5548 IDWriteLocalizedStrings_AddRef(fontface->names);
5549 fontface->family_names = font_data->family_names;
5550 if (fontface->family_names)
5551 IDWriteLocalizedStrings_AddRef(fontface->family_names);
5552 memcpy(fontface->info_strings, font_data->info_strings, sizeof(fontface->info_strings));
5553 for (i = 0; i < ARRAY_SIZE(fontface->info_strings); ++i)
5554 {
5555 if (fontface->info_strings[i])
5556 IDWriteLocalizedStrings_AddRef(fontface->info_strings[i]);
5557 }
5558 fontface->cmap.stream = fontface->stream;
5559 IDWriteFontFileStream_AddRef(fontface->cmap.stream);
5561
5562 fontface->cached = factory_cache_fontface(fontface->factory, cached_list, &fontface->IDWriteFontFace5_iface);
5564
5565 *ret = &fontface->IDWriteFontFace5_iface;
5566
5567 return S_OK;
5568}
#define TRUE
Definition: types.h:120
static struct dwrite_font_data * addref_font_data(struct dwrite_font_data *data)
Definition: font.c:720
static UINT64 dwrite_fontface_get_font_object(struct dwrite_fontface *fontface)
Definition: font.c:5431
static const IDWriteFontFaceReferenceVtbl dwritefontface_reference_vtbl
Definition: font.c:2184
static void fontface_cache_init(struct dwrite_fontface *fontface)
Definition: font.c:263
static const IDWriteFontFace5Vtbl dwritefontfacevtbl
Definition: font.c:1967
@ DWRITE_FONT_SIMULATIONS_OBLIQUE
Definition: dwrite.idl:148
struct fontfacecached * factory_cache_fontface(IDWriteFactory7 *factory, struct list *fontfaces, IDWriteFontFace5 *fontface)
Definition: main.c:1002
void opentype_get_font_typo_metrics(struct file_stream_desc *stream_desc, unsigned int *ascent, unsigned int *descent)
Definition: opentype.c:1954
UINT32 opentype_get_glyph_image_formats(IDWriteFontFace5 *fontface)
Definition: opentype.c:3191
void opentype_get_font_metrics(struct file_stream_desc *, DWRITE_FONT_METRICS1 *, DWRITE_CARET_METRICS *)
Definition: opentype.c:1973
UINT32 glyph_image_formats
DWRITE_FONT_METRICS1 metrics
struct dwrite_fontface::@309 typo_metrics
struct dwrite_cmap cmap
DWRITE_FONT_STYLE style
DWRITE_FONT_WEIGHT weight
CRITICAL_SECTION cs
IDWriteFontFaceReference IDWriteFontFaceReference_iface
IDWriteLocalizedStrings * info_strings[DWRITE_INFORMATIONAL_STRING_SUPPORTED_SCRIPT_LANGUAGE_TAG+1]
DWRITE_CARET_METRICS caret
struct dwrite_fonttable kern
struct dwrite_fonttable cpal
struct dwrite_fonttable gasp
IDWriteFactory7 * factory
DWRITE_FONT_STRETCH stretch
struct dwrite_fonttable colr
struct fontfacecached * cached
DWRITE_PANOSE panose
IDWriteFontFace5 IDWriteFontFace5_iface
p_dwrite_fontface_get_font_object get_font_object
IDWriteLocalizedStrings * family_names
IDWriteFontFile * file
IDWriteFontFileStream * stream
unsigned int flags
DWRITE_FONT_FACE_TYPE type
IDWriteLocalizedStrings * names
FONTSIGNATURE fontsig
struct dwrite_fonttable vdmx
int weight
Definition: font.c:1901
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:687

Referenced by dwritefactory_CreateFontFace(), and get_fontface_from_font().

◆ create_fontfacereference()

HRESULT create_fontfacereference ( IDWriteFactory7 *  factory,
IDWriteFontFile *  file,
UINT32  face_index,
DWRITE_FONT_SIMULATIONS  simulations,
DWRITE_FONT_AXIS_VALUE const *  axis_values,
UINT32  axis_values_count,
IDWriteFontFaceReference1 **  reference 
)

Definition at line 7082 of file font.c.

7085{
7087
7088 *ret = NULL;
7089
7091 return E_INVALIDARG;
7092
7093 if (!(object = calloc(1, sizeof(*object))))
7094 return E_OUTOFMEMORY;
7095
7096 object->IDWriteFontFaceReference1_iface.lpVtbl = &fontfacereferencevtbl;
7097 object->refcount = 1;
7098
7099 object->factory = factory;
7100 IDWriteFactory7_AddRef(object->factory);
7101 object->file = file;
7102 IDWriteFontFile_AddRef(object->file);
7103 object->index = index;
7104 object->simulations = simulations;
7106 {
7107 if (!(object->axis_values = malloc(axis_values_count * sizeof(*axis_values))))
7108 {
7109 IDWriteFontFaceReference1_Release(&object->IDWriteFontFaceReference1_iface);
7110 return E_OUTOFMEMORY;
7111 }
7112 memcpy(object->axis_values, axis_values, axis_values_count * sizeof(*axis_values));
7113 object->axis_values_count = axis_values_count;
7114 }
7115
7116 *ret = &object->IDWriteFontFaceReference1_iface;
7117
7118 return S_OK;
7119}
#define E_INVALIDARG
Definition: ddrawi.h:101
static const IDWriteFontFaceReference1Vtbl fontfacereferencevtbl
Definition: font.c:452
static BOOL is_simulation_valid(DWRITE_FONT_SIMULATIONS simulations)
IDWriteFontFile * file
Definition: font.c:444
IDWriteFactory7 * factory
Definition: font.c:449
DWRITE_FONT_AXIS_VALUE * axis_values
Definition: font.c:447
UINT32 axis_values_count
Definition: font.c:448

Referenced by dwritefactory3_CreateFontFaceReference(), dwritefactory3_CreateFontFaceReference_(), and dwritefactory6_CreateFontFaceReference().

◆ create_fontfallback_builder()

HRESULT create_fontfallback_builder ( IDWriteFactory7 *  factory,
IDWriteFontFallbackBuilder **  builder 
)

Definition at line 2929 of file analyzer.c.

2930{
2931 struct dwrite_fontfallback_builder *builder;
2932 HRESULT hr;
2933
2934 *ret = NULL;
2935
2938
2939 return hr;
2940}
static HRESULT create_fontfallback_builder_internal(IDWriteFactory7 *factory, struct dwrite_fontfallback_builder **ret)
Definition: analyzer.c:2909
#define SUCCEEDED(hr)
Definition: intsafe.h:50
IDWriteFontFallbackBuilder IDWriteFontFallbackBuilder_iface
Definition: analyzer.c:547

Referenced by dwritefactory2_CreateFontFallbackBuilder().

◆ create_fontset_builder()

HRESULT create_fontset_builder ( IDWriteFactory7 *  factory,
IDWriteFontSetBuilder2 **  ret 
)

Definition at line 8391 of file font.c.

8392{
8393 struct dwrite_fontset_builder *builder;
8394
8395 *ret = NULL;
8396
8397 if (!(builder = calloc(1, sizeof(*builder))))
8398 return E_OUTOFMEMORY;
8399
8401 builder->refcount = 1;
8402 builder->factory = factory;
8403 IDWriteFactory7_AddRef(builder->factory);
8404
8405 *ret = &builder->IDWriteFontSetBuilder2_iface;
8406
8407 return S_OK;
8408}
static const IDWriteFontSetBuilder2Vtbl fontsetbuildervtbl
Definition: font.c:8377
IDWriteFontSetBuilder2 IDWriteFontSetBuilder2_iface
Definition: font.c:494
IDWriteFactory7 * factory
Definition: font.c:496

Referenced by create_system_fontset(), dwritefactory3_CreateFontSetBuilder(), dwritefactory5_CreateFontSetBuilder(), and dwritefactory6_CreateFontSetBuilder().

◆ create_gdiinterop()

HRESULT create_gdiinterop ( IDWriteFactory7 *  factory,
IDWriteGdiInterop1 **  interop 
)

Definition at line 1110 of file gdiinterop.c.

1111{
1112 struct gdiinterop *interop;
1113
1114 *ret = NULL;
1115
1116 if (!(interop = malloc(sizeof(*interop))))
1117 return E_OUTOFMEMORY;
1118
1119 interop->IDWriteGdiInterop1_iface.lpVtbl = &gdiinteropvtbl;
1121 interop->refcount = 1;
1122 interop->factory = factory;
1123 IDWriteFactory7_AddRef(interop->factory);
1124 IDWriteFactory7_RegisterFontFileLoader(factory, &interop->IDWriteFontFileLoader_iface);
1125
1126 *ret = &interop->IDWriteGdiInterop1_iface;
1127 return S_OK;
1128}
static const IDWriteFontFileLoaderVtbl memresourceloadervtbl
Definition: gdiinterop.c:1102
static const IDWriteGdiInterop1Vtbl gdiinteropvtbl
Definition: gdiinterop.c:930
LONG refcount
Definition: gdiinterop.c:60
IDWriteFontFileLoader IDWriteFontFileLoader_iface
Definition: gdiinterop.c:59
IDWriteFactory7 * factory
Definition: gdiinterop.c:61
IDWriteGdiInterop1 IDWriteGdiInterop1_iface
Definition: gdiinterop.c:58

Referenced by dwritefactory_GetGdiInterop().

◆ create_glyphrunanalysis()

HRESULT create_glyphrunanalysis ( const struct glyphrunanalysis_desc *  desc,
IDWriteGlyphRunAnalysis **  ret 
)

Definition at line 6410 of file font.c.

6411{
6412 struct dwrite_glyphrunanalysis *analysis;
6413 unsigned int i;
6414
6415 *ret = NULL;
6416
6417 /* Check rendering, antialiasing, measuring, and grid fitting modes. */
6419 desc->rendering_mode == DWRITE_RENDERING_MODE1_OUTLINE ||
6420 desc->rendering_mode == DWRITE_RENDERING_MODE1_DEFAULT)
6421 return E_INVALIDARG;
6422
6423 if ((UINT32)desc->aa_mode > DWRITE_TEXT_ANTIALIAS_MODE_GRAYSCALE)
6424 return E_INVALIDARG;
6425
6426 if ((UINT32)desc->gridfit_mode > DWRITE_GRID_FIT_MODE_ENABLED)
6427 return E_INVALIDARG;
6428
6429 if ((UINT32)desc->measuring_mode > DWRITE_MEASURING_MODE_GDI_NATURAL)
6430 return E_INVALIDARG;
6431
6432 if (!(analysis = calloc(1, sizeof(*analysis))))
6433 return E_OUTOFMEMORY;
6434
6436 analysis->refcount = 1;
6437 analysis->rendering_mode = desc->rendering_mode;
6438
6439 if (desc->rendering_mode == DWRITE_RENDERING_MODE1_ALIASED
6440 || desc->aa_mode == DWRITE_TEXT_ANTIALIAS_MODE_GRAYSCALE)
6442 else
6444
6445 analysis->run = *desc->run;
6446 IDWriteFontFace_AddRef(analysis->run.fontFace);
6447 analysis->glyphs = calloc(desc->run->glyphCount, sizeof(*analysis->glyphs));
6448 analysis->origins = calloc(desc->run->glyphCount, sizeof(*analysis->origins));
6449
6450 if (!analysis->glyphs || !analysis->origins)
6451 {
6452 free(analysis->glyphs);
6453 free(analysis->origins);
6454
6455 analysis->glyphs = NULL;
6456 analysis->origins = NULL;
6457
6458 IDWriteGlyphRunAnalysis_Release(&analysis->IDWriteGlyphRunAnalysis_iface);
6459 return E_OUTOFMEMORY;
6460 }
6461
6462 /* check if transform is usable */
6463 if (desc->transform && memcmp(desc->transform, &identity, sizeof(*desc->transform))) {
6464 analysis->m = *desc->transform;
6465 analysis->flags |= RUNANALYSIS_USE_TRANSFORM;
6466 }
6467
6468 analysis->run.glyphIndices = analysis->glyphs;
6469 memcpy(analysis->glyphs, desc->run->glyphIndices, desc->run->glyphCount*sizeof(*desc->run->glyphIndices));
6470
6471 compute_glyph_origins(desc->run, desc->measuring_mode, desc->origin, desc->transform, analysis->origins);
6472 if (analysis->flags & RUNANALYSIS_USE_TRANSFORM)
6473 {
6474 for (i = 0; i < desc->run->glyphCount; ++i)
6475 transform_point(&analysis->origins[i], &analysis->m);
6476 }
6477
6478 *ret = &analysis->IDWriteGlyphRunAnalysis_iface;
6479 return S_OK;
6480}
@ DWRITE_MEASURING_MODE_GDI_NATURAL
Definition: dcommon.idl:39
static const IDWriteGlyphRunAnalysisVtbl glyphrunanalysisvtbl
Definition: font.c:6366
static void transform_point(D2D_POINT_2F *point, const DWRITE_MATRIX *m)
Definition: font.c:6376
@ RUNANALYSIS_USE_TRANSFORM
Definition: font.c:384
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
@ DWRITE_TEXTURE_ALIASED_1x1
Definition: dwrite.idl:347
@ DWRITE_TEXTURE_CLEARTYPE_3x1
Definition: dwrite.idl:348
@ DWRITE_GRID_FIT_MODE_ENABLED
Definition: dwrite_2.idl:31
@ DWRITE_RENDERING_MODE1_DEFAULT
Definition: dwrite_3.idl:78
@ DWRITE_RENDERING_MODE1_ALIASED
Definition: dwrite_3.idl:79
@ DWRITE_RENDERING_MODE1_OUTLINE
Definition: dwrite_3.idl:84
@ DWRITE_RENDERING_MODE1_NATURAL_SYMMETRIC_DOWNSAMPLED
Definition: dwrite_3.idl:85
HRESULT compute_glyph_origins(DWRITE_GLYPH_RUN const *run, DWRITE_MEASURING_MODE measuring_mode, D2D1_POINT_2F baseline_origin, DWRITE_MATRIX const *transform, D2D1_POINT_2F *origins)
Definition: main.c:1726
IDWriteFontFace * fontFace
Definition: dwrite.idl:405
UINT16 const * glyphIndices
Definition: dwrite.idl:408
DWRITE_RENDERING_MODE1 rendering_mode
Definition: font.c:392
IDWriteGlyphRunAnalysis IDWriteGlyphRunAnalysis_iface
Definition: font.c:389
DWRITE_MATRIX m
Definition: font.c:395
D2D_POINT_2F * origins
Definition: font.c:397
DWRITE_GLYPH_RUN run
Definition: font.c:394
DWRITE_TEXTURE_TYPE texture_type
Definition: font.c:393

Referenced by dwritefactory_CreateGlyphRunAnalysis(), and factory_create_glyphrun_analysis().

◆ create_inmemory_fileloader()

HRESULT create_inmemory_fileloader ( IDWriteInMemoryFontFileLoader **  loader)

Definition at line 7358 of file font.c.

7359{
7361
7362 *ret = NULL;
7363
7364 if (!(loader = calloc(1, sizeof(*loader))))
7365 return E_OUTOFMEMORY;
7366
7367 loader->IDWriteInMemoryFontFileLoader_iface.lpVtbl = &inmemoryfontfileloadervtbl;
7368 loader->refcount = 1;
7369
7370 *ret = &loader->IDWriteInMemoryFontFileLoader_iface;
7371
7372 return S_OK;
7373}
static const IDWriteInMemoryFontFileLoaderVtbl inmemoryfontfileloadervtbl
Definition: font.c:7348

Referenced by dwritefactory5_CreateInMemoryFontFileLoader().

◆ create_localizedstrings()

HRESULT create_localizedstrings ( IDWriteLocalizedStrings **  strings)

Definition at line 449 of file main.c.

450{
451 struct localizedstrings *object;
452
453 *strings = NULL;
454
455 if (!(object = calloc(1, sizeof(*object))))
456 return E_OUTOFMEMORY;
457
458 object->IDWriteLocalizedStrings_iface.lpVtbl = &localizedstringsvtbl;
459 object->refcount = 1;
460
461 *strings = &object->IDWriteLocalizedStrings_iface;
462
463 return S_OK;
464}

Referenced by eudc_collection_add_family(), fontcollection_add_replacement(), init_font_data_from_font(), opentype_get_font_strings_from_id(), and opentype_get_font_strings_from_meta().

◆ create_matching_font()

HRESULT create_matching_font ( IDWriteFontCollection *  collection,
const WCHAR *  family,
DWRITE_FONT_WEIGHT  weight,
DWRITE_FONT_STYLE  style,
DWRITE_FONT_STRETCH  stretch,
REFIID  riid,
void **  obj 
)

Definition at line 2479 of file analyzer.c.

2481{
2482 IDWriteFontFamily *family;
2483 BOOL exists = FALSE;
2485 HRESULT hr;
2486 UINT32 i;
2487
2488 *obj = NULL;
2489
2490 hr = IDWriteFontCollection_FindFamilyName(collection, name, &i, &exists);
2491 if (FAILED(hr))
2492 return hr;
2493
2494 if (!exists)
2495 return E_FAIL;
2496
2497 hr = IDWriteFontCollection_GetFontFamily(collection, i, &family);
2498 if (FAILED(hr))
2499 return hr;
2500
2501 hr = IDWriteFontFamily_GetFirstMatchingFont(family, weight, stretch, style, &font);
2502 IDWriteFontFamily_Release(family);
2503
2504 if (SUCCEEDED(hr))
2505 {
2506 hr = IDWriteFont_QueryInterface(font, riid, obj);
2507 IDWriteFont_Release(font);
2508 }
2509
2510 return hr;
2511}
#define E_FAIL
Definition: ddrawi.h:102
Definition: mk_font.cpp:20
weight
Definition: sortkey.c:157
Definition: name.c:39
Definition: style.c:91

Referenced by fallback_map_characters(), fontfallback_MapCharacters(), and layout_run_get_last_resort_font().

◆ create_numbersubstitution()

HRESULT create_numbersubstitution ( DWRITE_NUMBER_SUBSTITUTION_METHOD  method,
const WCHAR *  locale,
BOOL  ignore_user_override,
IDWriteNumberSubstitution **  ret 
)

Definition at line 2305 of file analyzer.c.

2307{
2308 struct dwrite_numbersubstitution *substitution;
2309
2310 *ret = NULL;
2311
2313 return E_INVALIDARG;
2314
2316 return E_INVALIDARG;
2317
2318 if (!(substitution = calloc(1, sizeof(*substitution))))
2319 return E_OUTOFMEMORY;
2320
2322 substitution->refcount = 1;
2324 substitution->method = method;
2325 substitution->locale = wcsdup(locale);
2326 if (locale && !substitution->locale)
2327 {
2328 free(substitution);
2329 return E_OUTOFMEMORY;
2330 }
2331
2332 *ret = &substitution->IDWriteNumberSubstitution_iface;
2333 return S_OK;
2334}
BOOL WINAPI IsValidLocaleName(LPCWSTR lpLocaleName)
static const IDWriteNumberSubstitutionVtbl numbersubstitutionvtbl
Definition: analyzer.c:2291
method
Definition: dragdrop.c:54
@ DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE
Definition: dwrite.idl:338
@ DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL
Definition: dwrite.idl:340
DWRITE_NUMBER_SUBSTITUTION_METHOD method
Definition: analyzer.c:627
IDWriteNumberSubstitution IDWriteNumberSubstitution_iface
Definition: analyzer.c:624

Referenced by dwritefactory_CreateNumberSubstitution().

◆ create_scriptshaping_cache()

struct scriptshaping_cache * create_scriptshaping_cache ( void *  context,
const struct shaping_font_ops *  font_ops 
)

Definition at line 43 of file shape.c.

44{
46
47 if (!(cache = calloc(1, sizeof(*cache))))
48 return NULL;
49
50 cache->font = font_ops;
51 cache->context = context;
52
54 cache->upem = cache->font->get_font_upem(cache->context);
55
56 return cache;
57}
void opentype_layout_scriptshaping_cache_init(struct scriptshaping_cache *cache)
Definition: opentype.c:3238
Definition: cache.c:41

Referenced by fontface_get_shaping_cache().

◆ create_system_fontfallback()

HRESULT create_system_fontfallback ( IDWriteFactory7 *  factory,
IDWriteFontFallback1 **  fallback 
)

Definition at line 3029 of file analyzer.c.

3030{
3031 struct dwrite_fontfallback *fallback;
3032
3033 *ret = NULL;
3034
3036 {
3037 WARN("Failed to initialize system fallback data.\n");
3038 return E_FAIL;
3039 }
3040
3041 if (!(fallback = calloc(1, sizeof(*fallback))))
3042 return E_OUTOFMEMORY;
3043
3044 fallback->IDWriteFontFallback1_iface.lpVtbl = &fontfallbackvtbl;
3045 fallback->factory = factory;
3046 fallback->data.count = ~0u;
3047 IDWriteFactory_GetSystemFontCollection((IDWriteFactory *)fallback->factory, &fallback->systemcollection, FALSE);
3048
3049 *ret = &fallback->IDWriteFontFallback1_iface;
3050
3051 return S_OK;
3052}
static BOOL WINAPI dwrite_system_fallback_initonce(INIT_ONCE *once, void *param, void **context)
Definition: analyzer.c:2985
static const IDWriteFontFallback1Vtbl fontfallbackvtbl
Definition: analyzer.c:2566
static INIT_ONCE init_system_fallback_once
Definition: analyzer.c:2981
BOOL WINAPI InitOnceExecuteOnce(_Inout_ PINIT_ONCE InitOnce, _In_ __callback PINIT_ONCE_FN InitFn, _Inout_opt_ PVOID Parameter, _Outptr_opt_result_maybenull_ LPVOID *Context)
Definition: InitOnce.c:12
IDWriteFontFallback1 IDWriteFontFallback1_iface
Definition: analyzer.c:537
IDWriteFactory7 * factory
Definition: analyzer.c:539
struct fallback_data data
Definition: analyzer.c:541
IDWriteFontCollection * systemcollection
Definition: analyzer.c:540

Referenced by dwritefactory2_GetSystemFontFallback().

◆ create_system_fontset()

HRESULT create_system_fontset ( IDWriteFactory7 *  factory,
REFIID  riid,
void **  obj 
)

Definition at line 1624 of file main.c.

1625{
1626 IDWriteFontSetBuilder2 *builder;
1627 IDWriteFontSet *fontset;
1628 unsigned int i, j, count;
1629 WCHAR **paths;
1630 HRESULT hr;
1631
1632 *obj = NULL;
1633
1634 if (FAILED(hr = create_fontset_builder(factory, &builder))) return hr;
1635
1637 {
1638 /* Sort, skip duplicates. */
1639
1641
1642 for (i = 0, j = 0; i < count; ++i)
1643 {
1644 if (i != j && !wcsicmp(paths[i], paths[j])) continue;
1645
1646 if (FAILED(hr = IDWriteFontSetBuilder2_AddFontFile(builder, paths[i])) && hr != DWRITE_E_FILEFORMAT)
1647 WARN("Failed to add font file, hr %#lx, path %s.\n", hr, debugstr_w(paths[i]));
1648
1649 j = i;
1650 }
1651
1652 for (i = 0; i < count; ++i)
1653 free(paths[i]);
1654 free(paths);
1655 }
1656
1657 if (SUCCEEDED(hr = IDWriteFontSetBuilder2_CreateFontSet(builder, &fontset)))
1658 {
1659 hr = IDWriteFontSet_QueryInterface(fontset, riid, obj);
1660 IDWriteFontSet_Release(fontset);
1661 }
1662
1663 IDWriteFontSetBuilder2_Release(builder);
1664
1665 return hr;
1666}
static HRESULT create_system_path_list(WCHAR ***ret, unsigned int *ret_count)
Definition: main.c:1526
static int __cdecl create_system_fontset_compare(const void *left, const void *right)
Definition: main.c:1618
_ACRTIMP void __cdecl qsort(void *, size_t, size_t, int(__cdecl *)(const void *, const void *))
HRESULT create_fontset_builder(IDWriteFactory7 *factory, IDWriteFontSetBuilder2 **ret)
Definition: font.c:8391
GLsizei const GLuint * paths
Definition: glext.h:11717
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250

Referenced by dwritefactory3_GetSystemFontSet(), dwritefactory6_GetSystemFontSet(), dwritefactory7_GetSystemFontSet(), and get_system_fontcollection().

◆ create_text_format()

HRESULT create_text_format ( const WCHAR *  family_name,
IDWriteFontCollection *  collection,
DWRITE_FONT_WEIGHT  weight,
DWRITE_FONT_STYLE  style,
DWRITE_FONT_STRETCH  stretch,
float  size,
const WCHAR *  locale,
REFIID  riid,
void **  out 
)

Definition at line 714 of file format.c.

717{
719 HRESULT hr;
720
721 *out = NULL;
722
723 if (size <= 0.0f)
724 return E_INVALIDARG;
725
730 {
731 return E_INVALIDARG;
732 }
733
734 if (!(object = calloc(1, sizeof(*object))))
735 return E_OUTOFMEMORY;
736
737 object->IDWriteTextFormat3_iface.lpVtbl = &dwritetextformatvtbl;
738 object->refcount = 1;
739 object->format.family_name = wcsdup(family_name);
740 object->format.family_len = wcslen(family_name);
741 object->format.locale = wcsdup(locale);
742 object->format.locale_len = wcslen(locale);
743 /* Force locale name to lower case, layout will inherit this modified value. */
744 wcslwr(object->format.locale);
745 object->format.weight = weight;
746 object->format.style = style;
747 object->format.fontsize = size;
748 object->format.tabstop = 4.0f * size;
749 object->format.stretch = stretch;
750 object->format.last_line_wrapping = TRUE;
751 object->format.collection = collection;
752 IDWriteFontCollection_AddRef(object->format.collection);
753
754 hr = IDWriteTextFormat3_QueryInterface(&object->IDWriteTextFormat3_iface, riid, out);
755 IDWriteTextFormat3_Release(&object->IDWriteTextFormat3_iface);
756
757 return hr;
758}
static const IDWriteTextFormat3Vtbl dwritetextformatvtbl
Definition: format.c:661
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
@ DWRITE_FONT_WEIGHT_ULTRA_BLACK
Definition: dwrite.idl:90
@ DWRITE_FONT_STYLE_ITALIC
Definition: dwrite.idl:112
@ DWRITE_FONT_STRETCH_UNDEFINED
Definition: dwrite.idl:95
@ DWRITE_FONT_STRETCH_ULTRA_EXPANDED
Definition: dwrite.idl:105
GLsizeiptr size
Definition: glext.h:5919
T1_FIELD_DICT_FONTDICT family_name
Definition: t1tokens.h:30
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

Referenced by dwritefactory6_CreateTextFormat(), and dwritefactory_CreateTextFormat().

◆ create_textlayout()

HRESULT create_textlayout ( const struct textlayout_desc *  desc,
IDWriteTextLayout **  layout 
)

Definition at line 5346 of file layout.c.

5347{
5348 struct dwrite_textlayout *object;
5349 HRESULT hr;
5350
5351 *layout = NULL;
5352
5353 if (desc->max_width < 0.0f || desc->max_height < 0.0f)
5354 return E_INVALIDARG;
5355
5356 if (!desc->format || !desc->string)
5357 return E_INVALIDARG;
5358
5359 if (!(object = calloc(1, sizeof(*object))))
5360 return E_OUTOFMEMORY;
5361
5362 hr = init_textlayout(desc, object);
5363 if (hr == S_OK)
5364 *layout = (IDWriteTextLayout *)&object->IDWriteTextLayout4_iface;
5365
5366 return hr;
5367}
static HRESULT init_textlayout(const struct textlayout_desc *desc, struct dwrite_textlayout *layout)
Definition: layout.c:5265

Referenced by dwritefactory_CreateGdiCompatibleTextLayout(), and dwritefactory_CreateTextLayout().

◆ create_trimmingsign()

HRESULT create_trimmingsign ( IDWriteFactory7 *  factory,
IDWriteTextFormat *  format,
IDWriteInlineObject **  sign 
)

Definition at line 891 of file format.c.

892{
896 HRESULT hr;
897
898 *sign = NULL;
899
900 if (!format)
901 return E_INVALIDARG;
902
903 /* Validate reading/flow direction here, layout creation won't complain about
904 invalid combinations. */
905 reading = IDWriteTextFormat_GetReadingDirection(format);
906 flow = IDWriteTextFormat_GetFlowDirection(format);
907
908 if ((is_reading_direction_horz(reading) && is_flow_direction_horz(flow)) ||
911
912 if (!(object = calloc(1, sizeof(*object))))
913 return E_OUTOFMEMORY;
914
915 object->IDWriteInlineObject_iface.lpVtbl = &dwritetrimmingsignvtbl;
916 object->refcount = 1;
917
918 hr = IDWriteFactory7_CreateTextLayout(factory, L"\x2026", 1, format, 0.0f, 0.0f, &object->layout);
919 if (FAILED(hr))
920 {
921 free(object);
922 return hr;
923 }
924
925 IDWriteTextLayout_SetWordWrapping(object->layout, DWRITE_WORD_WRAPPING_NO_WRAP);
926 IDWriteTextLayout_SetParagraphAlignment(object->layout, DWRITE_PARAGRAPH_ALIGNMENT_NEAR);
927 IDWriteTextLayout_SetTextAlignment(object->layout, DWRITE_TEXT_ALIGNMENT_LEADING);
928
929 *sign = &object->IDWriteInlineObject_iface;
930
931 return S_OK;
932}
static BOOL is_flow_direction_horz(DWRITE_FLOW_DIRECTION direction)
Definition: format.c:879
static BOOL is_reading_direction_vert(DWRITE_READING_DIRECTION direction)
Definition: format.c:873
static const IDWriteInlineObjectVtbl dwritetrimmingsignvtbl
Definition: format.c:856
static BOOL is_reading_direction_horz(DWRITE_READING_DIRECTION direction)
Definition: format.c:867
static BOOL is_flow_direction_vert(DWRITE_FLOW_DIRECTION direction)
Definition: format.c:885
#define L(x)
Definition: resources.c:13
@ DWRITE_PARAGRAPH_ALIGNMENT_NEAR
Definition: dwrite.idl:184
@ DWRITE_WORD_WRAPPING_NO_WRAP
Definition: dwrite.idl:192
DWRITE_FLOW_DIRECTION
Definition: dwrite.idl:207
@ DWRITE_TEXT_ALIGNMENT_LEADING
Definition: dwrite.idl:176
DWRITE_READING_DIRECTION
Definition: dwrite.idl:199
#define sign(x)
Definition: mapdesc.cc:613
#define DWRITE_E_FLOWDIRECTIONCONFLICTS
Definition: winerror.h:7345

Referenced by dwritefactory_CreateEllipsisTrimmingSign().

◆ create_typography()

HRESULT create_typography ( IDWriteTypography **  ret)

Definition at line 5461 of file layout.c.

5462{
5463 struct dwrite_typography *typography;
5464
5465 *ret = NULL;
5466
5467 if (!(typography = calloc(1, sizeof(*typography))))
5468 return E_OUTOFMEMORY;
5469
5470 typography->IDWriteTypography_iface.lpVtbl = &dwritetypographyvtbl;
5471 typography->refcount = 1;
5472
5473 *ret = &typography->IDWriteTypography_iface;
5474
5475 return S_OK;
5476}
static const IDWriteTypographyVtbl dwritetypographyvtbl
Definition: layout.c:5452
IDWriteTypography IDWriteTypography_iface
Definition: layout.c:273

Referenced by dwritefactory_CreateTypography().

◆ debugstr_matrix()

static const char * debugstr_matrix ( const DWRITE_MATRIX *  m)
inlinestatic

Definition at line 76 of file dwrite_private.h.

77{
78 if (!m) return "(null)";
79 return wine_dbg_sprintf("{%.2f,%.2f,%.2f,%.2f,%.2f,%.2f}", m->m11, m->m12, m->m21, m->m22,
80 m->dx, m->dy);
81}
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:296
const GLfloat * m
Definition: glext.h:10848

Referenced by dwritefontface2_GetRecommendedRenderingMode(), dwritefontface3_GetRecommendedRenderingMode(), dwritefontface_GetGdiCompatibleGlyphMetrics(), GdipCloneMatrix(), GdipDrawDriverString(), GdipGetLineTransform(), GdipGetMatrixElements(), GdipGetPathGradientTransform(), GdipGetPathWorldBounds(), GdipGetPathWorldBoundsI(), GdipGetPenTransform(), GdipGetRegionScansCount(), GdipGetTextureTransform(), GdipGetWorldTransform(), GdipInvertMatrix(), GdipIsMatrixEqual(), GdipIsMatrixIdentity(), GdipIsMatrixInvertible(), GdipMeasureDriverString(), GdipMultiplyLineTransform(), GdipMultiplyMatrix(), GdipMultiplyPathGradientTransform(), GdipMultiplyPenTransform(), GdipMultiplyTextureTransform(), GdipMultiplyWorldTransform(), GdipRotateMatrix(), GdipScaleMatrix(), GdipSetLineTransform(), GdipSetMatrixElements(), GdipSetPathGradientTransform(), GdipSetPenTransform(), GdipSetTextureTransform(), GdipSetWorldTransform(), GdipShearMatrix(), GdipTransformMatrixPoints(), GdipTransformMatrixPointsI(), GdipTransformPath(), GdipTransformRegion(), GdipTranslateMatrix(), GdipVectorTransformMatrixPoints(), GdipVectorTransformMatrixPointsI(), GdipWarpPath(), and GdipWidenPath().

◆ debugstr_range()

◆ debugstr_sa_script()

const char * debugstr_sa_script ( UINT16  script)

Definition at line 209 of file analyzer.c.

210{
211 return script < Script_LastId ? debugstr_fourcc(dwritescripts_properties[script].props.isoScriptCode) : "undefined";
212}
static const struct dwritescript_properties dwritescripts_properties[Script_LastId+1]
Definition: analyzer.c:48
script
Definition: msipriv.h:396
@ Script_LastId
Definition: scripts.h:163
static __inline const char * debugstr_fourcc(unsigned int cc)
Definition: debug.h:397
static const WCHAR props[]
Definition: wbemdisp.c:288

Referenced by dwritetextanalyzer_GetGdiCompatibleGlyphPlacements(), dwritetextanalyzer_GetGlyphPlacements(), dwritetextanalyzer_GetGlyphs(), and dwritetextlayout_sink_SetScriptAnalysis().

◆ dwrite_array_reserve()

static BOOL dwrite_array_reserve ( void **  elements,
size_t *  capacity,
size_t  count,
size_t  size 
)
inlinestatic

Definition at line 83 of file dwrite_private.h.

84{
85 size_t new_capacity, max_capacity;
86 void *new_elements;
87
88 if (count <= *capacity)
89 return TRUE;
90
91 max_capacity = ~(SIZE_T)0 / size;
92 if (count > max_capacity)
93 return FALSE;
94
95 new_capacity = max(4, *capacity);
96 while (new_capacity < count && new_capacity <= max_capacity / 2)
97 new_capacity *= 2;
98 if (new_capacity < count)
99 new_capacity = max_capacity;
100
101 new_elements = realloc(*elements, new_capacity * size);
102 if (!new_elements)
103 return FALSE;
104
105 *elements = new_elements;
106 *capacity = new_capacity;
107
108 return TRUE;
109}
#define realloc
Definition: debug_ros.c:6
#define max(a, b)
Definition: svc.c:63
ULONG_PTR SIZE_T
Definition: typedefs.h:80

Referenced by add_localizedstring(), clone_localizedstrings(), create_system_path_list(), dwritefontface_GetGlyphRunOutline(), dwritetypography_AddFontFeature(), fallback_locale_add_mapping(), fontcollection_add_family(), fontfallbackbuilder_AddMapping(), fontfamily_add_font(), fontset_builder_add_entry(), inmemoryfontfileloader_CreateInMemoryFontFileReference(), layout_set_line_metrics(), opentype_get_typographic_features(), opentype_layout_add_lookups(), and shape_add_feature_full().

◆ dwrite_cmap_init()

void dwrite_cmap_init ( struct dwrite_cmap *  cmap,
IDWriteFontFile *  file,
unsigned int  face_index,
DWRITE_FONT_FACE_TYPE  face_type 
)

Definition at line 1818 of file opentype.c.

1820{
1821 static const UINT16 encodings[][2] =
1822 {
1823 { 3, 0 }, /* MS Symbol encoding is preferred. */
1824 { 3, 10 },
1825 { 0, 6 },
1826 { 0, 4 },
1827 { 3, 1 },
1828 { 0, 3 },
1829 { 0, 2 },
1830 { 0, 1 },
1831 { 0, 0 },
1832 };
1833 const struct cmap_encoding_record *records, *found_record = NULL;
1834 unsigned int length, offset, format, count, f, i, num_records;
1835 struct file_stream_desc stream_desc;
1836 struct dwrite_fonttable table;
1837 const UINT16 *pair = NULL;
1838 HRESULT hr;
1839
1840 if (cmap->data) return;
1841
1842 /* For fontface stream is already available and preset. */
1843 if (!cmap->stream && FAILED(hr = get_filestream_from_file(file, &cmap->stream)))
1844 {
1845 WARN("Failed to get file stream, hr %#lx.\n", hr);
1846 goto failed;
1847 }
1848
1849 stream_desc.stream = cmap->stream;
1850 stream_desc.face_type = face_type;
1851 stream_desc.face_index = face_index;
1852
1853 opentype_get_font_table(&stream_desc, MS_CMAP_TAG, &table);
1854 if (!table.exists)
1855 goto failed;
1856 cmap->table_context = table.context;
1857
1858 num_records = table_read_be_word(&table, 2);
1859 records = table_read_ensure(&table, 4, sizeof(*records) * num_records);
1860
1861 for (i = 0; i < ARRAY_SIZE(encodings); ++i)
1862 {
1863 pair = encodings[i];
1864 if ((found_record = bsearch(pair, records, num_records, sizeof(*records), cmap_header_compare)))
1865 break;
1866 }
1867
1868 if (!found_record)
1869 {
1870 WARN("No suitable cmap table were found.\n");
1871 goto failed;
1872 }
1873
1874 /* Symbol encoding. */
1875 cmap->symbol = pair[0] == 3 && pair[1] == 0;
1876 offset = GET_BE_DWORD(found_record->offset);
1877
1879
1880 switch (format)
1881 {
1882 case 0:
1883 cmap->data = table_read_ensure(&table, offset + 6, 256);
1886 break;
1887 case 4:
1889 cmap->u.format4.seg_count = count = table_read_be_word(&table, offset + 6) / 2;
1890 cmap->u.format4.ends = table_read_ensure(&table, offset + 14, count * 2);
1891 cmap->u.format4.starts = cmap->u.format4.ends + count + 1;
1892 cmap->u.format4.id_delta = cmap->u.format4.starts + count;
1893 cmap->u.format4.id_range_offset = cmap->u.format4.id_delta + count;
1894 cmap->u.format4.glyph_id_array = cmap->data = cmap->u.format4.id_range_offset + count;
1895 cmap->u.format4.glyph_id_array_len = (length - 16 - 8 * count) / 2;
1898 break;
1899 case 6:
1900 case 10:
1901 /* Format 10 uses 4 byte fields. */
1902 f = format == 6 ? 1 : 2;
1903 cmap->u.format6_10.first = table_read_be_word(&table, offset + f * 6);
1905 cmap->u.format6_10.last = cmap->u.format6_10.first + count;
1906 cmap->data = table_read_ensure(&table, offset + f * 10, count * 2);
1909 break;
1910 case 12:
1911 case 13:
1912 cmap->u.format12_13.group_count = count = table_read_be_dword(&table, offset + 12);
1913 cmap->data = table_read_ensure(&table, offset + 16, count * 3 * 4);
1916 break;
1917 default:
1918 WARN("Unhandled subtable format %u.\n", format);
1919 }
1920
1921failed:
1922
1923 if (!cmap->data)
1924 {
1925 /* Dummy implementation, returns 0 unconditionally. */
1926 cmap->data = cmap;
1929 }
1930}
unsigned short UINT16
Definition: actypes.h:129
static UINT16 opentype_cmap_format0_get_glyph(const struct dwrite_cmap *cmap, unsigned int ch)
Definition: opentype.c:1616
#define MS_CMAP_TAG
Definition: opentype.c:45
static UINT16 opentype_cmap_dummy_get_glyph(const struct dwrite_cmap *cmap, unsigned int ch)
Definition: opentype.c:1781
static WORD table_read_be_word(const struct dwrite_fonttable *table, unsigned int offset)
Definition: opentype.c:1314
static unsigned int opentype_cmap_format0_get_ranges(const struct dwrite_cmap *cmap, unsigned int count, DWRITE_UNICODE_RANGE *ranges)
Definition: opentype.c:1622
static unsigned int opentype_cmap_format12_13_get_ranges(const struct dwrite_cmap *cmap, unsigned int count, DWRITE_UNICODE_RANGE *ranges)
Definition: opentype.c:1752
static UINT16 opentype_cmap_format6_10_get_glyph(const struct dwrite_cmap *cmap, unsigned int ch)
Definition: opentype.c:1706
static DWORD table_read_be_dword(const struct dwrite_fonttable *table, unsigned int offset)
Definition: opentype.c:1320
static UINT16 opentype_cmap_format4_get_glyph(const struct dwrite_cmap *cmap, unsigned int ch)
Definition: opentype.c:1656
static int __cdecl cmap_header_compare(const void *a, const void *b)
Definition: opentype.c:1803
static UINT16 opentype_cmap_format13_get_glyph(const struct dwrite_cmap *cmap, unsigned int ch)
Definition: opentype.c:1769
static unsigned int opentype_cmap_dummy_get_ranges(const struct dwrite_cmap *cmap, unsigned int count, DWRITE_UNICODE_RANGE *ranges)
Definition: opentype.c:1786
static HRESULT opentype_get_font_table(const struct file_stream_desc *stream_desc, UINT32 tag, struct dwrite_fonttable *table)
Definition: opentype.c:1606
static unsigned int opentype_cmap_format4_get_ranges(const struct dwrite_cmap *cmap, unsigned int count, DWRITE_UNICODE_RANGE *ranges)
Definition: opentype.c:1690
#define GET_BE_DWORD(x)
Definition: opentype.c:68
static unsigned int opentype_cmap_format6_10_get_ranges(const struct dwrite_cmap *cmap, unsigned int count, DWRITE_UNICODE_RANGE *ranges)
Definition: opentype.c:1713
static const void * table_read_ensure(const struct dwrite_fonttable *table, unsigned int offset, unsigned int size)
Definition: opentype.c:1306
static UINT16 opentype_cmap_format12_get_glyph(const struct dwrite_cmap *cmap, unsigned int ch)
Definition: opentype.c:1739
HRESULT get_filestream_from_file(IDWriteFontFile *, IDWriteFontFileStream **)
Definition: font.c:3563
GLintptr offset
Definition: glext.h:5920
GLfloat f
Definition: glext.h:7540
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
#define f
Definition: ke_i.h:83
struct dwrite_cmap::@304::@306 format6_10
union dwrite_cmap::@304 u
const void * data
struct dwrite_cmap::@304::@305 format4
IDWriteFontFileStream * stream
unsigned short symbol
struct dwrite_cmap::@304::@307 format12_13
void * table_context
p_cmap_get_glyph_func get_glyph
p_cmap_get_ranges_func get_ranges
Definition: _pair.h:47
#define bsearch

Referenced by dwritefont1_GetUnicodeRanges(), dwritefont_has_character(), dwritefontface1_GetUnicodeRanges(), and dwritefontface_get_glyph().

◆ dwrite_cmap_release()

void dwrite_cmap_release ( struct dwrite_cmap *  cmap)

Definition at line 1932 of file opentype.c.

1933{
1934 if (cmap->stream)
1935 {
1936 IDWriteFontFileStream_ReleaseFileFragment(cmap->stream, cmap->table_context);
1937 IDWriteFontFileStream_Release(cmap->stream);
1938 }
1939 cmap->data = NULL;
1940 cmap->stream = NULL;
1941}

Referenced by dwritefontface_Release(), and release_font_data().

◆ dwrite_fontface_get_glyph_bbox()

void dwrite_fontface_get_glyph_bbox ( IDWriteFontFace *  fontface,
struct dwrite_glyphbitmap *  bitmap 
)

Definition at line 158 of file font.c.

159{
160 struct cache_key key = { .size = bitmap->emsize, .glyph = bitmap->glyph, .mode = DWRITE_MEASURING_MODE_NATURAL };
161 struct dwrite_fontface *fontface = unsafe_impl_from_IDWriteFontFace(iface);
163 struct cache_entry *entry;
164
165 params.object = fontface->get_font_object(fontface);
166 params.simulations = bitmap->simulations;
167 params.glyph = bitmap->glyph;
168 params.emsize = bitmap->emsize;
170
171 EnterCriticalSection(&fontface->cs);
172 /* For now bypass cache for transformed cases. */
173 if (bitmap->m && memcmp(&params.m, &identity_2x2, sizeof(params.m)))
174 {
175 params.bbox = &bitmap->bbox;
177 }
178 else if ((entry = fontface_get_cache_entry(fontface, 0, &key)))
179 {
180 if (!entry->has_bbox)
181 {
182 params.bbox = &entry->bbox;
184 entry->has_bbox = 1;
185 }
186 bitmap->bbox = entry->bbox;
187 }
188 LeaveCriticalSection(&fontface->cs);
189}
@ DWRITE_MEASURING_MODE_NATURAL
Definition: dcommon.idl:37
#define UNIX_CALL(func, params)
Definition: unixlib.h:113
static void matrix_2x2_from_dwrite_matrix(MATRIX_2X2 *m1, const DWRITE_MATRIX *m2)
Definition: font.c:73
struct dwrite_fontface * unsafe_impl_from_IDWriteFontFace(IDWriteFontFace *iface)
Definition: font.c:2536
static struct cache_entry * fontface_get_cache_entry(struct dwrite_fontface *fontface, size_t size, const struct cache_key *key)
Definition: font.c:87
static NTSTATUS get_glyph_bbox(void *args)
Definition: freetype.c:785
static const MATRIX_2X2 identity_2x2
GLenum const GLfloat * params
Definition: glext.h:5645
Definition: uimain.c:89
Definition: svc_auth_des.c:77
Definition: font.c:50
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

Referenced by glyphrunanalysis_get_texturebounds(), glyphrunanalysis_render(), and layout_get_erun_bbox().

◆ dwrite_matrix_multiply()

static void dwrite_matrix_multiply ( DWRITE_MATRIX *  a,
const DWRITE_MATRIX *  b 
)
inlinestatic

Definition at line 129 of file dwrite_private.h.

130{
131 DWRITE_MATRIX tmp = *a;
132
133 a->m11 = tmp.m11 * b->m11 + tmp.m12 * b->m21;
134 a->m12 = tmp.m11 * b->m12 + tmp.m12 * b->m22;
135 a->m21 = tmp.m21 * b->m11 + tmp.m22 * b->m21;
136 a->m22 = tmp.m21 * b->m12 + tmp.m22 * b->m22;
137 a->dx = tmp.dx * b->m11 + tmp.dy * b->m21 + b->dx;
138 a->dy = tmp.dy * b->m12 + tmp.dy * b->m22 + b->dx;
139}
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define a
Definition: ke_i.h:78

Referenced by dwritefactory_CreateGlyphRunAnalysis(), and rendertarget_DrawGlyphRun().

◆ factory_cache_fontface()

struct fontfacecached * factory_cache_fontface ( IDWriteFactory7 *  factory,
struct list *  fontfaces,
IDWriteFontFace5 *  fontface 
)

Definition at line 1002 of file main.c.

1004{
1006 struct fontfacecached *cached;
1007
1008 /* new cache entry */
1009 if (!(cached = malloc(sizeof(*cached))))
1010 return NULL;
1011
1012 cached->fontface = fontface;
1014 list_add_tail(fontfaces, &cached->entry);
1016
1017 return cached;
1018}
static struct dwritefactory * impl_from_IDWriteFactory7(IDWriteFactory7 *iface)
Definition: main.c:614
struct list entry
IDWriteFontFace5 * fontface

Referenced by create_fontface().

◆ factory_detach_fontcollection()

void factory_detach_fontcollection ( IDWriteFactory7 *  factory,
IDWriteFontCollection3 *  collection 
)

Definition at line 2092 of file main.c.

2093{
2095 unsigned int i;
2096
2097 for (i = 0; i < ARRAY_SIZE(factory->system_collections); ++i)
2098 InterlockedCompareExchangePointer((void **)&factory->system_collections[i], NULL, collection);
2099 InterlockedCompareExchangePointer((void **)&factory->eudc_collection, NULL, collection);
2100 IDWriteFactory7_Release(iface);
2101}
#define InterlockedCompareExchangePointer
Definition: interlocked.h:144

Referenced by dwritefontcollection_Release().

◆ factory_detach_gdiinterop()

void factory_detach_gdiinterop ( IDWriteFactory7 *  factory,
IDWriteGdiInterop1 *  interop 
)

Definition at line 2103 of file main.c.

2104{
2106 factory->gdiinterop = NULL;
2107 IDWriteFactory7_Release(iface);
2108}

Referenced by gdiinterop_Release().

◆ factory_get_cached_fontface()

HRESULT factory_get_cached_fontface ( IDWriteFactory7 *  factory,
IDWriteFontFile *const *  files,
UINT32  num_files,
DWRITE_FONT_SIMULATIONS  simulations,
struct list **  cache,
REFIID  riid,
void **  obj 
)

Definition at line 926 of file main.c.

928{
930 struct fontfacecached *cached;
932 struct list *fontfaces;
933 UINT32 key_size;
934 const void *key;
935 HRESULT hr;
936
937 *obj = NULL;
938 *cached_list = NULL;
939
940 hr = IDWriteFontFile_GetReferenceKey(*font_files, &key, &key_size);
941 if (FAILED(hr))
942 return hr;
943
944 hr = IDWriteFontFile_GetLoader(*font_files, &loader);
945 if (FAILED(hr))
946 return hr;
947
948 if (loader == factory->localfontfileloader) {
949 fontfaces = &factory->localfontfaces;
950 IDWriteFontFileLoader_Release(loader);
951 }
952 else {
954 IDWriteFontFileLoader_Release(loader);
955 if (!fileloader)
956 return E_INVALIDARG;
958 }
959
960 *cached_list = fontfaces;
961
963
964 /* search through cache list */
966 UINT32 cached_key_size, count = 1, cached_face_index;
967 DWRITE_FONT_SIMULATIONS cached_simulations;
968 const void *cached_key;
970
971 cached_face_index = IDWriteFontFace5_GetIndex(cached->fontface);
972 cached_simulations = IDWriteFontFace5_GetSimulations(cached->fontface);
973
974 /* skip earlier */
975 if (cached_face_index != index || cached_simulations != simulations)
976 continue;
977
978 hr = IDWriteFontFace5_GetFiles(cached->fontface, &count, &file);
979 if (FAILED(hr))
980 break;
981
982 hr = IDWriteFontFile_GetReferenceKey(file, &cached_key, &cached_key_size);
983 IDWriteFontFile_Release(file);
984 if (FAILED(hr))
985 break;
986
987 if (cached_key_size == key_size && !memcmp(cached_key, key, key_size))
988 {
989 if (FAILED(hr = IDWriteFontFace5_QueryInterface(cached->fontface, riid, obj)))
990 WARN("Failed to get %s from fontface, hr %#lx.\n", debugstr_guid(riid), hr);
991
992 TRACE("returning cached fontface %p\n", cached->fontface);
993 break;
994 }
995 }
996
998
999 return *obj ? S_OK : S_FALSE;
1000}
static struct fileloader * factory_get_file_loader(struct dwritefactory *factory, IDWriteFontFileLoader *loader)
Definition: main.c:680
DWRITE_FONT_SIMULATIONS
Definition: dwrite.idl:145
#define debugstr_guid
Definition: kernel32.h:35
struct list fontfaces
Definition: main.c:591

Referenced by dwritefactory_CreateFontFace(), and get_fontface_from_font().

◆ factory_lock()

void factory_lock ( IDWriteFactory7 *  factory)

Definition at line 914 of file main.c.

915{
918}

Referenced by dwritefontface_Release().

◆ factory_unlock()

void factory_unlock ( IDWriteFactory7 *  factory)

Definition at line 920 of file main.c.

921{
924}

Referenced by dwritefontface_Release().

◆ fontface_detach_from_cache()

void fontface_detach_from_cache ( IDWriteFontFace5 *  fontface)

Definition at line 764 of file font.c.

765{
766 struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface);
767 fontface->cached = NULL;
768}
static struct dwrite_fontface * impl_from_IDWriteFontFace5(IDWriteFontFace5 *iface)
Definition: font.c:567

Referenced by release_fontface_cache().

◆ fontface_get_scaled_design_advance()

float fontface_get_scaled_design_advance ( struct dwrite_fontface *  fontface,
DWRITE_MEASURING_MODE  measuring_mode,
float  emsize,
float  ppdip,
const DWRITE_MATRIX *  transform,
UINT16  glyph,
BOOL  is_sideways 
)

Definition at line 6384 of file font.c.

6386{
6387 unsigned int upem = fontface->metrics.designUnitsPerEm;
6388 int advance;
6389
6390 if (is_sideways)
6391 FIXME("Sideways mode is not supported.\n");
6392
6393 EnterCriticalSection(&fontface->cs);
6394 advance = fontface_get_design_advance(fontface, measuring_mode, emsize, ppdip, transform, glyph, is_sideways);
6395 LeaveCriticalSection(&fontface->cs);
6396
6397 switch (measuring_mode)
6398 {
6400 return (float)advance * emsize / (float)upem;
6403 return ppdip > 0.0f ? floorf(advance * emsize * ppdip / upem + 0.5f) / ppdip : 0.0f;
6404 default:
6405 WARN("Unknown measuring mode %u.\n", measuring_mode);
6406 return 0.0f;
6407 }
6408}
#define FIXME(fmt,...)
Definition: precomp.h:53
@ DWRITE_MEASURING_MODE_GDI_CLASSIC
Definition: dcommon.idl:38
static int fontface_get_design_advance(struct dwrite_fontface *fontface, DWRITE_MEASURING_MODE measuring_mode, float emsize, float ppdip, const DWRITE_MATRIX *transform, UINT16 glyph, BOOL is_sideways)
Definition: font.c:1418
static float(__cdecl *square_half_float)(float x
#define floorf(x)
Definition: mymath.h:65

Referenced by compute_glyph_origins(), create_colorglyphenum(), dwritetextanalyzer_GetGdiCompatibleGlyphPlacements(), and dwritetextanalyzer_GetGlyphPlacements().

◆ fontface_get_shaping_cache()

struct scriptshaping_cache * fontface_get_shaping_cache ( struct dwrite_fontface *  fontface)

Definition at line 559 of file font.c.

560{
561 if (fontface->shaping_cache)
562 return fontface->shaping_cache;
563
564 return fontface->shaping_cache = create_scriptshaping_cache(fontface, &dwrite_font_ops);
565}
static const struct shaping_font_ops dwrite_font_ops
Definition: font.c:550
struct scriptshaping_cache * create_scriptshaping_cache(void *context, const struct shaping_font_ops *font_ops)
Definition: shape.c:43
struct scriptshaping_cache * shaping_cache

Referenced by dwritetextanalyzer2_CheckTypographicFeature(), dwritetextanalyzer2_GetTypographicFeatures(), dwritetextanalyzer_GetGdiCompatibleGlyphPlacements(), dwritetextanalyzer_GetGlyphPlacements(), dwritetextanalyzer_GetGlyphs(), opentype_get_vertical_glyph_variants(), and opentype_has_vertical_variants().

◆ format_get_font_axisvalues()

HRESULT format_get_font_axisvalues ( struct dwrite_textformat_data *  format,
DWRITE_FONT_AXIS_VALUE *  axis_values,
unsigned int  num_values 
)

Definition at line 159 of file format.c.

161{
162 if (!format->axis_values_count)
163 {
164 if (num_values) memset(axis_values, 0, num_values * sizeof(*axis_values));
165 return S_OK;
166 }
167
168 if (num_values < format->axis_values_count)
170
171 memcpy(axis_values, format->axis_values, min(num_values, format->axis_values_count) * sizeof(*axis_values));
172
173 return S_OK;
174}
#define min(a, b)
Definition: monoChain.cc:55
#define memset(x, y, z)
Definition: compat.h:39
#define E_NOT_SUFFICIENT_BUFFER
Definition: winerror.h:3437

Referenced by dwritetextformat3_GetFontAxisValues(), and dwritetextformat3_layout_GetFontAxisValues().

◆ format_get_fontfallback()

HRESULT format_get_fontfallback ( const struct dwrite_textformat_data *  format,
IDWriteFontFallback **  fallback 
)

Definition at line 176 of file format.c.

177{
178 *fallback = format->fallback;
179 if (*fallback)
180 IDWriteFontFallback_AddRef(*fallback);
181 return S_OK;
182}

Referenced by dwritetextformat1_GetFontFallback(), and dwritetextlayout2_GetFontFallback().

◆ format_set_flowdirection()

HRESULT format_set_flowdirection ( struct dwrite_textformat_data *  format,
DWRITE_FLOW_DIRECTION  direction,
BOOL *  changed 
)

Definition at line 95 of file format.c.

96{
98 return E_INVALIDARG;
99 if (changed) *changed = format->flow != direction;
100 format->flow = direction;
101 return S_OK;
102}
@ DWRITE_FLOW_DIRECTION_RIGHT_TO_LEFT
Definition: dwrite.idl:211
direction
Definition: netio.c:882

Referenced by dwritetextformat_layout_SetFlowDirection(), and dwritetextformat_SetFlowDirection().

◆ format_set_font_axisvalues()

HRESULT format_set_font_axisvalues ( struct dwrite_textformat_data *  format,
DWRITE_FONT_AXIS_VALUE const *  axis_values,
unsigned int  num_values 
)

Definition at line 141 of file format.c.

143{
144 free(format->axis_values);
145 format->axis_values = NULL;
146 format->axis_values_count = 0;
147
148 if (num_values)
149 {
150 if (!(format->axis_values = calloc(num_values, sizeof(*axis_values))))
151 return E_OUTOFMEMORY;
152 memcpy(format->axis_values, axis_values, num_values * sizeof(*axis_values));
153 format->axis_values_count = num_values;
154 }
155
156 return S_OK;
157}

Referenced by dwritetextformat3_layout_SetFontAxisValues(), and dwritetextformat3_SetFontAxisValues().

◆ format_set_fontfallback()

HRESULT format_set_fontfallback ( struct dwrite_textformat_data *  format,
IDWriteFontFallback *  fallback 
)

Definition at line 184 of file format.c.

185{
186 if (format->fallback)
187 IDWriteFontFallback_Release(format->fallback);
188 format->fallback = fallback;
189 if (fallback)
190 IDWriteFontFallback_AddRef(fallback);
191 return S_OK;
192}

Referenced by dwritetextformat1_SetFontFallback(), and dwritetextlayout2_SetFontFallback().

◆ format_set_linespacing()

HRESULT format_set_linespacing ( struct dwrite_textformat_data *  format,
DWRITE_LINE_SPACING const *  spacing,
BOOL *  changed 
)

Definition at line 128 of file format.c.

129{
130 if (spacing->height < 0.0f || spacing->leadingBefore < 0.0f || spacing->leadingBefore > 1.0f ||
132 return E_INVALIDARG;
133
134 if (changed)
135 *changed = memcmp(spacing, &format->spacing, sizeof(*spacing));
136
137 format->spacing = *spacing;
138 return S_OK;
139}
@ DWRITE_LINE_SPACING_METHOD_PROPORTIONAL
Definition: dwrite.idl:233

Referenced by dwritetextformat2_SetLineSpacing(), dwritetextformat_SetLineSpacing(), and dwritetextlayout3_SetLineSpacing().

◆ format_set_optical_alignment()

HRESULT format_set_optical_alignment ( struct dwrite_textformat_data *  format,
DWRITE_OPTICAL_ALIGNMENT  alignment 
)

Definition at line 194 of file format.c.

195{
197 return E_INVALIDARG;
198 format->optical_alignment = alignment;
199 return S_OK;
200}
_Check_return_ _Ret_maybenull_ _In_ size_t alignment
Definition: align.cpp:48
@ DWRITE_OPTICAL_ALIGNMENT_NO_SIDE_BEARINGS
Definition: dwrite_2.idl:24

Referenced by dwritetextformat1_layout_SetOpticalAlignment(), and dwritetextformat1_SetOpticalAlignment().

◆ format_set_paralignment()

HRESULT format_set_paralignment ( struct dwrite_textformat_data *  format,
DWRITE_PARAGRAPH_ALIGNMENT  alignment,
BOOL *  changed 
)

Definition at line 68 of file format.c.

69{
71 return E_INVALIDARG;
72 if (changed) *changed = format->paralign != alignment;
73 format->paralign = alignment;
74 return S_OK;
75}
@ DWRITE_PARAGRAPH_ALIGNMENT_CENTER
Definition: dwrite.idl:186

Referenced by dwritetextformat_layout_SetParagraphAlignment(), and dwritetextformat_SetParagraphAlignment().

◆ format_set_readingdirection()

HRESULT format_set_readingdirection ( struct dwrite_textformat_data *  format,
DWRITE_READING_DIRECTION  direction,
BOOL *  changed 
)

Definition at line 77 of file format.c.

78{
80 return E_INVALIDARG;
81 if (changed) *changed = format->readingdir != direction;
82 format->readingdir = direction;
83 return S_OK;
84}
@ DWRITE_READING_DIRECTION_BOTTOM_TO_TOP
Definition: dwrite.idl:203

Referenced by dwritetextformat_layout_SetReadingDirection(), and dwritetextformat_SetReadingDirection().

◆ format_set_textalignment()

HRESULT format_set_textalignment ( struct dwrite_textformat_data *  format,
DWRITE_TEXT_ALIGNMENT  alignment,
BOOL *  changed 
)

Definition at line 58 of file format.c.

60{
62 return E_INVALIDARG;
63 if (changed) *changed = format->textalignment != alignment;
64 format->textalignment = alignment;
65 return S_OK;
66}
@ DWRITE_TEXT_ALIGNMENT_JUSTIFIED
Definition: dwrite.idl:179

Referenced by dwritetextformat_layout_SetTextAlignment(), and dwritetextformat_SetTextAlignment().

◆ format_set_trimming()

HRESULT format_set_trimming ( struct dwrite_textformat_data *  format,
DWRITE_TRIMMING const *  trimming,
IDWriteInlineObject *  trimming_sign,
BOOL *  changed 
)

Definition at line 104 of file format.c.

106{
107 if (changed)
108 *changed = FALSE;
109
110 if ((UINT32)trimming->granularity > DWRITE_TRIMMING_GRANULARITY_WORD)
111 return E_INVALIDARG;
112
113 if (changed) {
114 *changed = !!memcmp(&format->trimming, trimming, sizeof(*trimming));
115 if (format->trimmingsign != trimming_sign)
116 *changed = TRUE;
117 }
118
119 format->trimming = *trimming;
120 if (format->trimmingsign)
121 IDWriteInlineObject_Release(format->trimmingsign);
122 format->trimmingsign = trimming_sign;
123 if (format->trimmingsign)
124 IDWriteInlineObject_AddRef(format->trimmingsign);
125 return S_OK;
126}
@ DWRITE_TRIMMING_GRANULARITY_WORD
Definition: dwrite.idl:218

Referenced by dwritetextformat_layout_SetTrimming(), and dwritetextformat_SetTrimming().

◆ format_set_vertical_orientation()

HRESULT format_set_vertical_orientation ( struct dwrite_textformat_data *  format,
DWRITE_VERTICAL_GLYPH_ORIENTATION  orientation,
BOOL *  changed 
)

Definition at line 202 of file format.c.

204{
206 return E_INVALIDARG;
207
208 if (changed)
209 *changed = format->vertical_orientation != orientation;
210
211 format->vertical_orientation = orientation;
212 return S_OK;
213}
@ DWRITE_VERTICAL_GLYPH_ORIENTATION_STACKED
Definition: dwrite_1.idl:428

Referenced by dwritetextformat1_SetVerticalGlyphOrientation(), and layout_set_vertical_orientation().

◆ format_set_wordwrapping()

HRESULT format_set_wordwrapping ( struct dwrite_textformat_data *  format,
DWRITE_WORD_WRAPPING  wrapping,
BOOL *  changed 
)

Definition at line 86 of file format.c.

87{
89 return E_INVALIDARG;
90 if (changed) *changed = format->wrapping != wrapping;
91 format->wrapping = wrapping;
92 return S_OK;
93}
@ DWRITE_WORD_WRAPPING_CHARACTER
Definition: dwrite.idl:195

Referenced by dwritetextformat_layout_SetWordWrapping(), and dwritetextformat_SetWordWrapping().

◆ get_eudc_fontcollection()

HRESULT get_eudc_fontcollection ( IDWriteFactory7 *  factory,
IDWriteFontCollection3 **  collection 
)

Definition at line 5223 of file font.c.

5224{
5226 WCHAR eudckeypathW[16];
5227 HKEY eudckey;
5228 UINT32 index;
5229 BOOL exists;
5230 LONG retval;
5231 HRESULT hr;
5232 size_t i;
5233
5234 TRACE("building EUDC font collection for factory %p, ACP %u\n", factory, GetACP());
5235
5236 *ret = NULL;
5237
5238 if (!(collection = calloc(1, sizeof(*collection))))
5239 return E_OUTOFMEMORY;
5240
5242 if (FAILED(hr))
5243 {
5245 return hr;
5246 }
5247
5248 *ret = &collection->IDWriteFontCollection3_iface;
5249
5250 /* return empty collection if EUDC fonts are not configured */
5251 swprintf(eudckeypathW, ARRAY_SIZE(eudckeypathW), L"EUDC\\%u", GetACP());
5252 if (RegOpenKeyExW(HKEY_CURRENT_USER, eudckeypathW, 0, GENERIC_READ, &eudckey))
5253 return S_OK;
5254
5256 index = 0;
5257 while (retval != ERROR_NO_MORE_ITEMS) {
5258 WCHAR keynameW[64], pathW[MAX_PATH];
5259 DWORD type, path_len, name_len;
5260
5262 name_len = ARRAY_SIZE(keynameW);
5263 retval = RegEnumValueW(eudckey, index++, keynameW, &name_len, NULL, &type, (BYTE*)pathW, &path_len);
5264 if (retval || type != REG_SZ)
5265 continue;
5266
5268 if (hr != S_OK)
5269 WARN("failed to add family %s, path %s\n", debugstr_w(keynameW), debugstr_w(pathW));
5270 }
5271 RegCloseKey(eudckey);
5272
5273 /* try to add global default if not defined for specific codepage */
5274 exists = FALSE;
5275 hr = IDWriteFontCollection3_FindFamilyName(&collection->IDWriteFontCollection3_iface, L"",
5276 &index, &exists);
5277 if (FAILED(hr) || !exists)
5278 {
5280 if (hr != S_OK)
5281 WARN("failed to add global default EUDC font, 0x%08lx\n", hr);
5282 }
5283
5284 /* EUDC collection offers simulated faces too */
5285 for (i = 0; i < collection->count; ++i)
5286 {
5289 }
5290
5291 return S_OK;
5292}
#define REG_SZ
Definition: layer.c:22
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
static HRESULT eudc_collection_add_family(IDWriteFactory7 *factory, struct dwrite_fontcollection *collection, const WCHAR *keynameW, const WCHAR *pathW)
Definition: font.c:5140
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2830
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
UINT WINAPI GetACP(void)
Definition: locale.c:2023
#define swprintf
Definition: precomp.h:40
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static DWORD path_len
Definition: batch.c:31
static const WCHAR pathW[]
Definition: path.c:2368
long LONG
Definition: pedump.c:60
int retval
Definition: wcstombs.cpp:91
#define HKEY_CURRENT_USER
Definition: winreg.h:11
unsigned char BYTE
Definition: xxhash.c:193

Referenced by dwritefactory1_GetEudcFontCollection().

◆ get_family_names_from_stream()

HRESULT get_family_names_from_stream ( IDWriteFontFileStream *  ,
UINT32  ,
DWRITE_FONT_FACE_TYPE  ,
IDWriteLocalizedStrings **   
)

◆ get_filestream_from_file()

HRESULT get_filestream_from_file ( IDWriteFontFile *  file,
IDWriteFontFileStream **  stream 
)

Definition at line 3563 of file font.c.

3564{
3566 const void *key;
3567 UINT32 key_size;
3568 HRESULT hr;
3569
3570 *stream = NULL;
3571
3572 hr = IDWriteFontFile_GetReferenceKey(file, &key, &key_size);
3573 if (FAILED(hr))
3574 return hr;
3575
3576 hr = IDWriteFontFile_GetLoader(file, &loader);
3577 if (FAILED(hr))
3578 return hr;
3579
3580 hr = IDWriteFontFileLoader_CreateStreamFromKey(loader, key, key_size, stream);
3581 IDWriteFontFileLoader_Release(loader);
3582 if (FAILED(hr))
3583 return hr;
3584
3585 return hr;
3586}

Referenced by create_font_collection(), create_font_collection_from_set(), create_font_resource(), dwrite_cmap_init(), dwritefactory_CreateFontFace(), eudc_collection_add_family(), fontset_entry_get_property(), get_font_info_strings(), and get_fontface_from_font().

◆ get_fontface_table()

const void * get_fontface_table ( IDWriteFontFace5 *  fontface,
UINT32  tag,
struct dwrite_fonttable *  table 
)

Definition at line 666 of file font.c.

667{
668 HRESULT hr;
669
670 if (table->data || !table->exists)
671 return table->data;
672
673 table->exists = FALSE;
674 hr = IDWriteFontFace5_TryGetFontTable(fontface, tag, (const void **)&table->data, &table->size, &table->context,
675 &table->exists);
676 if (FAILED(hr) || !table->exists) {
677 TRACE("Font does not have %s table\n", debugstr_fourcc(tag));
678 return NULL;
679 }
680
681 return table->data;
682}
BYTE * data
Definition: ecma_167.h:138

Referenced by create_colorglyphenum(), get_fontface_cpal(), get_fontface_gasp(), get_fontface_vdmx(), opentype_get_cblc_formats(), and opentype_get_sbix_formats().

◆ get_fontsig_from_font()

HRESULT get_fontsig_from_font ( IDWriteFont *  iface,
FONTSIGNATURE *  fontsig 
)

Definition at line 2566 of file font.c.

2567{
2569 *fontsig = font->data->fontsig;
2570 return S_OK;
2571}
static struct dwrite_font * unsafe_impl_from_IDWriteFont(IDWriteFont *iface)
Definition: font.c:2528

Referenced by gdiinterop1_GetFontSignature().

◆ get_fontsig_from_fontface()

HRESULT get_fontsig_from_fontface ( IDWriteFontFace *  iface,
FONTSIGNATURE *  fontsig 
)

Definition at line 2573 of file font.c.

2574{
2575 struct dwrite_fontface *fontface = unsafe_impl_from_IDWriteFontFace(iface);
2576 *fontsig = fontface->fontsig;
2577 return S_OK;
2578}

Referenced by gdiinterop1_GetFontSignature_().

◆ get_local_fontfile_loader()

IDWriteFontFileLoader * get_local_fontfile_loader ( void  )

Definition at line 6000 of file font.c.

6001{
6002 return (IDWriteFontFileLoader *)&local_fontfile_loader.IDWriteLocalFontFileLoader_iface;
6003}
static struct dwrite_localfontfileloader local_fontfile_loader
Definition: font.c:5604

Referenced by init_dwritefactory().

◆ get_local_refkey()

HRESULT get_local_refkey ( const WCHAR *  path,
const FILETIME *  writetime,
void **  key,
UINT32 *  size 
)

Definition at line 6005 of file font.c.

6006{
6007 struct local_refkey *refkey;
6008
6009 if (!path)
6010 return E_INVALIDARG;
6011
6012 *size = FIELD_OFFSET(struct local_refkey, name) + (wcslen(path)+1)*sizeof(WCHAR);
6013 *key = NULL;
6014
6015 if (!(refkey = malloc(*size)))
6016 return E_OUTOFMEMORY;
6017
6018 if (writetime)
6019 refkey->writetime = *writetime;
6020 else {
6022
6024 refkey->writetime = info.ftLastWriteTime;
6025 else
6026 memset(&refkey->writetime, 0, sizeof(refkey->writetime));
6027 }
6028 wcscpy(refkey->name, path);
6029
6030 *key = refkey;
6031
6032 return S_OK;
6033}
BOOL WINAPI GetFileAttributesExW(LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation)
Definition: fileinfo.c:536
@ GetFileExInfoStandard
Definition: minwinbase.h:356
wcscpy
WCHAR name[1]
Definition: font.c:5574
FILETIME writetime
Definition: font.c:5573
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

Referenced by dwritefactory_CreateFontFileReference().

◆ get_localizedstrings_count()

unsigned int get_localizedstrings_count ( IDWriteLocalizedStrings *  strings)

Definition at line 563 of file main.c.

564{
566 return strings->count;
567}

Referenced by localizedstrings_GetCount(), and opentype_get_font_strings_from_id().

◆ get_logfont_from_font()

void get_logfont_from_font ( IDWriteFont *  iface,
LOGFONTW *  lf 
)

Definition at line 2554 of file font.c.

2555{
2557 *lf = font->data->lf;
2558}

Referenced by gdiinterop_ConvertFontToLOGFONT().

◆ get_logfont_from_fontface()

void get_logfont_from_fontface ( IDWriteFontFace *  iface,
LOGFONTW *  lf 
)

Definition at line 2560 of file font.c.

2561{
2562 struct dwrite_fontface *fontface = unsafe_impl_from_IDWriteFontFace(iface);
2563 *lf = fontface->lf;
2564}

Referenced by gdiinterop_ConvertFontFaceToLOGFONT().

◆ get_system_fontcollection()

HRESULT get_system_fontcollection ( IDWriteFactory7 *  factory,
DWRITE_FONT_FAMILY_MODEL  family_model,
IDWriteFontCollection **  collection 
)

Definition at line 5109 of file font.c.

5111{
5112 IDWriteFontFileEnumerator *enumerator;
5113 IDWriteFontSet *fontset;
5114 HRESULT hr;
5115
5116 *collection = NULL;
5117
5118 if (family_model == DWRITE_FONT_FAMILY_MODEL_TYPOGRAPHIC)
5119 {
5120 if (SUCCEEDED(hr = create_system_fontset(factory, &IID_IDWriteFontSet, (void **)&fontset)))
5121 {
5122 hr = create_font_collection_from_set(factory, fontset, family_model,
5123 &IID_IDWriteFontCollection, (void **)collection);
5124 IDWriteFontSet_Release(fontset);
5125 }
5126 }
5127 else
5128 {
5130 {
5131 TRACE("Building system font collection for factory %p.\n", factory);
5133 IDWriteFontFileEnumerator_Release(enumerator);
5134 }
5135 }
5136
5137 return hr;
5138}
static HRESULT create_system_fontfile_enumerator(IDWriteFactory7 *factory, IDWriteFontFileEnumerator **ret)
Definition: font.c:5071
HRESULT create_font_collection_from_set(IDWriteFactory7 *factory, IDWriteFontSet *fontset, DWRITE_FONT_FAMILY_MODEL family_model, REFGUID riid, void **ret)
Definition: font.c:4857
HRESULT create_font_collection(IDWriteFactory7 *factory, IDWriteFontFileEnumerator *enumerator, BOOL is_system, IDWriteFontCollection3 **ret)
Definition: font.c:4649
@ DWRITE_FONT_FAMILY_MODEL_TYPOGRAPHIC
Definition: dwrite_3.idl:170
HRESULT create_system_fontset(IDWriteFactory7 *factory, REFIID riid, void **obj)
Definition: main.c:1624

Referenced by factory_get_system_collection().

◆ get_table_entry_16()

static unsigned short get_table_entry_16 ( const unsigned short *  table,
WCHAR  ch 
)
inlinestatic

Definition at line 113 of file dwrite_private.h.

114{
115 return table[table[table[ch >> 8] + ((ch >> 4) & 0x0f)] + (ch & 0xf)];
116}
unsigned char ch[4][2]
Definition: console.c:118

Referenced by bidi_compute_bracket_pairs(), computeBracketPairs(), ContextualShape_Arabic(), ContextualShape_Syriac(), mirror_char(), unicode_get_mirrored_char(), and unicode_lex().

◆ get_table_entry_32()

static unsigned short get_table_entry_32 ( const unsigned short *  table,
UINT  ch 
)
inlinestatic

Definition at line 118 of file dwrite_private.h.

119{
120 return table[table[table[table[ch >> 12] + ((ch >> 8) & 0x0f)] + ((ch >> 4) & 0x0f)] + (ch & 0xf)];
121}

Referenced by analyze_linebreaks(), arabic_get_joining_type(), BREAK_line(), classify(), get_char_bidi_class(), get_char_script(), and lb_is_newline_char().

◆ get_text_analyzer()

IDWriteTextAnalyzer2 * get_text_analyzer ( void  )

Definition at line 2241 of file analyzer.c.

2242{
2243 return &textanalyzer;
2244}
static IDWriteTextAnalyzer2 textanalyzer
Definition: analyzer.c:2239

Referenced by dwritefactory_CreateTextAnalyzer(), layout_compute(), layout_itemize(), and layout_shape_run().

◆ heap_strdupnW()

static LPWSTR heap_strdupnW ( const WCHAR *  str,
UINT32  len 
)
inlinestatic

Definition at line 54 of file dwrite_private.h.

55{
56 WCHAR *ret = NULL;
57
58 if (len)
59 {
60 ret = malloc((len+1)*sizeof(WCHAR));
61 if(ret)
62 {
63 memcpy(ret, str, len*sizeof(WCHAR));
64 ret[len] = 0;
65 }
66 }
67
68 return ret;
69}
GLenum GLsizei len
Definition: glext.h:6722
const WCHAR * str

Referenced by init_textlayout(), and opentype_decode_namerecord().

◆ init_local_fontfile_loader()

void init_local_fontfile_loader ( void  )

Definition at line 5991 of file font.c.

5992{
5993 local_fontfile_loader.IDWriteLocalFontFileLoader_iface.lpVtbl = &localfontfileloadervtbl;
5994 local_fontfile_loader.refcount = 1;
5997 local_fontfile_loader.cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": localfileloader.lock");
5998}
static const IDWriteLocalFontFileLoaderVtbl localfontfileloadervtbl
Definition: font.c:5980
BOOL WINAPI InitializeCriticalSectionEx(OUT LPCRITICAL_SECTION lpCriticalSection, IN DWORD dwSpinCount, IN DWORD flags)
Definition: sync.c:107
#define DWORD_PTR
Definition: treelist.c:76
#define RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO
Definition: winnt_old.h:1156

Referenced by DllMain().

◆ is_face_type_supported()

BOOL is_face_type_supported ( DWRITE_FONT_FACE_TYPE  type)

Definition at line 1337 of file opentype.c.

1338{
1339 return (type == DWRITE_FONT_FACE_TYPE_CFF) ||
1343}
@ DWRITE_FONT_FACE_TYPE_CFF
Definition: dwrite.idl:61
@ DWRITE_FONT_FACE_TYPE_OPENTYPE_COLLECTION
Definition: dwrite.idl:63
@ DWRITE_FONT_FACE_TYPE_TRUETYPE
Definition: dwrite.idl:62
@ DWRITE_FONT_FACE_TYPE_RAW_CFF
Definition: dwrite.idl:68

Referenced by dwritefactory_CreateFontFace(), and opentype_analyze_font().

◆ is_simulation_valid()

static BOOL is_simulation_valid ( DWRITE_FONT_SIMULATIONS  simulations)
inlinestatic

Definition at line 123 of file dwrite_private.h.

124{
127}
@ DWRITE_FONT_SIMULATIONS_BOLD
Definition: dwrite.idl:147

Referenced by create_fontfacereference(), and dwritefactory_CreateFontFace().

◆ is_system_collection()

BOOL is_system_collection ( IDWriteFontCollection *  collection)

Definition at line 3201 of file font.c.

3202{
3203 void *obj;
3204 return IDWriteFontCollection_QueryInterface(collection, &IID_issystemcollection, &obj) == S_OK;
3205}
static const IID IID_issystemcollection
Definition: font.c:43

Referenced by gdiinterop_ConvertFontToLOGFONT().

◆ lb_is_newline_char()

BOOL lb_is_newline_char ( WCHAR  ch)

Definition at line 851 of file analyzer.c.

852{
854 return c == b_LF || c == b_NL || c == b_CR || c == b_BK;
855}
@ b_NL
Definition: analyzer.c:766
@ b_LF
Definition: analyzer.c:759
@ b_BK
Definition: analyzer.c:757
@ b_CR
Definition: analyzer.c:758
const unsigned short wine_linebreak_table[]
Definition: linebreak.c:7
static unsigned short get_table_entry_32(const unsigned short *table, UINT ch)
const GLubyte * c
Definition: glext.h:8905

Referenced by init_cluster_metrics(), and layout_add_line().

◆ localizedstrings_contains()

BOOL localizedstrings_contains ( IDWriteLocalizedStrings *  strings,
const WCHAR *  str 
)

Definition at line 569 of file main.c.

570{
572 unsigned int i;
573
574 for (i = 0; i < strings->count; ++i)
575 {
576 if (!wcsicmp(strings->data[i].string, str)) return TRUE;
577 }
578
579 return FALSE;
580}

Referenced by fontset_entry_is_matching().

◆ opentype_analyze_container_type()

DWRITE_CONTAINER_TYPE opentype_analyze_container_type ( void const *  data,
UINT32  data_size 
)

Definition at line 3217 of file opentype.c.

3218{
3220
3221 if (data_size < sizeof(DWORD))
3222 return DWRITE_CONTAINER_TYPE_UNKNOWN;
3223
3224 /* Both WOFF and WOFF2 start with 4 bytes signature. */
3225 signature = *(DWORD *)data;
3226
3227 switch (signature)
3228 {
3229 case MS_WOFF_TAG:
3231 case MS_WOF2_TAG:
3233 default:
3234 return DWRITE_CONTAINER_TYPE_UNKNOWN;
3235 }
3236}
#define MS_WOFF_TAG
Definition: opentype.c:55
#define MS_WOF2_TAG
Definition: opentype.c:56
enum DWRITE_CONTAINER_TYPE_WOFF
enum DWRITE_CONTAINER_TYPE_WOFF2
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by dwritefactory5_AnalyzeContainerType().

◆ opentype_analyze_font()

HRESULT opentype_analyze_font ( IDWriteFontFileStream *  stream,
BOOL *  supported,
DWRITE_FONT_FILE_TYPE *  file_type,
DWRITE_FONT_FACE_TYPE *  face_type,
UINT32 *  face_count 
)

Definition at line 1492 of file opentype.c.

1494{
1495 static dwrite_fontfile_analyzer fontfile_analyzers[] = {
1500 NULL
1501 };
1502 dwrite_fontfile_analyzer *analyzer = fontfile_analyzers;
1504 HRESULT hr;
1505
1506 if (!face_type)
1507 face_type = &face;
1508
1510 *face_type = DWRITE_FONT_FACE_TYPE_UNKNOWN;
1511 *face_count = 0;
1512
1513 while (*analyzer) {
1514 hr = (*analyzer)(stream, face_count, file_type, face_type);
1515 if (FAILED(hr))
1516 return hr;
1517
1518 if (hr == S_OK)
1519 break;
1520
1521 analyzer++;
1522 }
1523
1524 *supported = is_face_type_supported(*face_type);
1525 return S_OK;
1526}
static HRESULT opentype_otf_analyzer(IDWriteFontFileStream *stream, UINT32 *font_count, DWRITE_FONT_FILE_TYPE *file_type, DWRITE_FONT_FACE_TYPE *face_type)
Definition: opentype.c:1393
static HRESULT opentype_ttc_analyzer(IDWriteFontFileStream *stream, UINT32 *font_count, DWRITE_FONT_FILE_TYPE *file_type, DWRITE_FONT_FACE_TYPE *face_type)
Definition: opentype.c:1348
BOOL is_face_type_supported(DWRITE_FONT_FACE_TYPE type)
Definition: opentype.c:1337
static HRESULT opentype_ttf_analyzer(IDWriteFontFileStream *stream, UINT32 *font_count, DWRITE_FONT_FILE_TYPE *file_type, DWRITE_FONT_FACE_TYPE *face_type)
Definition: opentype.c:1371
static HRESULT opentype_type1_analyzer(IDWriteFontFileStream *stream, UINT32 *font_count, DWRITE_FONT_FILE_TYPE *file_type, DWRITE_FONT_FACE_TYPE *face_type)
Definition: opentype.c:1415
HRESULT(* dwrite_fontfile_analyzer)(IDWriteFontFileStream *stream, UINT32 *font_count, DWRITE_FONT_FILE_TYPE *file_type, DWRITE_FONT_FACE_TYPE *face_type)
Definition: opentype.c:1345
WORD face[3]
Definition: mesh.c:4854
@ DWRITE_FONT_FILE_TYPE_UNKNOWN
Definition: dwrite.idl:48
@ DWRITE_FONT_FACE_TYPE_UNKNOWN
Definition: dwrite.idl:67

Referenced by create_font_collection(), dwritefactory_CreateFontFace(), dwritefontfile_Analyze(), and eudc_collection_add_family().

◆ opentype_cmap_get_glyph()

UINT16 opentype_cmap_get_glyph ( const struct dwrite_cmap *  cmap,
unsigned int  ch 
)

Definition at line 1792 of file opentype.c.

1793{
1794 UINT16 glyph;
1795
1796 if (!cmap->get_glyph) return 0;
1797 glyph = cmap->get_glyph(cmap, ch);
1798 if (!glyph && cmap->symbol && ch <= 0xff)
1799 glyph = cmap->get_glyph(cmap, ch + 0xf000);
1800 return glyph;
1801}

Referenced by dwritefont_has_character(), and dwritefontface_get_glyph().

◆ opentype_cmap_get_unicode_ranges()

HRESULT opentype_cmap_get_unicode_ranges ( const struct dwrite_cmap *  cmap,
unsigned int  max_count,
DWRITE_UNICODE_RANGE *  ranges,
unsigned int *  count 
)

Definition at line 1943 of file opentype.c.

1945{
1946 if (!cmap->data)
1947 return E_FAIL;
1948
1949 *count = cmap->get_ranges(cmap, max_count, ranges);
1950
1952}
Character const *const size_t const max_count
Definition: fullpath.cpp:66

Referenced by dwritefont1_GetUnicodeRanges(), and dwritefontface1_GetUnicodeRanges().

◆ opentype_colr_next_glyph()

void opentype_colr_next_glyph ( const struct dwrite_fonttable *  table,
struct dwrite_colorglyph *  color_glyph 
)

Definition at line 3041 of file opentype.c.

3042{
3043 const struct colr_layer_record *layer;
3044 const struct colr_header *header;
3045
3046 /* iterated all the way through */
3047 if (glyph->layer == glyph->num_layers)
3048 return;
3049
3050 if (!(header = table_read_ensure(colr, 0, sizeof(*header))))
3051 return;
3052
3053 glyph->layer++;
3054
3055 if ((layer = table_read_ensure(colr, GET_BE_DWORD(header->offset_layer_records),
3056 (glyph->first_layer + glyph->layer) * sizeof(*layer))))
3057 {
3058 layer += glyph->first_layer + glyph->layer;
3059 glyph->glyph = GET_BE_WORD(layer->glyph);
3060 glyph->palette_index = GET_BE_WORD(layer->palette_index);
3061 }
3062}
#define GET_BE_WORD(x)
Definition: opentype.c:67
GLenum GLuint GLint GLint layer
Definition: glext.h:7007

Referenced by colorglyphenum_build_color_run().

◆ opentype_get_colr_glyph()

HRESULT opentype_get_colr_glyph ( const struct dwrite_fonttable *  table,
UINT16  glyph,
struct dwrite_colorglyph *  color_glyph 
)

Definition at line 3000 of file opentype.c.

3001{
3002 unsigned int num_baseglyph_records, offset_baseglyph_records;
3003 const struct colr_baseglyph_record *record;
3004 const struct colr_layer_record *layer;
3005 const struct colr_header *header;
3006
3007 memset(ret, 0, sizeof(*ret));
3008 ret->glyph = glyph;
3009 ret->palette_index = 0xffff;
3010
3011 header = table_read_ensure(colr, 0, sizeof(*header));
3012 if (!header)
3013 return S_FALSE;
3014
3015 num_baseglyph_records = GET_BE_WORD(header->num_baseglyph_records);
3016 offset_baseglyph_records = GET_BE_DWORD(header->offset_baseglyph_records);
3018 {
3019 return S_FALSE;
3020 }
3021
3023 sizeof(*record), colr_compare_gid);
3024 if (!record)
3025 return S_FALSE;
3026
3027 ret->first_layer = GET_BE_WORD(record->first_layer_index);
3028 ret->num_layers = GET_BE_WORD(record->num_layers);
3029
3030 if ((layer = table_read_ensure(colr, GET_BE_DWORD(header->offset_layer_records),
3031 (ret->first_layer + ret->layer) * sizeof(*layer))))
3032 {
3033 layer += ret->first_layer + ret->layer;
3034 ret->glyph = GET_BE_WORD(layer->glyph);
3035 ret->palette_index = GET_BE_WORD(layer->palette_index);
3036 }
3037
3038 return S_OK;
3039}
static int __cdecl colr_compare_gid(const void *g, const void *r)
Definition: opentype.c:2986
uint32_t offset_baseglyph_records
Definition: opentype.c:1250
uint16_t num_baseglyph_records
Definition: opentype.c:1249

Referenced by create_colorglyphenum().

◆ opentype_get_cpal_entries()

HRESULT opentype_get_cpal_entries ( const struct dwrite_fonttable *  table,
unsigned int  palette,
unsigned int  first_entry_index,
unsigned int  entry_count,
DWRITE_COLOR_F *  entries 
)

Definition at line 2937 of file opentype.c.

2939{
2940 unsigned int num_palettes, num_palette_entries, i;
2941 const struct cpal_color_record *records;
2942 const struct cpal_header_0 *header;
2943 struct d3d_color
2944 {
2945 float r;
2946 float g;
2947 float b;
2948 float a;
2949 } *colors = (void *)entries;
2950
2951 header = table_read_ensure(cpal, 0, sizeof(*header));
2952
2953 if (!cpal->exists || !header)
2954 return DWRITE_E_NOCOLOR;
2955
2956 num_palettes = GET_BE_WORD(header->num_palettes);
2957 if (palette >= num_palettes)
2958 return DWRITE_E_NOCOLOR;
2959
2960 header = table_read_ensure(cpal, 0, FIELD_OFFSET(struct cpal_header_0, color_record_indices[palette]));
2961 if (!header)
2962 return DWRITE_E_NOCOLOR;
2963
2964 num_palette_entries = GET_BE_WORD(header->num_palette_entries);
2965 if (first_entry_index + entry_count > num_palette_entries)
2966 return E_INVALIDARG;
2967
2968 records = table_read_ensure(cpal, GET_BE_DWORD(header->offset_first_color_record),
2969 sizeof(*records) * GET_BE_WORD(header->num_color_records));
2970 if (!records)
2971 return DWRITE_E_NOCOLOR;
2972
2973 first_entry_index += GET_BE_WORD(header->color_record_indices[palette]);
2974
2975 for (i = 0; i < entry_count; ++i)
2976 {
2977 colors[i].r = records[first_entry_index + i].red / 255.0f;
2978 colors[i].g = records[first_entry_index + i].green / 255.0f;
2979 colors[i].b = records[first_entry_index + i].blue / 255.0f;
2980 colors[i].a = records[first_entry_index + i].alpha / 255.0f;
2981 }
2982
2983 return S_OK;
2984}
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean GLboolean g
Definition: glext.h:6204
#define b
Definition: ke_i.h:79
static HPALETTE palette
Definition: clipboard.c:1457
#define DWRITE_E_NOCOLOR
Definition: winerror.h:7346

Referenced by dwritefontface2_GetPaletteEntries().

◆ opentype_get_cpal_palettecount()

unsigned int opentype_get_cpal_palettecount ( const struct dwrite_fonttable *  table)

Definition at line 2927 of file opentype.c.

2928{
2929 return table_read_be_word(cpal, FIELD_OFFSET(struct cpal_header_0, num_palettes));
2930}

Referenced by dwritefontface2_GetColorPaletteCount().

◆ opentype_get_cpal_paletteentrycount()

unsigned int opentype_get_cpal_paletteentrycount ( const struct dwrite_fonttable *  table)

Definition at line 2932 of file opentype.c.

2933{
2934 return table_read_be_word(cpal, FIELD_OFFSET(struct cpal_header_0, num_palette_entries));
2935}

Referenced by dwritefontface2_GetPaletteEntryCount().

◆ opentype_get_font_facename()

HRESULT opentype_get_font_facename ( struct file_stream_desc *  stream_desc,
WCHAR *  lfname,
IDWriteLocalizedStrings **  names 
)

Definition at line 2690 of file opentype.c.

2691{
2692 struct dwrite_fonttable os2, name;
2693 IDWriteLocalizedStrings *lfnames;
2694 UINT16 fsselection;
2695 HRESULT hr;
2696
2697 opentype_get_font_table(stream_desc, MS_OS2_TAG, &os2);
2699
2700 *names = NULL;
2701
2702 /* if Preferred Family doesn't conform to WWS model try WWS name */
2703 fsselection = os2.data ? table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, fsSelection)) : 0;
2704 if (os2.data && !(fsselection & OS2_FSSELECTION_WWS))
2706 else
2707 hr = E_FAIL;
2708
2709 if (FAILED(hr))
2711 if (FAILED(hr))
2713
2714 /* User locale is preferred, with fallback to en-us. */
2715 *lfname = 0;
2717 {
2719 UINT32 index;
2720 BOOL exists;
2721
2722 exists = FALSE;
2724 IDWriteLocalizedStrings_FindLocaleName(lfnames, localeW, &index, &exists);
2725
2726 if (!exists)
2727 IDWriteLocalizedStrings_FindLocaleName(lfnames, L"en-us", &index, &exists);
2728
2729 if (exists) {
2730 UINT32 length = 0;
2731 WCHAR *nameW;
2732
2733 IDWriteLocalizedStrings_GetStringLength(lfnames, index, &length);
2734 nameW = malloc((length + 1) * sizeof(WCHAR));
2735 if (nameW)
2736 {
2737 *nameW = 0;
2738 IDWriteLocalizedStrings_GetString(lfnames, index, nameW, length + 1);
2739 lstrcpynW(lfname, nameW, LF_FACESIZE);
2740 free(nameW);
2741 }
2742 }
2743
2744 IDWriteLocalizedStrings_Release(lfnames);
2745 }
2746
2747 if (os2.context)
2748 IDWriteFontFileStream_ReleaseFileFragment(stream_desc->stream, os2.context);
2749 if (name.context)
2750 IDWriteFontFileStream_ReleaseFileFragment(stream_desc->stream, name.context);
2751
2752 return hr;
2753}
static const WCHAR nameW[]
Definition: main.c:49
#define LF_FACESIZE
Definition: dimm.idl:39
#define MS_NAME_TAG
Definition: opentype.c:35
#define MS_OS2_TAG
Definition: opentype.c:31
@ OPENTYPE_STRING_FAMILY_NAME
Definition: opentype.c:1178
@ OPENTYPE_STRING_WWS_SUBFAMILY_NAME
Definition: opentype.c:1199
@ OPENTYPE_STRING_TYPOGRAPHIC_SUBFAMILY_NAME
Definition: opentype.c:1194
@ OPENTYPE_STRING_SUBFAMILY_NAME
Definition: opentype.c:1179
static HRESULT opentype_get_font_strings_from_id(const struct dwrite_fonttable *table, enum OPENTYPE_STRING_ID id, IDWriteLocalizedStrings **strings)
Definition: opentype.c:2420
@ OS2_FSSELECTION_WWS
Definition: opentype.c:337
#define lstrcpynW
Definition: compat.h:738
INT WINAPI GetSystemDefaultLocaleName(LPWSTR localename, INT len)
Definition: locale.c:1246
GLuint GLuint * names
Definition: glext.h:11545
static const WCHAR localeW[]
Definition: locale.c:49
#define LOCALE_NAME_MAX_LENGTH
IDWriteFontFileStream * stream

Referenced by init_font_data().

◆ opentype_get_font_familyname()

HRESULT opentype_get_font_familyname ( const struct file_stream_desc *  desc,
DWRITE_FONT_FAMILY_MODEL  family_model,
IDWriteLocalizedStrings **  names 
)

Definition at line 2629 of file opentype.c.

2631{
2632 static const unsigned int wws_candidates[] =
2633 {
2637 ~0u,
2638 };
2639 static const unsigned int typographic_candidates[] =
2640 {
2644 ~0u,
2645 };
2646 struct dwrite_fonttable os2, name;
2647 const unsigned int *id;
2648 BOOL try_wws_name;
2649 HRESULT hr;
2650
2651 opentype_get_font_table(stream_desc, MS_OS2_TAG, &os2);
2653
2654 *names = NULL;
2655
2656 if (family_model == DWRITE_FONT_FAMILY_MODEL_TYPOGRAPHIC)
2657 {
2658 id = typographic_candidates;
2659 }
2660 else
2661 {
2662 /* FamilyName locating order is WWS Family Name -> Preferred Family Name -> Family Name. If font claims to
2663 have 'Preferred Family Name' in WWS format, then WWS name is not used. */
2664
2665 opentype_get_font_table(stream_desc, MS_OS2_TAG, &os2);
2666 /* If Preferred Family doesn't conform to WWS model try WWS name. */
2667 try_wws_name = os2.data && !(table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, fsSelection)) & OS2_FSSELECTION_WWS);
2668 if (os2.context)
2669 IDWriteFontFileStream_ReleaseFileFragment(stream_desc->stream, os2.context);
2670
2671 id = wws_candidates;
2672 if (!try_wws_name) id++;
2673 }
2674
2675 while (*id != ~0u)
2676 {
2678 break;
2679 id++;
2680 }
2681
2682 if (name.context)
2683 IDWriteFontFileStream_ReleaseFileFragment(stream_desc->stream, name.context);
2684
2685 return hr;
2686}
@ OPENTYPE_STRING_WWS_FAMILY_NAME
Definition: opentype.c:1198
@ OPENTYPE_STRING_TYPOGRAPHIC_FAMILY_NAME
Definition: opentype.c:1193
GLuint id
Definition: glext.h:5910

Referenced by init_font_data().

◆ opentype_get_font_info_strings()

HRESULT opentype_get_font_info_strings ( const struct file_stream_desc *  stream_desc,
DWRITE_INFORMATIONAL_STRING_ID  id,
IDWriteLocalizedStrings **  strings 
)

Definition at line 2608 of file opentype.c.

2610{
2611 struct dwrite_fonttable name;
2612
2613 switch (id)
2614 {
2618 break;
2619 default:
2622 if (name.context)
2623 IDWriteFontFileStream_ReleaseFileFragment(stream_desc->stream, name.context);
2624 }
2625
2626 return S_OK;
2627}
static HRESULT opentype_get_font_strings_from_meta(const struct file_stream_desc *stream_desc, DWRITE_INFORMATIONAL_STRING_ID id, IDWriteLocalizedStrings **ret)
Definition: opentype.c:2518
static const UINT16 dwriteid_to_opentypeid[DWRITE_INFORMATIONAL_STRING_WEIGHT_STRETCH_STYLE_FAMILY_NAME+1]
Definition: opentype.c:1202
@ DWRITE_INFORMATIONAL_STRING_DESIGN_SCRIPT_LANGUAGE_TAG
Definition: dwrite.idl:137
@ DWRITE_INFORMATIONAL_STRING_SUPPORTED_SCRIPT_LANGUAGE_TAG
Definition: dwrite.idl:138

Referenced by fontset_entry_get_property(), and get_font_info_strings().

◆ opentype_get_font_metrics()

void opentype_get_font_metrics ( struct file_stream_desc *  stream_desc,
DWRITE_FONT_METRICS1 *  metrics,
DWRITE_CARET_METRICS *  caret 
)

Definition at line 1973 of file opentype.c.

1974{
1975 struct dwrite_fonttable os2, head, post, hhea;
1976
1977 memset(metrics, 0, sizeof(*metrics));
1978
1979 opentype_get_font_table(stream_desc, MS_OS2_TAG, &os2);
1981 opentype_get_font_table(stream_desc, MS_POST_TAG, &post);
1982 opentype_get_font_table(stream_desc, MS_HHEA_TAG, &hhea);
1983
1984 if (head.data)
1985 {
1986 metrics->designUnitsPerEm = table_read_be_word(&head, FIELD_OFFSET(struct tt_head, unitsPerEm));
1987 metrics->glyphBoxLeft = table_read_be_word(&head, FIELD_OFFSET(struct tt_head, xMin));
1988 metrics->glyphBoxTop = table_read_be_word(&head, FIELD_OFFSET(struct tt_head, yMax));
1989 metrics->glyphBoxRight = table_read_be_word(&head, FIELD_OFFSET(struct tt_head, xMax));
1990 metrics->glyphBoxBottom = table_read_be_word(&head, FIELD_OFFSET(struct tt_head, yMin));
1991 }
1992
1993 if (caret)
1994 {
1995 if (hhea.data)
1996 {
1997 caret->slopeRise = table_read_be_word(&hhea, FIELD_OFFSET(struct tt_hhea, caretSlopeRise));
1998 caret->slopeRun = table_read_be_word(&hhea, FIELD_OFFSET(struct tt_hhea, caretSlopeRun));
1999 caret->offset = table_read_be_word(&hhea, FIELD_OFFSET(struct tt_hhea, caretOffset));
2000 }
2001 else
2002 memset(caret, 0, sizeof(*caret));
2003 }
2004
2005 if (os2.data)
2006 {
2008
2009 metrics->ascent = table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, usWinAscent));
2010 /* Some fonts have usWinDescent value stored as signed short, which could be wrongly
2011 interpreted as large unsigned value. */
2012 metrics->descent = abs((SHORT)table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, usWinDescent)));
2013
2014 /* Line gap is estimated using two sets of ascender/descender values and 'hhea' line gap. */
2015 if (hhea.data)
2016 {
2017 SHORT descender = (SHORT)table_read_be_word(&hhea, FIELD_OFFSET(struct tt_hhea, descender));
2018 INT32 linegap;
2019
2020 linegap = table_read_be_word(&hhea, FIELD_OFFSET(struct tt_hhea, ascender)) + abs(descender) +
2021 table_read_be_word(&hhea, FIELD_OFFSET(struct tt_hhea, linegap)) - metrics->ascent - metrics->descent;
2022 metrics->lineGap = linegap > 0 ? linegap : 0;
2023 }
2024
2025 metrics->strikethroughPosition = table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, yStrikeoutPosition));
2026 metrics->strikethroughThickness = table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, yStrikeoutSize));
2027 metrics->subscriptPositionX = table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, ySubscriptXOffset));
2028 /* Y offset is stored as positive offset below baseline */
2029 metrics->subscriptPositionY = -table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, ySubscriptYOffset));
2030 metrics->subscriptSizeX = table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, ySubscriptXSize));
2031 metrics->subscriptSizeY = table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, ySubscriptYSize));
2032 metrics->superscriptPositionX = table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, ySuperscriptXOffset));
2033 metrics->superscriptPositionY = table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, ySuperscriptYOffset));
2034 metrics->superscriptSizeX = table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, ySuperscriptXSize));
2035 metrics->superscriptSizeY = table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, ySuperscriptYSize));
2036
2037 /* version 2 fields */
2038 if (version >= 2)
2039 {
2040 metrics->capHeight = table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, sCapHeight));
2041 metrics->xHeight = table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, sxHeight));
2042 }
2043
2045 {
2046 SHORT descent = table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, sTypoDescender));
2047 metrics->ascent = table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, sTypoAscender));
2048 metrics->descent = descent < 0 ? -descent : 0;
2049 metrics->lineGap = table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, sTypoLineGap));
2050 metrics->hasTypographicMetrics = TRUE;
2051 }
2052 }
2053 else
2054 {
2055 metrics->strikethroughPosition = metrics->designUnitsPerEm / 3;
2056 if (hhea.data)
2057 {
2058 metrics->ascent = table_read_be_word(&hhea, FIELD_OFFSET(struct tt_hhea, ascender));
2059 metrics->descent = abs((SHORT)table_read_be_word(&hhea, FIELD_OFFSET(struct tt_hhea, descender)));
2060 }
2061 }
2062
2063 if (post.data)
2064 {
2065 metrics->underlinePosition = table_read_be_word(&post, FIELD_OFFSET(struct tt_post, underlinePosition));
2066 metrics->underlineThickness = table_read_be_word(&post, FIELD_OFFSET(struct tt_post, underlineThickness));
2067 }
2068
2069 if (metrics->underlineThickness == 0)
2070 metrics->underlineThickness = metrics->designUnitsPerEm / 14;
2071 if (metrics->strikethroughThickness == 0)
2072 metrics->strikethroughThickness = metrics->underlineThickness;
2073
2074 /* estimate missing metrics */
2075 if (metrics->xHeight == 0)
2076 metrics->xHeight = metrics->designUnitsPerEm / 2;
2077 if (metrics->capHeight == 0)
2078 metrics->capHeight = metrics->designUnitsPerEm * 7 / 10;
2079
2080 if (os2.data)
2081 IDWriteFontFileStream_ReleaseFileFragment(stream_desc->stream, os2.context);
2082 if (head.data)
2083 IDWriteFontFileStream_ReleaseFileFragment(stream_desc->stream, head.context);
2084 if (post.data)
2085 IDWriteFontFileStream_ReleaseFileFragment(stream_desc->stream, post.context);
2086 if (hhea.data)
2087 IDWriteFontFileStream_ReleaseFileFragment(stream_desc->stream, hhea.context);
2088}
struct outqueuenode * head
Definition: adnsresfilter.c:66
#define MS_HHEA_TAG
Definition: opentype.c:29
#define MS_POST_TAG
Definition: opentype.c:32
#define MS_HEAD_TAG
Definition: opentype.c:28
@ OS2_FSSELECTION_USE_TYPO_METRICS
Definition: opentype.c:336
static const WCHAR version[]
Definition: asmname.c:66
#define abs(i)
Definition: fconv.c:206
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
Definition: glext.h:11745
short SHORT
Definition: pedump.c:59
unsigned short USHORT
Definition: pedump.c:61
Definition: opentype.c:169
int32_t INT32
Definition: typedefs.h:58

Referenced by create_fontface(), and init_font_data().

◆ opentype_get_font_properties()

void opentype_get_font_properties ( const struct file_stream_desc *  stream_desc,
struct dwrite_font_props *  props 
)

Definition at line 2090 of file opentype.c.

2091{
2092 struct dwrite_fonttable os2, head, post, colr, cpal;
2093 BOOL is_symbol, is_monospaced;
2094
2095 opentype_get_font_table(stream_desc, MS_OS2_TAG, &os2);
2097
2098 memset(props, 0, sizeof(*props));
2099
2100 /* Default stretch, weight and style to normal */
2104
2105 /* DWRITE_FONT_STRETCH enumeration values directly match font data values */
2106 if (os2.data)
2107 {
2109 USHORT fsSelection = table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, fsSelection));
2110 USHORT usWeightClass = table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, usWeightClass));
2111 USHORT usWidthClass = table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, usWidthClass));
2112 const void *panose;
2113
2114 if (usWidthClass > DWRITE_FONT_STRETCH_UNDEFINED && usWidthClass <= DWRITE_FONT_STRETCH_ULTRA_EXPANDED)
2115 props->stretch = usWidthClass;
2116
2117 if (usWeightClass >= 1 && usWeightClass <= 9)
2118 usWeightClass *= 100;
2119
2120 if (usWeightClass > DWRITE_FONT_WEIGHT_ULTRA_BLACK)
2122 else if (usWeightClass > 0)
2123 props->weight = usWeightClass;
2124
2125 if (version >= 4 && (fsSelection & OS2_FSSELECTION_OBLIQUE))
2127 else if (fsSelection & OS2_FSSELECTION_ITALIC)
2129 props->lf.lfItalic = !!(fsSelection & OS2_FSSELECTION_ITALIC);
2130
2131 if ((panose = table_read_ensure(&os2, FIELD_OFFSET(struct tt_os2, panose), sizeof(props->panose))))
2132 memcpy(&props->panose, panose, sizeof(props->panose));
2133
2134 /* FONTSIGNATURE */
2135 props->fontsig.fsUsb[0] = table_read_be_dword(&os2, FIELD_OFFSET(struct tt_os2, ulUnicodeRange1));
2136 props->fontsig.fsUsb[1] = table_read_be_dword(&os2, FIELD_OFFSET(struct tt_os2, ulUnicodeRange2));
2137 props->fontsig.fsUsb[2] = table_read_be_dword(&os2, FIELD_OFFSET(struct tt_os2, ulUnicodeRange3));
2138 props->fontsig.fsUsb[3] = table_read_be_dword(&os2, FIELD_OFFSET(struct tt_os2, ulUnicodeRange4));
2139
2140 if (version)
2141 {
2142 props->fontsig.fsCsb[0] = table_read_be_dword(&os2, FIELD_OFFSET(struct tt_os2, ulCodePageRange1));
2143 props->fontsig.fsCsb[1] = table_read_be_dword(&os2, FIELD_OFFSET(struct tt_os2, ulCodePageRange2));
2144 }
2145 }
2146 else if (head.data)
2147 {
2148 USHORT macStyle = table_read_be_word(&head, FIELD_OFFSET(struct tt_head, macStyle));
2149
2150 if (macStyle & TT_HEAD_MACSTYLE_CONDENSED)
2152 else if (macStyle & TT_HEAD_MACSTYLE_EXTENDED)
2154
2155 if (macStyle & TT_HEAD_MACSTYLE_BOLD)
2157
2158 if (macStyle & TT_HEAD_MACSTYLE_ITALIC) {
2160 props->lf.lfItalic = 1;
2161 }
2162 }
2163
2164 props->lf.lfWeight = props->weight;
2165
2166 /* FONT_IS_SYMBOL */
2167 if (!(is_symbol = props->panose.familyKind == DWRITE_PANOSE_FAMILY_SYMBOL))
2168 {
2169 struct dwrite_fonttable cmap;
2170 int i, offset, num_tables;
2171
2172 opentype_get_font_table(stream_desc, MS_CMAP_TAG, &cmap);
2173
2174 if (cmap.data)
2175 {
2176 num_tables = table_read_be_word(&cmap, FIELD_OFFSET(struct cmap_header, num_tables));
2178
2179 for (i = 0; !is_symbol && i < num_tables; ++i)
2180 {
2181 WORD platform, encoding;
2182
2183 platform = table_read_be_word(&cmap, offset + i * sizeof(struct cmap_encoding_record) +
2184 FIELD_OFFSET(struct cmap_encoding_record, platformID));
2185 encoding = table_read_be_word(&cmap, offset + i * sizeof(struct cmap_encoding_record) +
2186 FIELD_OFFSET(struct cmap_encoding_record, encodingID));
2187
2190 }
2191
2192 IDWriteFontFileStream_ReleaseFileFragment(stream_desc->stream, cmap.context);
2193 }
2194 }
2195 if (is_symbol)
2196 props->flags |= FONT_IS_SYMBOL;
2197
2198 /* FONT_IS_MONOSPACED, slant angle */
2199 opentype_get_font_table(stream_desc, MS_POST_TAG, &post);
2200 is_monospaced = props->panose.text.proportion == DWRITE_PANOSE_PROPORTION_MONOSPACED;
2201 if (post.data)
2202 {
2203 if (!is_monospaced)
2204 is_monospaced = !!table_read_dword(&post, FIELD_OFFSET(struct tt_post, fixed_pitch));
2205 props->slant_angle = table_read_be_fixed(&post, FIELD_OFFSET(struct tt_post, italicAngle));
2206 }
2207 if (post.context)
2208 IDWriteFontFileStream_ReleaseFileFragment(stream_desc->stream, post.context);
2209
2210 if (is_monospaced)
2211 props->flags |= FONT_IS_MONOSPACED;
2212
2213 /* FONT_IS_COLORED */
2214 opentype_get_font_table(stream_desc, MS_COLR_TAG, &colr);
2215 if (colr.data)
2216 {
2217 opentype_get_font_table(stream_desc, MS_CPAL_TAG, &cpal);
2218 if (cpal.data)
2219 {
2220 props->flags |= FONT_IS_COLORED;
2221 IDWriteFontFileStream_ReleaseFileFragment(stream_desc->stream, cpal.context);
2222 }
2223
2224 IDWriteFontFileStream_ReleaseFileFragment(stream_desc->stream, colr.context);
2225 }
2226
2227 TRACE("stretch %d, weight %d, style %d\n", props->stretch, props->weight, props->style);
2228
2229 if (os2.data)
2230 IDWriteFontFileStream_ReleaseFileFragment(stream_desc->stream, os2.context);
2231 if (head.data)
2232 IDWriteFontFileStream_ReleaseFileFragment(stream_desc->stream, head.context);
2233}
static DWORD table_read_dword(const struct dwrite_fonttable *table, unsigned int offset)
Definition: opentype.c:1331
#define MS_CPAL_TAG
Definition: opentype.c:39
#define MS_COLR_TAG
Definition: opentype.c:40
@ TT_HEAD_MACSTYLE_EXTENDED
Definition: opentype.c:165
@ TT_HEAD_MACSTYLE_ITALIC
Definition: opentype.c:160
@ TT_HEAD_MACSTYLE_BOLD
Definition: opentype.c:159
@ TT_HEAD_MACSTYLE_CONDENSED
Definition: opentype.c:164
@ OPENTYPE_CMAP_TABLE_PLATFORM_WIN
Definition: opentype.c:123
@ OPENTYPE_CMAP_TABLE_ENCODING_SYMBOL
Definition: opentype.c:128
static float table_read_be_fixed(const struct dwrite_fonttable *table, unsigned int offset)
Definition: opentype.c:1326
@ OS2_FSSELECTION_ITALIC
Definition: opentype.c:329
@ OS2_FSSELECTION_OBLIQUE
Definition: opentype.c:338
struct nls_table * tables
Definition: nls_base.c:22
@ DWRITE_FONT_WEIGHT_NORMAL
Definition: dwrite.idl:79
@ DWRITE_FONT_WEIGHT_BOLD
Definition: dwrite.idl:84
@ DWRITE_FONT_STYLE_NORMAL
Definition: dwrite.idl:110
@ DWRITE_FONT_STYLE_OBLIQUE
Definition: dwrite.idl:111
@ DWRITE_FONT_STRETCH_EXPANDED
Definition: dwrite.idl:103
@ DWRITE_FONT_STRETCH_NORMAL
Definition: dwrite.idl:100
@ DWRITE_FONT_STRETCH_CONDENSED
Definition: dwrite.idl:98
@ DWRITE_PANOSE_FAMILY_SYMBOL
Definition: dwrite_1.idl:28
@ DWRITE_PANOSE_PROPORTION_MONOSPACED
Definition: dwrite_1.idl:83
unsigned short WORD
Definition: ntddk_ex.h:93
platform
Definition: msipriv.h:364

Referenced by init_font_data(), and opentype_get_font_var_axis().

◆ opentype_get_font_typo_metrics()

void opentype_get_font_typo_metrics ( struct file_stream_desc *  stream_desc,
unsigned int *  ascent,
unsigned int *  descent 
)

Definition at line 1954 of file opentype.c.

1955{
1956 struct dwrite_fonttable os2;
1957
1958 opentype_get_font_table(stream_desc, MS_OS2_TAG, &os2);
1959
1960 *ascent = *descent = 0;
1961
1962 if (os2.size >= FIELD_OFFSET(struct tt_os2, sTypoLineGap))
1963 {
1964 SHORT value = table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, sTypoDescender));
1965 *ascent = table_read_be_word(&os2, FIELD_OFFSET(struct tt_os2, sTypoAscender));
1966 *descent = value < 0 ? -value : 0;
1967 }
1968
1969 if (os2.data)
1970 IDWriteFontFileStream_ReleaseFileFragment(stream_desc->stream, os2.context);
1971}
Definition: pdh_main.c:64

Referenced by create_fontface().

◆ opentype_get_font_var_axis()

HRESULT opentype_get_font_var_axis ( const struct file_stream_desc *  stream_desc,
struct dwrite_var_axis **  axis,
unsigned int *  axis_count 
)

Definition at line 6693 of file opentype.c.

6695{
6696 static const float width_axis_values[] =
6697 {
6698 0.0f, /* DWRITE_FONT_STRETCH_UNDEFINED */
6699 50.0f, /* DWRITE_FONT_STRETCH_ULTRA_CONDENSED */
6700 62.5f, /* DWRITE_FONT_STRETCH_EXTRA_CONDENSED */
6701 75.0f, /* DWRITE_FONT_STRETCH_CONDENSED */
6702 87.5f, /* DWRITE_FONT_STRETCH_SEMI_CONDENSED */
6703 100.0f, /* DWRITE_FONT_STRETCH_NORMAL */
6704 112.5f, /* DWRITE_FONT_STRETCH_SEMI_EXPANDED */
6705 125.0f, /* DWRITE_FONT_STRETCH_EXPANDED */
6706 150.0f, /* DWRITE_FONT_STRETCH_EXTRA_EXPANDED */
6707 200.0f, /* DWRITE_FONT_STRETCH_ULTRA_EXPANDED */
6708 };
6709 BOOL has_wght = FALSE, has_wdth = FALSE, has_slnt = FALSE, has_ital = FALSE;
6710 const struct var_axis_record *records;
6711 const struct fvar_header *header;
6712 unsigned int i, count, tag, size;
6713 struct dwrite_font_props props;
6714 struct dwrite_fonttable fvar;
6715 HRESULT hr = S_OK;
6716
6717 *axis = NULL;
6718 *axis_count = 0;
6719
6720 opentype_get_font_table(stream_desc, MS_FVAR_TAG, &fvar);
6721
6722 if (!(header = table_read_ensure(&fvar, 0, sizeof(*header)))) goto done;
6723 if (!(GET_BE_WORD(header->major_version) == 1 && GET_BE_WORD(header->minor_version) == 0))
6724 {
6725 WARN("Unexpected fvar version.\n");
6726 goto done;
6727 }
6728
6729 count = GET_BE_WORD(header->axis_count);
6730 size = GET_BE_WORD(header->axis_size);
6731
6732 if (!count || size != sizeof(*records)) goto done;
6733 if (!(records = table_read_ensure(&fvar, GET_BE_WORD(header->axes_array_offset), size * count))) goto done;
6734
6735 if (!(*axis = calloc(count + 4, sizeof(**axis))))
6736 {
6737 hr = E_OUTOFMEMORY;
6738 goto done;
6739 }
6740
6741 for (i = 0; i < count; ++i)
6742 {
6743 (*axis)[i].tag = tag = records[i].tag;
6744 (*axis)[i].default_value = GET_BE_FIXED(records[i].default_value);
6745 (*axis)[i].min_value = GET_BE_FIXED(records[i].min_value);
6746 (*axis)[i].max_value = GET_BE_FIXED(records[i].max_value);
6747 if (GET_BE_WORD(records[i].flags & 0x1))
6748 (*axis)[i].attributes |= DWRITE_FONT_AXIS_ATTRIBUTES_HIDDEN;
6749 /* FIXME: set DWRITE_FONT_AXIS_ATTRIBUTES_VARIABLE */
6750
6751 if (tag == DWRITE_FONT_AXIS_TAG_WEIGHT) has_wght = TRUE;
6752 if (tag == DWRITE_FONT_AXIS_TAG_WIDTH) has_wdth = TRUE;
6753 if (tag == DWRITE_FONT_AXIS_TAG_SLANT) has_slnt = TRUE;
6754 if (tag == DWRITE_FONT_AXIS_TAG_ITALIC) has_ital = TRUE;
6755 }
6756
6757 if (!has_wght || !has_wdth || !has_slnt || !has_ital)
6758 {
6759 opentype_get_font_properties(stream_desc, &props);
6762 props.style == DWRITE_FONT_STYLE_ITALIC ? 1.0f : 0.0f);
6764 width_axis_values[props.stretch]);
6765 if (!has_slnt) opentype_font_var_add_static_axis(axis, &count, DWRITE_FONT_AXIS_TAG_SLANT, props.slant_angle);
6766 }
6767
6768 *axis_count = count;
6769
6770done:
6771 if (fvar.context)
6772 IDWriteFontFileStream_ReleaseFileFragment(stream_desc->stream, fvar.context);
6773
6774 return hr;
6775}
static void opentype_font_var_add_static_axis(struct dwrite_var_axis **axis, unsigned int *axis_count, unsigned int tag, float value)
Definition: opentype.c:6684
#define MS_FVAR_TAG
Definition: opentype.c:48
#define GET_BE_FIXED(x)
Definition: opentype.c:69
void opentype_get_font_properties(const struct file_stream_desc *stream_desc, struct dwrite_font_props *props)
Definition: opentype.c:2090
@ DWRITE_FONT_AXIS_TAG_WEIGHT
Definition: dwrite_3.idl:126
@ DWRITE_FONT_AXIS_TAG_WIDTH
Definition: dwrite_3.idl:127
@ DWRITE_FONT_AXIS_TAG_ITALIC
Definition: dwrite_3.idl:130
@ DWRITE_FONT_AXIS_TAG_SLANT
Definition: dwrite_3.idl:128
@ DWRITE_FONT_AXIS_ATTRIBUTES_HIDDEN
Definition: dwrite_3.idl:165
GLbitfield flags
Definition: glext.h:7161
uint32_t tag
Definition: opentype.c:1298

Referenced by create_font_resource().

◆ opentype_get_gasp_flags()

unsigned int opentype_get_gasp_flags ( const struct dwrite_fonttable *  gasp,
float  emsize 
)

Definition at line 2895 of file opentype.c.

2896{
2897 unsigned int version, num_ranges, i;
2898 const struct gasp_header *table;
2899 WORD flags = 0;
2900
2901 if (!gasp->exists)
2902 return 0;
2903
2905
2907 if (!table)
2908 return 0;
2909
2910 version = GET_BE_WORD(table->version);
2911 if (version > 1)
2912 {
2913 ERR("Unsupported gasp table format version %u.\n", version);
2914 goto done;
2915 }
2916
2917 for (i = 0; i < num_ranges; ++i)
2918 {
2919 flags = GET_BE_WORD(table->ranges[i].flags);
2920 if (emsize <= GET_BE_WORD(table->ranges[i].max_ppem)) break;
2921 }
2922
2923done:
2924 return flags;
2925}
#define ERR(fmt,...)
Definition: precomp.h:57
WORD num_ranges
Definition: opentype.c:324
struct gasp_range ranges[1]
Definition: opentype.c:325

Referenced by dwritefontface2_GetRecommendedRenderingMode(), dwritefontface3_GetRecommendedRenderingMode(), and dwritefontface_GetRecommendedRenderingMode().

◆ opentype_get_glyph_image_formats()

UINT32 opentype_get_glyph_image_formats ( IDWriteFontFace5 *  fontface)

Definition at line 3191 of file opentype.c.

3192{
3194
3195 if (opentype_has_font_table(fontface, MS_GLYF_TAG))
3197
3198 if (opentype_has_font_table(fontface, MS_CFF__TAG) ||
3201
3202 if (opentype_has_font_table(fontface, MS_COLR_TAG))
3204
3205 if (opentype_has_font_table(fontface, MS_SVG__TAG))
3207
3208 if (opentype_has_font_table(fontface, MS_SBIX_TAG))
3209 ret |= opentype_get_sbix_formats(fontface);
3210
3211 if (opentype_has_font_table(fontface, MS_CBLC_TAG))
3212 ret |= opentype_get_cblc_formats(fontface);
3213
3214 return ret;
3215}
@ DWRITE_GLYPH_IMAGE_FORMATS_COLR
Definition: dcommon.idl:47
@ DWRITE_GLYPH_IMAGE_FORMATS_NONE
Definition: dcommon.idl:44
@ DWRITE_GLYPH_IMAGE_FORMATS_CFF
Definition: dcommon.idl:46
@ DWRITE_GLYPH_IMAGE_FORMATS_SVG
Definition: dcommon.idl:48
@ DWRITE_GLYPH_IMAGE_FORMATS_TRUETYPE
Definition: dcommon.idl:45
#define MS_CFF__TAG
Definition: opentype.c:37
#define MS_SVG__TAG
Definition: opentype.c:41
#define MS_SBIX_TAG
Definition: opentype.c:42
#define MS_GLYF_TAG
Definition: opentype.c:36
static BOOL opentype_has_font_table(IDWriteFontFace5 *fontface, UINT32 tag)
Definition: opentype.c:3064
static unsigned int opentype_get_sbix_formats(IDWriteFontFace5 *fontface)
Definition: opentype.c:3082
#define MS_CBLC_TAG
Definition: opentype.c:44
#define MS_CFF2_TAG
Definition: opentype.c:38
static unsigned int opentype_get_cblc_formats(IDWriteFontFace5 *fontface)
Definition: opentype.c:3154

Referenced by create_fontface().

◆ opentype_get_kerning_pairs()

HRESULT opentype_get_kerning_pairs ( struct dwrite_fontface *  fontface,
unsigned int  count,
const UINT16 *  glyphs,
INT32 *  values 
)

Definition at line 6624 of file opentype.c.

6626{
6627 const struct kern_subtable_header *subtable;
6628 unsigned int i, s, offset, pair_count, subtable_count;
6630 const struct kern_header *header;
6631 const WORD *data;
6632
6633 if (!opentype_has_kerning_pairs(fontface))
6634 {
6635 memset(values, 0, count * sizeof(*values));
6636 return S_OK;
6637 }
6638
6639 subtable_count = table_read_be_word(&fontface->kern, 2);
6640 subtable_count = min(subtable_count, 32);
6641
6642 for (i = 0; i < count - 1; ++i)
6643 {
6644 offset = sizeof(*header);
6645
6646 key.left = glyphs[i];
6647 key.right = glyphs[i + 1];
6648 values[i] = 0;
6649
6650 for (s = 0; s < subtable_count; ++s)
6651 {
6652 if (!(subtable = table_read_ensure(&fontface->kern, offset, sizeof(*subtable))))
6653 break;
6654
6655 if (subtable->version == 0 && GET_BE_WORD(subtable->coverage) & 1)
6656 {
6657 if ((data = table_read_ensure(&fontface->kern, offset, GET_BE_WORD(subtable->length))))
6658 {
6659 /* Skip subtable header */
6660 data += 3;
6661 pair_count = GET_BE_WORD(*data);
6662 data += 4;
6663 /* Move to pair data */
6664 if ((data = table_read_ensure(&fontface->kern, offset + 7 * sizeof(*data),
6665 pair_count * 3 * sizeof(*data))))
6666 {
6667 if ((data = bsearch(&key, data, pair_count, 3 * sizeof(*data), kern_format0_compare)))
6668 {
6669 values[i] = (short)GET_BE_WORD(data[2]);
6670 break;
6671 }
6672 }
6673 }
6674 }
6675
6676 offset += GET_BE_WORD(subtable->length);
6677 }
6678 }
6679 values[count - 1] = 0;
6680
6681 return S_OK;
6682}
static int __cdecl kern_format0_compare(const void *a, const void *b)
Definition: opentype.c:6612
BOOL opentype_has_kerning_pairs(struct dwrite_fontface *fontface)
Definition: opentype.c:6555
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
GLdouble s
Definition: gl.h:2039
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666

Referenced by dwritefontface1_GetKerningPairAdjustments().

◆ opentype_get_typographic_features()

void opentype_get_typographic_features ( struct ot_gsubgpos_table *  table,
unsigned int  script_index,
unsigned int  language_index,
struct tag_array *  tags 
)

Definition at line 2789 of file opentype.c.

2791{
2792 unsigned int i, total_feature_count, script_feature_count;
2793 const struct ot_feature_list *feature_list;
2794 const struct ot_langsys *langsys = NULL;
2795
2796 langsys = opentype_get_langsys(table, script_index, language_index, &script_feature_count);
2797
2798 total_feature_count = table_read_be_word(&table->table, table->feature_list);
2799 if (!total_feature_count)
2800 return;
2801
2802 feature_list = table_read_ensure(&table->table, table->feature_list,
2803 FIELD_OFFSET(struct ot_feature_list, features[total_feature_count]));
2804 if (!feature_list)
2805 return;
2806
2807 for (i = 0; i < script_feature_count; ++i)
2808 {
2809 unsigned int feature_index = GET_BE_WORD(langsys->feature_index[i]);
2810 if (feature_index >= total_feature_count)
2811 continue;
2812
2813 if (!dwrite_array_reserve((void **)&t->tags, &t->capacity, t->count + 1, sizeof(*t->tags)))
2814 return;
2815
2816 t->tags[t->count++] = feature_list->features[feature_index].tag;
2817 }
2818}
static const struct ot_langsys * opentype_get_langsys(const struct ot_gsubgpos_table *table, unsigned int script_index, unsigned int language_index, unsigned int *feature_count)
Definition: opentype.c:2755
GLdouble GLdouble t
Definition: gl.h:2047
struct ot_feature_record features[1]
Definition: opentype.c:398
uint16_t feature_index[1]
Definition: opentype.c:406

Referenced by shape_get_typographic_features().

◆ opentype_get_vdmx_size()

BOOL opentype_get_vdmx_size ( const struct dwrite_fonttable *  table,
INT  ppem,
UINT16 *  ascent,
UINT16 *  descent 
)

Definition at line 2846 of file opentype.c.

2847{
2848 unsigned int num_ratios, num_recs, group_offset, i;
2849 const struct vdmx_header *header;
2850 const struct vdmx_group *group;
2851
2852 if (!vdmx->exists)
2853 return FALSE;
2854
2855 num_ratios = table_read_be_word(vdmx, FIELD_OFFSET(struct vdmx_header, num_ratios));
2856 num_recs = table_read_be_word(vdmx, FIELD_OFFSET(struct vdmx_header, num_recs));
2857
2858 header = table_read_ensure(vdmx, 0, sizeof(*header) + num_ratios * sizeof(struct vdmx_ratio) +
2859 num_recs * sizeof(*group));
2860
2861 if (!header)
2862 return FALSE;
2863
2864 group_offset = find_vdmx_group(header);
2865 if (!group_offset)
2866 return FALSE;
2867
2868 num_recs = table_read_be_word(vdmx, group_offset);
2869 group = table_read_ensure(vdmx, group_offset, FIELD_OFFSET(struct vdmx_group, entries[num_recs]));
2870
2871 if (!group)
2872 return FALSE;
2873
2874 if (emsize < group->startsz || emsize >= group->endsz)
2875 return FALSE;
2876
2877 for (i = 0; i < num_recs; ++i)
2878 {
2879 WORD ppem = GET_BE_WORD(group->entries[i].yPelHeight);
2880 if (ppem > emsize) {
2881 FIXME("interpolate %d\n", emsize);
2882 return FALSE;
2883 }
2884
2885 if (ppem == emsize) {
2886 *ascent = (SHORT)GET_BE_WORD(group->entries[i].yMax);
2887 *descent = -(SHORT)GET_BE_WORD(group->entries[i].yMin);
2888 return TRUE;
2889 }
2890 }
2891
2892 return FALSE;
2893}
static unsigned int find_vdmx_group(const struct vdmx_header *hdr)
Definition: opentype.c:2820
GLboolean GLuint group
Definition: glext.h:11120
uint8_t startsz
Definition: opentype.c:384
struct vdmx_vtable entries[1]
Definition: opentype.c:386

Referenced by dwritefontface1_GetGdiCompatibleMetrics().

◆ opentype_get_vertical_glyph_variants()

HRESULT opentype_get_vertical_glyph_variants ( struct dwrite_fontface *  fontface,
unsigned int  glyph_count,
const UINT16 *  nominal_glyphs,
UINT16 *  glyphs 
)

Definition at line 6498 of file opentype.c.

6500{
6501 struct shaping_features features = { 0 };
6502 struct shaping_feature vert_feature = { 0 };
6503 struct scriptshaping_context context = { 0 };
6504 struct lookups lookups = { 0 };
6505 unsigned int i;
6506
6507 memcpy(glyphs, nominal_glyphs, glyph_count * sizeof(*glyphs));
6508
6509 if (!opentype_has_vertical_variants(fontface))
6510 return S_OK;
6511
6512 context.cache = fontface_get_shaping_cache(fontface);
6513 context.u.subst.glyphs = glyphs;
6514 context.u.subst.glyph_props = calloc(glyph_count, sizeof(*context.u.subst.glyph_props));
6515 context.u.subst.max_glyph_count = glyph_count;
6516 context.u.subst.capacity = glyph_count;
6517 context.glyph_infos = calloc(glyph_count, sizeof(*context.glyph_infos));
6518 context.table = &context.cache->gsub;
6519
6520 vert_feature.tag = DWRITE_MAKE_OPENTYPE_TAG('v','e','r','t');
6522 vert_feature.max_value = 1;
6523 vert_feature.default_value = 1;
6524
6525 features.features = &vert_feature;
6526 features.count = features.capacity = 1;
6527
6528 opentype_layout_collect_lookups(&context, ~0u, ~0u, &features, context.table, &lookups);
6530
6531 for (i = 0; i < lookups.count; ++i)
6532 {
6533 const struct lookup *lookup = &lookups.lookups[i];
6534
6535 context.cur = 0;
6536 while (context.cur < context.glyph_count)
6537 {
6538 BOOL ret = FALSE;
6539
6542
6543 if (!ret)
6544 context.cur++;
6545 }
6546 }
6547
6548 free(context.u.subst.glyph_props);
6549 free(context.glyph_infos);
6551
6552 return S_OK;
6553}
static void opentype_layout_collect_lookups(struct scriptshaping_context *context, unsigned int script_index, unsigned int language_index, struct shaping_features *features, const struct ot_gsubgpos_table *table, struct lookups *lookups)
Definition: opentype.c:4631
static BOOL opentype_layout_apply_gsub_lookup(struct scriptshaping_context *context, const struct lookup *lookup)
Definition: opentype.c:5891
static void opentype_layout_set_glyph_masks(struct scriptshaping_context *context, const struct shaping_features *features)
Definition: opentype.c:4838
BOOL opentype_has_vertical_variants(struct dwrite_fontface *fontface)
Definition: opentype.c:6436
static BOOL lookup_is_glyph_match(const struct scriptshaping_context *context, unsigned int idx, unsigned int match_props)
Definition: opentype.c:3794
struct scriptshaping_cache * fontface_get_shaping_cache(struct dwrite_fontface *fontface)
Definition: font.c:559
Definition: http.c:7252
unsigned int flags
Definition: opentype.c:3631
size_t count
Definition: opentype.c:4539
struct lookup * lookups
Definition: opentype.c:4537
unsigned int default_value
unsigned int tag
unsigned int flags
unsigned int max_value
struct shaping_feature * features

Referenced by dwritefontface1_GetVerticalGlyphVariants().

◆ opentype_has_kerning_pairs()

BOOL opentype_has_kerning_pairs ( struct dwrite_fontface *  fontface)

Definition at line 6555 of file opentype.c.

6556{
6557 const struct kern_subtable_header *subtable;
6558 struct file_stream_desc stream_desc;
6559 const struct kern_header *header;
6560 unsigned int offset, count, i;
6561
6563 return !!(fontface->flags & FONTFACE_KERNING_PAIRS);
6564
6565 fontface->flags |= FONTFACE_NO_KERNING_PAIRS;
6566
6567 stream_desc.stream = fontface->stream;
6568 stream_desc.face_type = fontface->type;
6569 stream_desc.face_index = fontface->index;
6570
6571 opentype_get_font_table(&stream_desc, MS_KERN_TAG, &fontface->kern);
6572 if (fontface->kern.exists)
6573 {
6574 if ((header = table_read_ensure(&fontface->kern, 0, sizeof(*header))))
6575 {
6576 count = GET_BE_WORD(header->table_count);
6577 offset = sizeof(*header);
6578
6579 /* FreeType limits table count this way. */
6580 count = min(count, 32);
6581
6582 /* Check for presence of format 0 subtable with horizontal coverage. */
6583 for (i = 0; i < count; ++i)
6584 {
6585 if (!(subtable = table_read_ensure(&fontface->kern, offset, sizeof(*subtable))))
6586 break;
6587
6588 if (subtable->version == 0 && GET_BE_WORD(subtable->coverage) & 1)
6589 {
6590 fontface->flags &= ~FONTFACE_NO_KERNING_PAIRS;
6591 fontface->flags |= FONTFACE_KERNING_PAIRS;
6592 break;
6593 }
6594
6595 offset += GET_BE_WORD(subtable->length);
6596 }
6597 }
6598 }
6599
6600 if (fontface->flags & FONTFACE_NO_KERNING_PAIRS && fontface->kern.data)
6601 IDWriteFontFileStream_ReleaseFileFragment(stream_desc.stream, fontface->kern.context);
6602
6603 return !!(fontface->flags & FONTFACE_KERNING_PAIRS);
6604}
#define MS_KERN_TAG
Definition: opentype.c:47

Referenced by dwritefontface1_HasKerningPairs(), and opentype_get_kerning_pairs().

◆ opentype_has_vertical_variants()

BOOL opentype_has_vertical_variants ( struct dwrite_fontface *  fontface)

Definition at line 6436 of file opentype.c.

6437{
6438 unsigned int i, j, count = 0, lookup_type, subtable_offset;
6439 struct shaping_features features = { 0 };
6440 struct shaping_feature vert_feature = { 0 };
6441 struct scriptshaping_context context = { 0 };
6442 struct lookups lookups = { 0 };
6443 UINT16 format;
6444
6446 return !!(fontface->flags & FONTFACE_VERTICAL_VARIANTS);
6447
6448 context.cache = fontface_get_shaping_cache(fontface);
6449 context.table = &context.cache->gsub;
6450
6451 vert_feature.tag = DWRITE_MAKE_OPENTYPE_TAG('v','e','r','t');
6453 vert_feature.max_value = 1;
6454 vert_feature.default_value = 1;
6455
6456 features.features = &vert_feature;
6457 features.count = features.capacity = 1;
6458
6459 opentype_layout_collect_lookups(&context, ~0u, ~0u, &features, context.table, &lookups);
6460
6461 for (i = 0; i < lookups.count && !count; ++i)
6462 {
6463 const struct dwrite_fonttable *table = &context.table->table;
6464 const struct lookup *lookup = &lookups.lookups[i];
6465
6466 for (j = 0; j < lookup->subtable_count && !count; ++j)
6467 {
6468 subtable_offset = opentype_layout_get_gsubgpos_subtable(&context, lookup, j, &lookup_type);
6469
6470 if (lookup_type != GSUB_LOOKUP_SINGLE_SUBST)
6471 continue;
6472
6473 format = table_read_be_word(table, subtable_offset);
6474
6475 if (format == 1)
6476 {
6477 count = 1;
6478 }
6479 else if (format == 2)
6480 {
6482 }
6483 else
6484 WARN("Unrecognized single substitution format %u.\n", format);
6485 }
6486 }
6487
6489
6490 if (count)
6491 fontface->flags |= FONTFACE_VERTICAL_VARIANTS;
6492 else
6494
6495 return !!(fontface->flags & FONTFACE_VERTICAL_VARIANTS);
6496}
@ GSUB_LOOKUP_SINGLE_SUBST
Definition: opentype.c:543
static unsigned int opentype_layout_get_gsubgpos_subtable(const struct scriptshaping_context *context, const struct lookup *lookup, unsigned int subtable, unsigned int *lookup_type)
Definition: opentype.c:3647
unsigned short subtable_count
Definition: opentype.c:3628

Referenced by dwritefontface1_HasVerticalGlyphVariants(), and opentype_get_vertical_glyph_variants().

◆ opentype_layout_apply_gpos_features()

void opentype_layout_apply_gpos_features ( struct scriptshaping_context *  context,
unsigned int  script_index,
unsigned int  language_index,
struct shaping_features *  features 
)

Definition at line 4932 of file opentype.c.

4934{
4935 struct lookups lookups = { 0 };
4936 unsigned int i;
4937 BOOL ret;
4938
4939 context->nesting_level_left = SHAPE_MAX_NESTING_LEVEL;
4940 context->u.buffer.apply_context_lookup = opentype_layout_apply_gpos_context_lookup;
4941 opentype_layout_collect_lookups(context, script_index, language_index, features, &context->cache->gpos, &lookups);
4942
4943 for (i = 0; i < context->glyph_count; ++i)
4946
4947 for (i = 0; i < lookups.count; ++i)
4948 {
4949 const struct lookup *lookup = &lookups.lookups[i];
4950
4951 context->cur = 0;
4952 context->lookup_mask = lookup->mask;
4953 context->auto_zwnj = lookup->auto_zwnj;
4954 context->auto_zwj = lookup->auto_zwj;
4955
4956 while (context->cur < context->glyph_count)
4957 {
4958 ret = FALSE;
4959
4960 if ((context->glyph_infos[context->cur].mask & lookup->mask) &&
4962 {
4964 }
4965
4966 if (!ret)
4967 context->cur++;
4968 }
4969 }
4970
4972
4973 if (context->has_gpos_attachment)
4974 {
4975 for (i = 0; i < context->glyph_count; ++i)
4977 }
4978}
static unsigned int opentype_set_glyph_props(struct scriptshaping_context *context, unsigned int idx)
Definition: opentype.c:3402
static void opentype_propagate_attachment_offsets(struct scriptshaping_context *context, unsigned int i)
Definition: opentype.c:4887
static BOOL opentype_layout_apply_gpos_lookup(struct scriptshaping_context *context, const struct lookup *lookup)
Definition: opentype.c:4486
static void opentype_layout_apply_gpos_context_lookup(struct scriptshaping_context *context, unsigned int lookup_index)
Definition: opentype.c:4880
#define SHAPE_MAX_NESTING_LEVEL
Definition: opentype.c:73
unsigned int auto_zwj
Definition: opentype.c:3634
unsigned int auto_zwnj
Definition: opentype.c:3633
unsigned int mask
Definition: opentype.c:3630

Referenced by shape_get_positions().

◆ opentype_layout_apply_gsub_features()

void opentype_layout_apply_gsub_features ( struct scriptshaping_context *  context,
unsigned int  script_index,
unsigned int  language_index,
struct shaping_features *  features 
)

Definition at line 6116 of file opentype.c.

6118{
6119 struct lookups lookups = { 0 };
6120 unsigned int i = 0, j, start_idx;
6121 BOOL ret;
6122
6123 context->nesting_level_left = SHAPE_MAX_NESTING_LEVEL;
6124 context->u.buffer.apply_context_lookup = opentype_layout_apply_gsub_context_lookup;
6125 opentype_layout_collect_lookups(context, script_index, language_index, features, context->table, &lookups);
6126
6129
6130 for (j = 0; j <= features->stage; ++j)
6131 {
6132 for (; i < features->stages[j].last_lookup; ++i)
6133 {
6134 const struct lookup *lookup = &lookups.lookups[i];
6135
6136 context->lookup_mask = lookup->mask;
6137 context->auto_zwnj = lookup->auto_zwnj;
6138 context->auto_zwj = lookup->auto_zwj;
6139
6141 {
6142 context->cur = 0;
6143 while (context->cur < context->glyph_count)
6144 {
6145 ret = FALSE;
6146
6147 if ((context->glyph_infos[context->cur].mask & lookup->mask) &&
6149 {
6151 }
6152
6153 if (!ret)
6154 context->cur++;
6155 }
6156 }
6157 else
6158 {
6159 context->cur = context->glyph_count - 1;
6160
6161 for (;;)
6162 {
6163 if ((context->glyph_infos[context->cur].mask & lookup->mask) &&
6165 {
6167 }
6168
6169 if (context->cur == 0) break;
6170 --context->cur;
6171 }
6172 }
6173 }
6174
6175 if (features->stages[j].func)
6176 features->stages[j].func(context, features);
6177 }
6178
6179 /* For every glyph range of [<last>.isClusterStart, <next>.isClusterStart) set corresponding
6180 text span to start_idx. */
6181 start_idx = 0;
6182 for (i = 1; i < context->glyph_count; ++i)
6183 {
6184 if (context->u.buffer.glyph_props[i].isClusterStart)
6185 {
6186 unsigned int start_text, end_text;
6187
6188 start_text = context->glyph_infos[start_idx].start_text_idx;
6189 end_text = context->glyph_infos[i].start_text_idx;
6190
6191 for (j = start_text; j < end_text; ++j)
6192 context->u.buffer.clustermap[j] = start_idx;
6193
6194 start_idx = i;
6195 }
6196 }
6197
6198 /* Fill the tail. */
6199 for (j = context->glyph_infos[start_idx].start_text_idx; j < context->length; ++j)
6200 context->u.buffer.clustermap[j] = start_idx;
6201
6203}
static BOOL opentype_is_gsub_lookup_reversed(const struct scriptshaping_context *context, const struct lookup *lookup)
Definition: opentype.c:6101
static void opentype_get_nominal_glyphs(struct scriptshaping_context *context, const struct shaping_features *features)
Definition: opentype.c:6017
static void opentype_layout_apply_gsub_context_lookup(struct scriptshaping_context *context, unsigned int lookup_index)
Definition: opentype.c:6109
struct shaping_stage stages[MAX_SHAPING_STAGE]
unsigned int stage

Referenced by shape_get_glyphs().

◆ opentype_layout_check_feature()

BOOL opentype_layout_check_feature ( struct scriptshaping_context *  context,
unsigned int  script_index,
unsigned int  language_index,
struct shaping_feature *  feature,
unsigned int  glyph_count,
const UINT16 *  glyphs,
UINT8 *  feature_applies 
)

Definition at line 6391 of file opentype.c.

6394{
6395 p_lookup_is_glyph_covered_func func_is_covered;
6396 struct shaping_features features = { 0 };
6397 struct lookups lookups = { 0 };
6398 BOOL ret = FALSE, is_covered;
6399 unsigned int i, j, applies;
6400
6401 features.features = feature;
6402 features.count = 1;
6403
6404 for (i = 0; i < context->glyph_count; ++i)
6406
6407 opentype_layout_collect_lookups(context, script_index, language_index, &features, context->table, &lookups);
6408
6411
6412 for (i = 0; i < lookups.count; ++i)
6413 {
6414 struct lookup *lookup = &lookups.lookups[i];
6415
6416 applies = 0;
6417 for (j = 0; j < context->glyph_count; ++j)
6418 {
6420 {
6421 if ((is_covered = func_is_covered(context, glyphs[i], lookup)))
6422 ++applies;
6423 feature_applies[j] |= is_covered;
6424 }
6425 }
6426
6427 if ((ret = (applies == context->glyph_count)))
6428 break;
6429 }
6430
6432
6433 return ret;
6434}
BOOL(* p_lookup_is_glyph_covered_func)(struct scriptshaping_context *context, UINT16 glyph, const struct lookup *lookup)
Definition: opentype.c:6389
static BOOL opentype_layout_gpos_lookup_is_glyph_covered(struct scriptshaping_context *context, UINT16 glyph, const struct lookup *lookup)
Definition: opentype.c:6323
static unsigned int opentype_layout_is_subst_context(const struct scriptshaping_context *context)
Definition: opentype.c:3637
static BOOL opentype_layout_gsub_lookup_is_glyph_covered(struct scriptshaping_context *context, UINT16 glyph, const struct lookup *lookup)
Definition: opentype.c:6259
INTERNETFEATURELIST feature
Definition: misc.c:1807

Referenced by shape_check_typographic_feature().

◆ opentype_layout_find_language()

unsigned int opentype_layout_find_language ( const struct scriptshaping_cache *  cache,
unsigned int  kind,
DWORD  tag,
unsigned int  script_index,
unsigned int *  language_index 
)

Definition at line 3309 of file opentype.c.

3311{
3312 const struct ot_gsubgpos_table *table = kind == MS_GSUB_TAG ? &cache->gsub : &cache->gpos;
3313 UINT16 table_offset, lang_count;
3314 unsigned int i;
3315
3316 *language_index = ~0u;
3317
3318 table_offset = table_read_be_word(&table->table, table->script_list + FIELD_OFFSET(struct ot_script_list, scripts) +
3319 script_index * sizeof(struct ot_script_record) + FIELD_OFFSET(struct ot_script_record, script));
3320 if (!table_offset)
3321 return 0;
3322
3323 lang_count = table_read_be_word(&table->table, table->script_list + table_offset +
3324 FIELD_OFFSET(struct ot_script, langsys_count));
3325 for (i = 0; i < lang_count; i++)
3326 {
3327 unsigned int tag = table_read_dword(&table->table, table->script_list + table_offset +
3328 FIELD_OFFSET(struct ot_script, langsys) + i * sizeof(struct ot_langsys_record));
3329
3330 if (tag == language)
3331 {
3332 *language_index = i;
3333 return language;
3334 }
3335 }
3336
3337 /* Try 'defaultLangSys' if it's set. */
3338 if (table_read_be_word(&table->table, table->script_list + table_offset))
3339 return ~0u;
3340
3341 return 0;
3342}
#define MS_GSUB_TAG

Referenced by shape_select_language().

◆ opentype_layout_find_script()

unsigned int opentype_layout_find_script ( const struct scriptshaping_cache *  cache,
unsigned int  kind,
DWORD  tag,
unsigned int *  script_index 
)

Definition at line 3279 of file opentype.c.

3281{
3282 const struct ot_gsubgpos_table *table = kind == MS_GSUB_TAG ? &cache->gsub : &cache->gpos;
3283 UINT16 script_count;
3284 unsigned int i;
3285
3286 *script_index = ~0u;
3287
3288 script_count = table_read_be_word(&table->table, table->script_list);
3289 if (!script_count)
3290 return 0;
3291
3292 for (i = 0; i < script_count; i++)
3293 {
3294 unsigned int tag = table_read_dword(&table->table, table->script_list + FIELD_OFFSET(struct ot_script_list, scripts) +
3295 i * sizeof(struct ot_script_record));
3296 if (!tag)
3297 continue;
3298
3299 if (tag == script)
3300 {
3301 *script_index = i;
3302 return script;
3303 }
3304 }
3305
3306 return 0;
3307}

Referenced by shape_select_script().

◆ opentype_layout_scriptshaping_cache_init()

void opentype_layout_scriptshaping_cache_init ( struct scriptshaping_cache *  cache)

Definition at line 3238 of file opentype.c.

3239{
3240 cache->font->grab_font_table(cache->context, MS_GSUB_TAG, &cache->gsub.table.data, &cache->gsub.table.size,
3241 &cache->gsub.table.context);
3242
3243 if (cache->gsub.table.data)
3244 {
3245 cache->gsub.script_list = table_read_be_word(&cache->gsub.table, FIELD_OFFSET(struct gpos_gsub_header, script_list));
3246 cache->gsub.feature_list = table_read_be_word(&cache->gsub.table, FIELD_OFFSET(struct gpos_gsub_header, feature_list));
3247 cache->gsub.lookup_list = table_read_be_word(&cache->gsub.table, FIELD_OFFSET(struct gpos_gsub_header, lookup_list));
3248 }
3249
3250 cache->font->grab_font_table(cache->context, MS_GPOS_TAG, &cache->gpos.table.data, &cache->gpos.table.size,
3251 &cache->gpos.table.context);
3252
3253 if (cache->gpos.table.data)
3254 {
3255 cache->gpos.script_list = table_read_be_word(&cache->gpos.table,
3256 FIELD_OFFSET(struct gpos_gsub_header, script_list));
3257 cache->gpos.feature_list = table_read_be_word(&cache->gpos.table,
3258 FIELD_OFFSET(struct gpos_gsub_header, feature_list));
3259 cache->gpos.lookup_list = table_read_be_word(&cache->gpos.table,
3260 FIELD_OFFSET(struct gpos_gsub_header, lookup_list));
3261 }
3262
3263 cache->font->grab_font_table(cache->context, MS_GDEF_TAG, &cache->gdef.table.data, &cache->gdef.table.size,
3264 &cache->gdef.table.context);
3265
3266 if (cache->gdef.table.data)
3267 {
3268 unsigned int version = table_read_be_dword(&cache->gdef.table, 0);
3269
3270 cache->gdef.classdef = table_read_be_word(&cache->gdef.table, FIELD_OFFSET(struct gdef_header, classdef));
3271 cache->gdef.markattachclassdef = table_read_be_word(&cache->gdef.table,
3272 FIELD_OFFSET(struct gdef_header, markattach_classdef));
3273 if (version >= 0x00010002)
3274 cache->gdef.markglyphsetdef = table_read_be_word(&cache->gdef.table,
3275 FIELD_OFFSET(struct gdef_header, markglyphsetdef));
3276 }
3277}
#define MS_GDEF_TAG
Definition: opentype.c:34
#define MS_GPOS_TAG

Referenced by create_scriptshaping_cache().

◆ opentype_layout_unsafe_to_break()

void opentype_layout_unsafe_to_break ( struct scriptshaping_context *  context,
unsigned int  start,
unsigned int  end 
)

Definition at line 5233 of file opentype.c.

5235{
5236 unsigned int i;
5237
5238 while (start && !context->u.buffer.glyph_props[start].isClusterStart)
5239 --start;
5240
5241 while (--end && !context->u.buffer.glyph_props[end].isClusterStart)
5242 ;
5243
5244 if (start == end)
5245 {
5246 context->u.buffer.text_props[context->glyph_infos[start].start_text_idx].canBreakShapingAfter = 0;
5247 return;
5248 }
5249
5250 for (i = context->glyph_infos[start].start_text_idx; i < context->glyph_infos[end].start_text_idx; ++i)
5251 {
5252 context->u.buffer.text_props[i].canBreakShapingAfter = 0;
5253 }
5254}
GLuint start
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545

Referenced by arabic_setup_masks(), and opentype_layout_apply_ligature().

◆ opentype_try_get_font_table()

HRESULT opentype_try_get_font_table ( const struct file_stream_desc *  stream_desc,
UINT32  tag,
const void **  data,
void **  context,
UINT32 *  size,
BOOL *  exists 
)

Definition at line 1528 of file opentype.c.

1530{
1531 void *table_directory_context, *sfnt_context;
1532 const struct ot_table_record *table_record = NULL;
1533 const struct ot_table_dir *table_dir = NULL;
1534 UINT32 table_offset = 0;
1535 UINT16 table_count;
1536 HRESULT hr;
1537
1538 if (found) *found = FALSE;
1539 if (table_size) *table_size = 0;
1540
1541 *table_data = NULL;
1542 *table_context = NULL;
1543
1545 {
1546 const struct ttc_header *ttc_header;
1547 void * ttc_context;
1548
1549 hr = IDWriteFontFileStream_ReadFileFragment(stream_desc->stream, (const void **)&ttc_header, 0,
1550 sizeof(*ttc_header), &ttc_context);
1551 if (SUCCEEDED(hr))
1552 {
1553 if (stream_desc->face_index >= GET_BE_DWORD(ttc_header->num_fonts))
1554 hr = E_INVALIDARG;
1555 else
1556 {
1557 table_offset = GET_BE_DWORD(ttc_header->offsets[stream_desc->face_index]);
1558 hr = IDWriteFontFileStream_ReadFileFragment(stream_desc->stream, (const void **)&table_dir, table_offset,
1559 sizeof(*table_dir), &sfnt_context);
1560 }
1561 IDWriteFontFileStream_ReleaseFileFragment(stream_desc->stream, ttc_context);
1562 }
1563 }
1564 else
1565 hr = IDWriteFontFileStream_ReadFileFragment(stream_desc->stream, (const void **)&table_dir, 0,
1566 sizeof(*table_dir), &sfnt_context);
1567
1568 if (FAILED(hr))
1569 return hr;
1570
1571 table_count = GET_BE_WORD(table_dir->numTables);
1572 table_offset += sizeof(*table_dir);
1573
1574 IDWriteFontFileStream_ReleaseFileFragment(stream_desc->stream, sfnt_context);
1575
1576 hr = IDWriteFontFileStream_ReadFileFragment(stream_desc->stream, (const void **)&table_record, table_offset,
1577 table_count * sizeof(*table_record), &table_directory_context);
1578 if (hr == S_OK)
1579 {
1580 UINT16 i;
1581
1582 for (i = 0; i < table_count; ++i)
1583 {
1584 if (table_record->tag == tag)
1585 {
1586 UINT32 offset = GET_BE_DWORD(table_record->offset);
1587 UINT32 length = GET_BE_DWORD(table_record->length);
1588
1589 if (found)
1590 *found = TRUE;
1591 if (table_size)
1592 *table_size = length;
1593 hr = IDWriteFontFileStream_ReadFileFragment(stream_desc->stream, table_data, offset,
1594 length, table_context);
1595 break;
1596 }
1597 table_record++;
1598 }
1599
1600 IDWriteFontFileStream_ReleaseFileFragment(stream_desc->stream, table_directory_context);
1601 }
1602
1603 return hr;
1604}
LOCAL int table_size
Definition: write.c:65
uint16_t numTables
Definition: opentype.c:87
uint32_t tag
Definition: opentype.c:95
uint32_t length
Definition: opentype.c:98
uint32_t offset
Definition: opentype.c:97
uint32_t offsets[1]
Definition: opentype.c:81
uint32_t num_fonts
Definition: opentype.c:80

Referenced by dwritefontface_TryGetFontTable(), and opentype_get_font_table().

◆ release_format_data()

void release_format_data ( struct dwrite_textformat_data *  data)

Definition at line 40 of file format.c.

41{
42 if (data->collection)
43 IDWriteFontCollection_Release(data->collection);
44 if (data->fallback)
45 IDWriteFontFallback_Release(data->fallback);
46 if (data->trimmingsign)
47 IDWriteInlineObject_Release(data->trimmingsign);
48 free(data->family_name);
49 free(data->locale);
50 free(data->axis_values);
51}

Referenced by dwritetextformat_Release(), and dwritetextlayout_Release().

◆ release_scriptshaping_cache()

void release_scriptshaping_cache ( struct scriptshaping_cache *  cache)

Definition at line 59 of file shape.c.

60{
61 if (!cache)
62 return;
63
64 cache->font->release_font_table(cache->context, cache->gdef.table.context);
65 cache->font->release_font_table(cache->context, cache->gsub.table.context);
66 cache->font->release_font_table(cache->context, cache->gpos.table.context);
67 free(cache);
68}

Referenced by dwritefontface_Release().

◆ release_system_fallback_data()

void release_system_fallback_data ( void  )

Definition at line 3024 of file analyzer.c.

3025{
3027}
static void release_fallback_data(struct fallback_data *data)
Definition: analyzer.c:571
static struct fallback_data system_fallback
Definition: analyzer.c:554

Referenced by DllMain().

◆ release_system_fontfallback()

void release_system_fontfallback ( IDWriteFontFallback1 *  fallback)

Definition at line 2575 of file analyzer.c.

2576{
2577 struct dwrite_fontfallback *fallback = impl_from_IDWriteFontFallback1(iface);
2578 IDWriteFontCollection_Release(fallback->systemcollection);
2579 free(fallback);
2580}
static struct dwrite_fontfallback * impl_from_IDWriteFontFallback1(IDWriteFontFallback1 *iface)
Definition: analyzer.c:639

Referenced by release_dwritefactory().

◆ set_en_localizedstring()

void set_en_localizedstring ( IDWriteLocalizedStrings *  iface,
const WCHAR *  string 
)

Definition at line 533 of file main.c.

534{
536 UINT32 i;
537
538 for (i = 0; i < strings->count; i++)
539 {
540 if (!wcsicmp(strings->data[i].locale, L"en-US"))
541 {
542 free(strings->data[i].string);
543 strings->data[i].string = wcsdup(string);
544 break;
545 }
546 }
547}

Referenced by init_font_data().

◆ shape_add_feature_full()

void shape_add_feature_full ( struct shaping_features *  features,
unsigned int  tag,
unsigned int  flags,
unsigned int  value 
)

Definition at line 117 of file shape.c.

118{
119 unsigned int i = features->count;
120
121 if (!dwrite_array_reserve((void **)&features->features, &features->capacity, features->count + 1,
122 sizeof(*features->features)))
123 return;
124
125 features->features[i].tag = tag;
126 features->features[i].flags = flags;
127 features->features[i].max_value = value;
128 features->features[i].default_value = flags & FEATURE_GLOBAL ? value : 0;
129 features->features[i].stage = features->stage;
130 features->count++;
131}

Referenced by arabic_collect_features(), shape_add_feature(), shape_enable_feature(), shape_get_glyphs(), shape_get_positions(), and shape_merge_features().

◆ shape_check_typographic_feature()

HRESULT shape_check_typographic_feature ( struct scriptshaping_context *  context,
const unsigned int *  scripts,
unsigned int  tag,
unsigned int  glyph_count,
const UINT16 *  glyphs,
UINT8 *  feature_applies 
)

Definition at line 415 of file shape.c.

417{
418 static const unsigned int tables[] = { MS_GSUB_TAG, MS_GPOS_TAG };
419 struct shaping_feature feature = { .tag = tag };
420 unsigned int script_index, language_index;
421 unsigned int i;
422
423 memset(feature_applies, 0, glyph_count * sizeof(*feature_applies));
424
425 for (i = 0; i < ARRAY_SIZE(tables); ++i)
426 {
427 shape_get_script_lang_index(context, scripts, tables[i], &script_index, &language_index);
428 context->table = tables[i] == MS_GSUB_TAG ? &context->cache->gsub : &context->cache->gpos;
429 /* Skip second table if feature applies to all. */
430 if (opentype_layout_check_feature(context, script_index, language_index, &feature, glyph_count,
431 glyphs, feature_applies))
432 {
433 break;
434 }
435 }
436
437 return S_OK;
438}
static unsigned int shape_get_script_lang_index(struct scriptshaping_context *context, const unsigned int *scripts, unsigned int table, unsigned int *script_index, unsigned int *language_index)
Definition: shape.c:291
BOOL opentype_layout_check_feature(struct scriptshaping_context *context, unsigned int script_index, unsigned int language_index, struct shaping_feature *feature, unsigned int glyph_count, const UINT16 *glyphs, UINT8 *feature_applies)
Definition: opentype.c:6391

Referenced by dwritetextanalyzer2_CheckTypographicFeature().

◆ shape_enable_feature()

void shape_enable_feature ( struct shaping_features *  features,
unsigned int  tag,
unsigned int  flags 
)

Definition at line 138 of file shape.c.

140{
142}
void shape_add_feature_full(struct shaping_features *features, unsigned int tag, unsigned int flags, unsigned int value)
Definition: shape.c:117

Referenced by arabic_collect_features(), and shape_get_glyphs().

◆ shape_get_feature_1_mask()

unsigned int shape_get_feature_1_mask ( const struct shaping_features *  features,
unsigned int  tag 
)

Definition at line 4822 of file opentype.c.

4823{
4824 unsigned int shift, mask = shaping_features_get_mask(features, tag, &shift);
4825 return (1 << shift) & mask;
4826}
static unsigned int shaping_features_get_mask(const struct shaping_features *features, unsigned int tag, unsigned int *shift)
Definition: opentype.c:4809
GLenum GLint GLuint mask
Definition: glext.h:6028
#define shift
Definition: input.c:3280

Referenced by arabic_setup_masks().

◆ shape_get_glyphs()

HRESULT shape_get_glyphs ( struct scriptshaping_context *  context,
const unsigned int *  scripts 
)

Definition at line 308 of file shape.c.

309{
310 static const unsigned int common_features[] =
311 {
312 DWRITE_MAKE_OPENTYPE_TAG('c','c','m','p'),
313 DWRITE_MAKE_OPENTYPE_TAG('l','o','c','l'),
314 DWRITE_MAKE_OPENTYPE_TAG('r','l','i','g'),
315 };
316 static const unsigned int horizontal_features[] =
317 {
318 DWRITE_MAKE_OPENTYPE_TAG('c','a','l','t'),
319 DWRITE_MAKE_OPENTYPE_TAG('c','l','i','g'),
320 DWRITE_MAKE_OPENTYPE_TAG('l','i','g','a'),
321 DWRITE_MAKE_OPENTYPE_TAG('r','c','l','t'),
322 };
323 unsigned int script_index, language_index;
324 struct shaping_features features = { 0 };
325 unsigned int i;
326
328
329 if (!context->is_sideways)
330 {
331 if (context->is_rtl)
332 {
333 shape_enable_feature(&features, DWRITE_MAKE_OPENTYPE_TAG('r','t','l','a'), 0);
334 shape_add_feature_full(&features, DWRITE_MAKE_OPENTYPE_TAG('r','t','l','m'), 0, 1);
335 }
336 else
337 {
338 shape_enable_feature(&features, DWRITE_MAKE_OPENTYPE_TAG('l','t','r','a'), 0);
339 shape_enable_feature(&features, DWRITE_MAKE_OPENTYPE_TAG('l','t','r','m'), 0);
340 }
341 }
342
343 if (context->shaper->collect_features)
344 context->shaper->collect_features(context, &features);
345
346 for (i = 0; i < ARRAY_SIZE(common_features); ++i)
347 shape_add_feature(&features, common_features[i]);
348
349 /* Horizontal features */
350 if (!context->is_sideways)
351 {
352 for (i = 0; i < ARRAY_SIZE(horizontal_features); ++i)
353 shape_add_feature(&features, horizontal_features[i]);
354 }
355 else
356 shape_enable_feature(&features, DWRITE_MAKE_OPENTYPE_TAG('v','e','r','t'), FEATURE_GLOBAL_SEARCH);
357
359
360 /* Resolve script tag to actually supported script. */
361 shape_get_script_lang_index(context, scripts, MS_GSUB_TAG, &script_index, &language_index);
362 opentype_layout_apply_gsub_features(context, script_index, language_index, &features);
363
364 free(features.features);
365
366 return (context->glyph_count <= context->u.subst.max_glyph_count) ? S_OK : E_NOT_SUFFICIENT_BUFFER;
367}
static void shape_set_shaper(struct scriptshaping_context *context)
Definition: shape.c:220
void shape_enable_feature(struct shaping_features *features, unsigned int tag, unsigned int flags)
Definition: shape.c:138
static void shape_merge_features(struct scriptshaping_context *context, struct shaping_features *features)
Definition: shape.c:156
static void shape_add_feature(struct shaping_features *features, unsigned int tag)
Definition: shape.c:133
void opentype_layout_apply_gsub_features(struct scriptshaping_context *context, unsigned int script_index, unsigned int language_index, struct shaping_features *features)
Definition: opentype.c:6116

Referenced by dwritetextanalyzer_GetGlyphs().

◆ shape_get_positions()

HRESULT shape_get_positions ( struct scriptshaping_context *  context,
const unsigned int *  scripts 
)

Definition at line 233 of file shape.c.

234{
235 static const struct shaping_feature common_features[] =
236 {
237 { DWRITE_MAKE_OPENTYPE_TAG('a','b','v','m') },
238 { DWRITE_MAKE_OPENTYPE_TAG('b','l','w','m') },
239 { DWRITE_MAKE_OPENTYPE_TAG('m','a','r','k'), FEATURE_MANUAL_JOINERS },
240 { DWRITE_MAKE_OPENTYPE_TAG('m','k','m','k'), FEATURE_MANUAL_JOINERS },
241 };
242 static const unsigned int horizontal_features[] =
243 {
244 DWRITE_MAKE_OPENTYPE_TAG('c','u','r','s'),
245 DWRITE_MAKE_OPENTYPE_TAG('d','i','s','t'),
246 DWRITE_MAKE_OPENTYPE_TAG('k','e','r','n'),
247 };
248 struct scriptshaping_cache *cache = context->cache;
249 unsigned int script_index, language_index, script, i;
250 struct shaping_features features = { 0 };
251
253
254 for (i = 0; i < ARRAY_SIZE(common_features); ++i)
255 shape_add_feature_full(&features, common_features[i].tag, FEATURE_GLOBAL | common_features[i].flags, 1);
256
257 /* Horizontal features */
258 if (!context->is_sideways)
259 {
260 for (i = 0; i < ARRAY_SIZE(horizontal_features); ++i)
261 shape_add_feature(&features, horizontal_features[i]);
262 }
263
265
266 /* Resolve script tag to actually supported script. */
267 if (cache->gpos.table.data)
268 {
269 if ((script = shape_select_script(cache, MS_GPOS_TAG, scripts, &script_index)))
270 {
271 DWORD language = context->language_tag;
272
273 if ((language = shape_select_language(cache, MS_GPOS_TAG, script_index, language, &language_index)))
274 {
275 TRACE("script %s, language %s.\n", debugstr_fourcc(script), language != ~0u ?
276 debugstr_fourcc(language) : "deflangsys");
277 opentype_layout_apply_gpos_features(context, script_index, language_index, &features);
278 }
279 }
280 }
281
282 for (i = 0; i < context->glyph_count; ++i)
283 if (context->u.pos.glyph_props[i].isZeroWidthSpace)
284 context->advances[i] = 0.0f;
285
286 free(features.features);
287
288 return S_OK;
289}
static DWORD shape_select_language(const struct scriptshaping_cache *cache, DWORD kind, unsigned int script_index, DWORD language, unsigned int *language_index)
Definition: shape.c:103
static unsigned int shape_select_script(const struct scriptshaping_cache *cache, DWORD kind, const unsigned int *scripts, unsigned int *script_index)
Definition: shape.c:70
void opentype_layout_apply_gpos_features(struct scriptshaping_context *context, unsigned int script_index, unsigned int language_index, struct shaping_features *features)
Definition: opentype.c:4932

Referenced by dwritetextanalyzer_GetGdiCompatibleGlyphPlacements(), and dwritetextanalyzer_GetGlyphPlacements().

◆ shape_get_typographic_features()

HRESULT shape_get_typographic_features ( struct scriptshaping_context *  context,
const unsigned int *  scripts,
unsigned int  max_tagcount,
unsigned int *  actual_tagcount,
DWRITE_FONT_FEATURE_TAG *  tags 
)

Definition at line 375 of file shape.c.

377{
378 unsigned int i, j, script_index, language_index;
379 struct tag_array t = { 0 };
380
381 /* Collect from both tables, sort and remove duplicates. */
382
383 shape_get_script_lang_index(context, scripts, MS_GSUB_TAG, &script_index, &language_index);
384 opentype_get_typographic_features(&context->cache->gsub, script_index, language_index, &t);
385
386 shape_get_script_lang_index(context, scripts, MS_GPOS_TAG, &script_index, &language_index);
387 opentype_get_typographic_features(&context->cache->gpos, script_index, language_index, &t);
388
389 if (t.count == 0)
390 {
391 *actual_tagcount = 0;
392 return S_OK;
393 }
394
395 /* Sort and remove duplicates. */
396 qsort(t.tags, t.count, sizeof(*t.tags), tag_array_sorting_compare);
397
398 for (i = 1, j = 0; i < t.count; ++i)
399 {
400 if (t.tags[i] != t.tags[j])
401 t.tags[++j] = t.tags[i];
402 }
403 t.count = j + 1;
404
405 if (t.count <= max_tagcount)
406 memcpy(tags, t.tags, t.count * sizeof(*t.tags));
407
408 *actual_tagcount = t.count;
409
410 free(t.tags);
411
412 return t.count <= max_tagcount ? S_OK : E_NOT_SUFFICIENT_BUFFER;
413}
static int __cdecl tag_array_sorting_compare(const void *a, const void *b)
Definition: shape.c:369
void opentype_get_typographic_features(struct ot_gsubgpos_table *table, unsigned int script_index, unsigned int language_index, struct tag_array *tags)
Definition: opentype.c:2789
const char * tags[99]
Definition: apphelp.c:216

Referenced by dwritetextanalyzer2_GetTypographicFeatures().

◆ shape_start_next_stage()

void shape_start_next_stage ( struct shaping_features *  features,
stage_func  func 
)

Definition at line 144 of file shape.c.

145{
146 features->stages[features->stage].func = func;
147 features->stage++;
148}
GLenum func
Definition: glext.h:6028

Referenced by arabic_collect_features().

◆ sort_localizedstrings()

void sort_localizedstrings ( IDWriteLocalizedStrings *  iface)

Definition at line 556 of file main.c.

557{
559
560 qsort(strings->data, strings->count, sizeof(*strings->data), localizedstrings_sorting_compare);
561}
static int __cdecl localizedstrings_sorting_compare(const void *left, const void *right)
Definition: main.c:549

Referenced by opentype_get_font_strings_from_id().

◆ unsafe_impl_from_IDWriteFontFace()

◆ unsafe_impl_from_IDWriteTextFormat()

struct dwrite_textformat * unsafe_impl_from_IDWriteTextFormat ( IDWriteTextFormat *  iface)

Definition at line 708 of file format.c.

709{
710 return (iface->lpVtbl == (IDWriteTextFormatVtbl *)&dwritetextformatvtbl) ?
711 CONTAINING_RECORD(iface, struct dwrite_textformat, IDWriteTextFormat3_iface) : NULL;
712}

Referenced by layout_format_from_textformat().

Variable Documentation

◆ arabic_shaper

const struct shaper arabic_shaper
extern

Definition at line 185 of file arabic.c.

Referenced by shape_set_shaper().

◆ dwrite_module

HMODULE dwrite_module
extern

Definition at line 38 of file main.c.

Referenced by DllMain().

◆ identity

Initial value:
=
{
1.0f, 0.0f,
0.0f, 1.0f,
0.0f, 0.0f
}

Definition at line 41 of file dwrite_private.h.

Referenced by dwritefactory_CreateGlyphRunAnalysis().

◆ identity_2x2

const MATRIX_2X2 identity_2x2
static
Initial value:
=
{
1.0f, 0.0f,
0.0f, 1.0f,
}

Definition at line 48 of file dwrite_private.h.

Referenced by dwrite_fontface_get_glyph_bbox(), and dwrite_fontface_get_glyph_bitmap().