Embedding icons in Pango text, the "right" way?
- From: Andy Meneely <andy meneely gmail com>
- To: gtk-i18n-list gnome org
- Subject: Embedding icons in Pango text, the "right" way?
- Date: Thu, 11 Aug 2016 11:04:36 -0400
Hi, I maintain a Ruby gem that uses
Pango heavily (
https://github.com/andymeneely/squib/). One of the key features is to be able to draw an icon into the text such that it flows just like any other word. Carving out the space in the
Pango layout has proven to be a finicky challenge. (Once we carve out the proper space in the layout, we use Cairo to paint the image separately.)
What is the proper way to carve out space for image? We need this space to flow like any other word.
If we created a zero-sized regular character (e.g "a"), then stroking path will fail because a zero-sized font invalidates the matrix math. Plus, we get strange behavior happening when the text is ONLY an embedded icon of a zero-sized font (i.e. we get a warning that the font can't be found).
So I've never been happy with the way we implement this and I'm convinced Pango provides a better way. I see the AttrShape struct - should I be using that? How do I set attributes for just one character? I've been scouring the docs and mailing lists archives and I'm not grasping exactly how attribute lists work, so that's why I went with markup.
If you have solutions in just C, or in another scripting language, I can port it.
Thanks!
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]