[cairo-commit] 2 commits - src/win32

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jan 30 20:15:24 UTC 2023


 src/win32/cairo-dwrite-font.cpp |   10 ++++++++++
 1 file changed, 10 insertions(+)

New commits:
commit d252636b8aac533c271b61b8eaea7c37e8d3bc42
Merge: 47a932bff e8cac307e
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Mon Jan 30 20:15:22 2023 +0000

    Merge branch 'fix-dwrite-crash' into 'master'
    
    Fix dwrite crash when printing dwrite toy font
    
    Closes #632
    
    See merge request cairo/cairo!435

commit e8cac307e1751c46e4275d33009138dd926e22f9
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Mon Jan 30 07:19:03 2023 +1030

    Fix dwrite crash when printing dwrite toy font
    
    Fixes #632

diff --git a/src/win32/cairo-dwrite-font.cpp b/src/win32/cairo-dwrite-font.cpp
index 478f775b8..ce8f9a60e 100644
--- a/src/win32/cairo-dwrite-font.cpp
+++ b/src/win32/cairo-dwrite-font.cpp
@@ -1942,6 +1942,16 @@ _cairo_dwrite_scaled_font_create_win32_scaled_font (cairo_scaled_font_t *scaled_
     }
 
     cairo_font_face_t *face = cairo_scaled_font_get_font_face (scaled_font);
+    if (cairo_font_face_status (face) == CAIRO_STATUS_SUCCESS &&
+	cairo_font_face_get_type (face) == CAIRO_FONT_TYPE_TOY)
+    {
+	face = ((cairo_toy_font_face_t *)face)->impl_face;
+    }
+
+    if (face == NULL || cairo_font_face_get_type (face) != CAIRO_FONT_TYPE_DWRITE) {
+        return CAIRO_INT_STATUS_UNSUPPORTED;
+    }
+
     cairo_dwrite_font_face_t *dwface = reinterpret_cast<cairo_dwrite_font_face_t*>(face);
 
     RefPtr<IDWriteGdiInterop> gdiInterop;


More information about the cairo-commit mailing list