community
community copied to clipboard
Use Pango as text renderer
Currently, Kivy use sdl2 or PIL text renderer, and doesn't handle fallback, multilingual text or complex processing and in addition some bugs are present (https://github.com/kivy/kivy/issues/4741).
The use of Pango should resolve all these issues, and it integrate well with OpenGL, it would be a great addition to Kivy.
The link markup is wrong :)
@Leva7 fixed, thanks :)
@goffi-contrib, I don't have any experience with this, but i've heard people recommending harfbuzz instead of the pango abstraction. What is the reason for preferring pango in this specific case?
@dessant not a expert either, but Pango handle layout and text rendering, and is using Harfbuzz actually (which do text shaping)
You give text to Pango and it returns a ready-to-use rendered image, it's more high level than Harfbuzz, and hopefully should not be too hard to integrate with Kivy.
It's used by at least Firefox, and GTK+, so it's solid project.
I did it in the paste, but when it came to packaging, it was cumbersome to get the whole glib, gdk, pangs stack juste for that, so it never land into master.
Maybe it changed now.
@tito could you point me at source code / commits of your previous attempt? Sounds useful (even if it's not complete)
14:10 tito@mintel code $ find . -iname 'text_pango.py'
14:11 tito@mintel code $
Looks like i don't have it anymore :(
I did run into this (not tito's)
https://github.com/kivy/kivy/compare/master...kived:text-pango https://github.com/kivy/kivy/compare/master...kived:text-pango2
I was into pango / harfbuzz for last few days,and realised that pango is using harfbuzz is as its layout engine but not using harfbuzz shapers. Pango provides a low-level API from which we can build their own layout engine.I am currently testing a (pango-cairo) code with kivy and will send the pr in few days.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I wonder if there's any current plans for this, or something similar that can effectively handle rendering multilingual text?
Currently, doing something like this:
... requires a major hack that involves mapping various Unicode code points to selecting predefined fonts by using text markup.