Mac OS X/XQuartz: Can't render single letter #43

jonashaag opened this Issue Feb 2, 2014 · 5 comments

4 participants


I have a very strange issue with XQuartz on OS X (Mavericks).

I can render stuff like text "foo" just fine, but text "f" crashes with

Assertion failed: (!scaled_font->cache_frozen), function _cairo_scaled_glyph_page_destroy,
file cairo-scaled-font.c, line 459.

I traced this down to being an issue with what C.textExtents returns. If I patch the code so that it never calls textExtents on a string of length 1, it works fine.

Code used to debug:

-- Original code when given string of length 1
TextExtents {textExtentsXbearing = 0.0, textExtentsYbearing = -1.0, textExtentsWidth = 1.0,
textExtentsHeight = 1.0, textExtentsXadvance = 1.0, textExtentsYadvance = 0.0}

-- Patched code when given string of length 1, simply makes it a string of length 2
TextExtents {textExtentsXbearing = 0.0, textExtentsYbearing = -1.0, textExtentsWidth = 2.0,
textExtentsHeight = 1.0, textExtentsXadvance = 2.0, textExtentsYadvance = 0.0}

I'm not sure if this is a bug in the Diagrams Cairo backend or some other problem with XQuartz, Cairo, ... you name it. I'm happy for any pointers :)

diagrams member

I hear that we should replace all of our text handling in the Cairo Backend with Pango. See, for example, #19 for more bizarreness.

diagrams member

Ugh. Unfortunately, as @bergey says, this is most likely a bug in cairo, and moreover, the documentation is quite explicit that the text API we are using is just a "toy" and that no one is likely to put any effort into fixing it. We need someone to take on porting the text handling to pango as a project --- though I am not sure how much effort it will be.

@bergey bergey referenced this issue May 17, 2014

Pango #49

diagrams member

Agreed, the cairo based text api should either be deprecated or replaced in favor of pango.

diagrams member

@mgsloan: see #49 which just got merged!

diagrams member

Cool, good stuff @bergey!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment