From f2899c9ef50b7c6e71d0cb1f54f736cefde9e59e Mon Sep 17 00:00:00 2001 From: Corran Webster Date: Mon, 8 Aug 2022 11:23:44 +0100 Subject: [PATCH] Fix Quartz font rendering (#978) * Use font family in quartz when no font name given. * Render quartz text with fill color rather than stroke color. --- kiva/quartz/ABCGI.pyx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kiva/quartz/ABCGI.pyx b/kiva/quartz/ABCGI.pyx index e298e4c65..ffd85fa5b 100644 --- a/kiva/quartz/ABCGI.pyx +++ b/kiva/quartz/ABCGI.pyx @@ -809,7 +809,11 @@ cdef class CGContext: constants.ITALIC: 'italic', constants.BOLD_ITALIC: 'bold italic', }[font.is_bold() | font.style] - self.select_font(font.face_name, font.size, style=style) + if font.face_name: + name = font.face_name + else: + name = font.findfontname() + self.select_font(name, font.size, style=style) def set_font_size(self, float size): """ Change the size of the currently selected font @@ -934,7 +938,8 @@ cdef class CGContext: pointer = self.current_font.get_pointer() ct_font = pointer - ct_line = _create_ct_line(text, ct_font, self.stroke_color) + # using fill_color here brings rendering in line with Agg backends + ct_line = _create_ct_line(text, ct_font, self.fill_color) if ct_line == NULL: return