pygobject/pycairo

Best way for text rendering in serious applications (on Windows)

claell opened this issue · 2 comments

The docs list two sets of text rendering capabilities: https://pycairo.readthedocs.io/en/latest/reference/text.html#text. It is not entirely clear, which ones are which (at least for me not all of the documented items seem to belong to either of these classes).

In general, I just want to be sure that I can produce high quality text with kerning, etc.

So which functions should I use for that? And should I use Pango for that, as suggested? Or is there something built in already, but not documented? Also, there seems to be a library called pangocairo (among others).

Some advice would be appreciated.

(at least for me not all of the documented items seem to belong to either of these classes).

Of the top of my head, I think that any API that takes text is the "basic API". Anything where the caller has to provide positions of individual glyphs is the "fancy API".

But... the docs you link to basically say the same, so perhaps I am misunderstanding the question?

In general, I just want to be sure that I can produce high quality text with kerning, etc.

That's something that cairo doesn't do, sorry. Things like Pango do exactly that.

Also, there seems to be a library called pangocairo (among others).

PangoCairo is part of Pango. It is the part of Pango that talks to Cairo. There is also PangoXft, but I think Xft is more basic than cairo (and text-specific, so not a general "drawing something").

claell commented

Thanks! That is already helpful.

But... the docs you link to basically say the same, so perhaps I am misunderstanding the question?

No, I think I might not have read the docs carefully enough.

Okay, so I think, then my question is how to use pangocairo with pycairo. I already switched to a different approach for my use case by now, but that might still be good to document for other users or future uses.

I recently asked GPT-4 the same question and got an answer that might have been correct; however, some official documentation on this might be great!