Skip to content

Commit

Permalink
Fix Quartz font rendering (#978)
Browse files Browse the repository at this point in the history
* Use font family in quartz when no font name given.

* Render quartz text with fill color rather than stroke color.
  • Loading branch information
corranwebster committed Aug 8, 2022
1 parent 897d162 commit f2899c9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions kiva/quartz/ABCGI.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -934,7 +938,8 @@ cdef class CGContext:

pointer = self.current_font.get_pointer()
ct_font = <CTFontRef>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

Expand Down

0 comments on commit f2899c9

Please sign in to comment.