Merge branch 'win32-fixes' into 'master'

Win32 Fixes

Closes #897

See merge request cairo/cairo!626
This commit is contained in:
Tim-Philipp Müller 2025-06-16 17:15:07 +00:00
commit 3ffb6d5c07
3 changed files with 8 additions and 8 deletions

View file

@ -53,7 +53,6 @@ CAIRO_MUTEX_DECLARE (_cairo_ft_unscaled_font_map_mutex)
#if CAIRO_HAS_WIN32_FONT
CAIRO_MUTEX_DECLARE (_cairo_win32_font_face_mutex)
CAIRO_MUTEX_DECLARE (_cairo_win32_font_dc_mutex)
#endif
#if CAIRO_HAS_XLIB_SURFACE

View file

@ -1496,12 +1496,15 @@ _cairo_dwrite_scaled_font_init_glyph_surface (cairo_dwrite_scaled_font_t *scaled
switch (cairo_font_options_get_hint_style (&scaled_font->base.options)) {
case CAIRO_HINT_STYLE_DEFAULT:
grid_fit_mode = DWRITE_GRID_FIT_MODE_DEFAULT;
break;
case CAIRO_HINT_STYLE_NONE:
grid_fit_mode = DWRITE_GRID_FIT_MODE_DISABLED;
break;
case CAIRO_HINT_STYLE_SLIGHT:
case CAIRO_HINT_STYLE_MEDIUM:
case CAIRO_HINT_STYLE_FULL:
grid_fit_mode = DWRITE_GRID_FIT_MODE_ENABLED;
break;
}
cairo_subpixel_order_t subpixel_order;

View file

@ -143,16 +143,14 @@ _cairo_win32_scaled_font_init_glyph_path (cairo_win32_scaled_font_t *scaled_font
static HDC
_get_global_font_dc (void)
{
static cairo_atomic_once_t once = CAIRO_ATOMIC_ONCE_INIT;
static DWORD hdc_tls_index;
HDC hdc;
if (!hdc_tls_index) {
CAIRO_MUTEX_LOCK (_cairo_win32_font_dc_mutex);
if (!hdc_tls_index) {
hdc_tls_index = TlsAlloc ();
assert (hdc_tls_index != TLS_OUT_OF_INDEXES);
}
CAIRO_MUTEX_UNLOCK (_cairo_win32_font_dc_mutex);
if (!_cairo_atomic_init_once_enter (&once)) {
hdc_tls_index = TlsAlloc ();
assert (hdc_tls_index != TLS_OUT_OF_INDEXES);
_cairo_atomic_init_once_leave (&once);
}
hdc = TlsGetValue (hdc_tls_index);