Extending pango markup attributes
Par jd le dimanche, avril 27 2008, 10:00 - awesome - Lien permanent
I'm currently facing a problem I just can't solve, involving pango and GMarkup's glib API.
I currently use pango markup in awesome, but I'd like to extend it to support more attributes.
Pango markup uses GMarkup API to parse the formatted string. The problem is that there's no way to extend what is parsed, and if a tag is unknown in the pango parser, it will just fail.
I've tried to implement my own parser with GMarkup, but… When I encounter a tag I don't know but that pango does, I just can't pass it to the pango parser function for this tag, since this pango function is private.
There was a try to extends the markup parser 2 years ago, but the patch was crappy since it exposed the private elements of pango markup parsing, which is the bad way to solve this.
So for now, I've no idea how to do this. I was first using the bad parsing method with string.h's functions which I for now reverted, because I do not really like that.
Commentaires
you can create your own parser... GMarkUp is nothing more then a parser, which is feeding Attributes and layout to Pango rendering engine...
Try this link to understand Pango interaction.
http://www.gnu.org/software/guile-g...
Beside this if you are using it for some project on PC.. give a try to ANTLR, that might be better for parsing, and can generate C++ code too
In case, if you are on embedded platform... then our old friend, the lex and yacc is recommended, rather then hand written parsers for extensibility reasons...
in-fact majority of parsers are already existing, so you only need to work around the rendering codes...
Greetings
I finally managed to do it using GMarkup API.