unicode minus sign glyph missing with serif fonts in macosx backend

Hello. First, let me apologize if this has been covered---I tried to search the mailing list archives but was unable to get that to work (even queries that should have returned many hits were returning nothing).

When I plot with the MacOSX backend using a serif font, the negative signs on the axis labels show up as the "missing glyph" open squares rather than minus signs.

Things that work around the problem:
- disabling the unicode minus sign via axes.unicode_minus: False in the matplotlibrc file (though this obviously gives a hyphen instead of a true minus sign)
- switching to a sans-serif font
- switching to TkAgg or wxAgg backends
- using the text.usetex option

Things that don't work:
- switching to a different serif font (at least among Times, Times New Roman, and Bitstream Vera Serif)

I am using matplotlib 1.0 installed from the dmg file for Python 2.6 on OSX 10.6. I'm using Python 2.6.6 installed from the python.org binary distribution.

For now, I can work around using a sans-serif font or different backend instead, but I'd really like to use a serif font with the MacOSX backend. Please let me know if you need any other information. Your assistance would be most appreciated, thank you.

joey

Hello,

I have the same problem on MacOsX 10.4 and matplotlib 1.0, but also with
the default sans-serif font. I would guess that the default fonts
available with MacOSX do not have a glyph for the unicode character used
by matplotlib, but if you see it with different backends (i do not have
compiled them because i was to lazy to install the required libraries) I
suspect something is wrong with the macosx backend...

Cheers,

···

On 18/09/10 02:57, Joey Richards wrote:

When I plot with the MacOSX backend using a serif font, the negative
signs on the axis labels show up as the "missing glyph" open squares
rather than minus signs.

--
Daniele

FWIW, Bitstream Vera Serif (at least the one distributed with matplotlib) does have the minus sign (at codepoint U2212), so I don't think it's the fault of the font. I'm on Linux and don't have Apple's Times or Times New Roman, so I can't verify those.

This sounds like a bug in the Mac OS-X backend in how it's handling Unicode characters -- though that doesn't explain why the sans-serif font is working.

Do you have any customizations related to fonts in your matplotlibrc file?

Mike

···

On 09/17/2010 08:57 PM, Joey Richards wrote:

Hello. First, let me apologize if this has been covered---I tried to search the mailing list archives but was unable to get that to work (even queries that should have returned many hits were returning nothing).

When I plot with the MacOSX backend using a serif font, the negative signs on the axis labels show up as the "missing glyph" open squares rather than minus signs.

Things that work around the problem:
- disabling the unicode minus sign via axes.unicode_minus: False in the matplotlibrc file (though this obviously gives a hyphen instead of a true minus sign)
- switching to a sans-serif font
- switching to TkAgg or wxAgg backends
- using the text.usetex option

Things that don't work:
- switching to a different serif font (at least among Times, Times New Roman, and Bitstream Vera Serif)
   

--
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA

I've set the fonts to use (via font.serif, font.sans-serif, etc) and the font family (via font.family), and the size (via font.size), but commenting those out doesn't seem to help. The system-installed fonts all should have the minus sign, though I don't know for sure which fonts matplotlib is using.

joey

···

On Oct 4, 2010, at 6:54 AM, Michael Droettboom wrote:

On 09/17/2010 08:57 PM, Joey Richards wrote:

Hello. First, let me apologize if this has been covered---I tried to search the mailing list archives but was unable to get that to work (even queries that should have returned many hits were returning nothing).

When I plot with the MacOSX backend using a serif font, the negative signs on the axis labels show up as the "missing glyph" open squares rather than minus signs.

Things that work around the problem:
- disabling the unicode minus sign via axes.unicode_minus: False in the matplotlibrc file (though this obviously gives a hyphen instead of a true minus sign)
- switching to a sans-serif font
- switching to TkAgg or wxAgg backends
- using the text.usetex option

Things that don't work:
- switching to a different serif font (at least among Times, Times New Roman, and Bitstream Vera Serif)

FWIW, Bitstream Vera Serif (at least the one distributed with
matplotlib) does have the minus sign (at codepoint U2212), so I don't
think it's the fault of the font. I'm on Linux and don't have Apple's
Times or Times New Roman, so I can't verify those.

This sounds like a bug in the Mac OS-X backend in how it's handling
Unicode characters -- though that doesn't explain why the sans-serif
font is working.

Do you have any customizations related to fonts in your matplotlibrc file?