Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
Comment on lines +812 to +815
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like this is something the kiva Font class should be managing, but perhaps that's too fraught with all of the different backend implementations.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly. I'd like to see Font to grow more like the CSS font specifiers where you can give a bunch of font face name suggestions, including generic ones, but that's a fairly big API change that would need to be managed.

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