2 commits - src/cairo-quartz-font.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 18 09:32:26 UTC 2024


 src/cairo-quartz-font.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

New commits:
commit 586c8acacd70554759d4a835c2e8aa7d7b04f01b
Merge: 61da2c205 bd6aa966d
Author: Emmanuele Bassi <ebassi at gmail.com>
Date:   Thu Jan 18 09:32:20 2024 +0000

    Merge branch 'fix-issue-811' into 'master'
    
    Cairo 1.18.0 doesn't draw italic or bold text on Mac
    
    See merge request cairo/cairo!531

commit bd6aa966df0a593b44830582b2e2b1f160768295
Author: Diego Pino Garcia <dpino at igalia.com>
Date:   Mon Jan 15 14:30:51 2024 +0100

    [quartz] Fix: Cairo 1.18.0 doesn't draw italic or bold text on Mac
    
    Commit cf351a8a attempted to convert the font generation in
    '_cairo_quartz_font_create_for_toy' to use CTFontCreateWithName and that uses
    only Postscript Names, meaning with the hyphens.
    
    Commit c6dc5df6 converted back to CGFont. CGFontCreateWithFontName is supposed
    to work with Postscript Names, but it seems sometimes it does not.
    
    In case a CGFont cannot be created using Postscript Names, attempt unhyphenated
    version of font family name.

diff --git a/src/cairo-quartz-font.c b/src/cairo-quartz-font.c
index 621d3540c..b7efc54de 100644
--- a/src/cairo-quartz-font.c
+++ b/src/cairo-quartz-font.c
@@ -165,6 +165,17 @@ _cairo_quartz_font_face_create_for_toy (cairo_toy_font_face_t   *toy_face,
 	cgFont = CGFontCreateWithFontName (FontName);
 	CFRelease (FontName);
 
+	if (!cgFont) {
+            /* Attempt to create font by replacing hyphens for spaces in font name. */
+            for (size_t i = 0; i < strlen (full_name); i++) {
+                if (full_name[i] == '-')
+                    full_name[i] = ' ';
+            }
+            FontName = CFStringCreateWithCString (NULL, full_name, kCFStringEncodingASCII);
+            cgFont = CGFontCreateWithFontName (FontName);
+            CFRelease (FontName);
+	}
+
 	if (cgFont)
 	    break;
     }


More information about the cairo-commit mailing list