Skip to content

Default "modern" font on macOS doesn't include italics #521

@achabotl

Description

@achabotl

Problem Description

The default font "modern" on macOS is Lucida Grande, which does not include italics. It makes it feels like there's a bug in Chaco. (In fact there's a bug in Kiva (enthought/enable#404), but that's a separate issue).

xref: enthought/enable#406
Reproduction Steps:

from numpy import linspace, pi, sin, cos
from traits.api import HasTraits, Instance
from traitsui.api import View, UItem
from chaco.api import Plot, ArrayPlotData
from enable.api import ComponentEditor
from kiva.api import ITALIC


class PlotWithModifiedLegend(HasTraits):
    plot = Instance(Plot)

    def _plot_default(self):
        x_array = linspace(0.0, 2*pi)
        data = ArrayPlotData(x=x_array, sin=sin(x_array), cos=cos(x_array))
        plot = Plot(data)
        plot.plot(('x', 'sin'), color='blue', name='sine')
        plot.legend.font.style = ITALIC
        plot.legend.visible = True
        return plot

    traits_view = View(
        UItem('plot', editor=ComponentEditor()),
    )

plot_with_legend = PlotWithModifiedLegend()
plot_with_legend.configure_traits()

Expected behavior:

The default "modern" font should have at least regular, italic, bold, and bold italic styles.

The legend should be in italic.

OS, Python version:

  • Python 3.6.9 -- Enthought, Inc. (x86_64)
  • macOS 10.15.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions