After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 170055 - Support relative font sizes in text markup
Support relative font sizes in text markup
Status: RESOLVED OBSOLETE
Product: pango
Classification: Platform
Component: general
1.8.x
Other All
: Normal enhancement
: Small API
Assigned To: pango-maint
pango-maint
Depends on: 562252
Blocks:
 
 
Reported: 2005-03-12 12:01 UTC by gbz
Modified: 2018-05-22 12:09 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
add the codes about supporting "150%" (2.67 KB, patch)
2006-04-29 16:47 UTC, LingNing Zhang
rejected Details | Review
my patch (7.83 KB, patch)
2006-04-30 00:29 UTC, Behdad Esfahbod
needs-work Details | Review

Description gbz 2005-03-12 12:01:35 UTC
Pango markup language doesn't currently allow use of a scale factor, like
possible with the GtkTextTag or PangoAttribute.
It could be useful to have though, being more exact and convenient than nesting
many <span size="larger"> which are the only current relative size attributes.
Comment 1 Owen Taylor 2005-06-21 17:09:55 UTC
I want to do this as size="150%" like CSS.
Comment 2 Behdad Esfahbod 2006-01-29 01:34:09 UTC
*** Bug 325767 has been marked as a duplicate of this bug. ***
Comment 3 LingNing Zhang 2006-04-29 16:47:11 UTC
Created attachment 64527 [details] [review]
add the codes about supporting "150%"

I wrote a patch for adding the codes that support size = "150%" in text markup.
If size = "n%" in text markup, font size will become old_font_size * (n / 100). 
For example:
font size = 50 * PANGO_SCALE,
pango_layout_set_markup (layout, "<span size=\"150%\">A</span>");
then font size becomes 1.5 * 50 * PANGO_SCALE.
Comment 4 Behdad Esfahbod 2006-04-30 00:29:31 UTC
Created attachment 64542 [details] [review]
my patch

Ok, I've implemented relative sizes such that they actually work recursively too.

Imagine this text:

<span size="1024">a<span size="200%">b<span size="200%">c</span>d</span>e</span>

the sizes one expects is of course 12421.

Now with this:

<span size="1024">a<span size="200%">b<span size="1024">c</span>d</span>e</span>

Now of course you expect 12121, and not 12221.

To make it do this, I changed pango-attributes.c such that an inner font attribute makes scale attributes after it to not scale.  But I think the promise of attributes is to scale the font size, and the markup parser should clear any scale setting when setting font size.  Owen, which one is correct?
Comment 5 Behdad Esfahbod 2008-11-25 19:14:14 UTC
Filed bug 562252 to add new api that helps here.
Comment 6 GNOME Infrastructure Team 2018-05-22 12:09:16 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/pango/issues/23.