Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
claell opened this issue May 23, 2023 · 2 comments
Open

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

claell opened this issue May 23, 2023 · 2 comments

Comments

@claell
Copy link

claell commented May 23, 2023

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.

@psychon
Copy link

psychon commented Sep 30, 2023

(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
Copy link
Author

claell commented Oct 14, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants