pango 1.36.6 breaks 'Light' font styles in 0.48 and trunk

Bug #1364937 reported by su_v
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
Tavmjong Bah

Bug Description

After upgrading to latest release of pango (1.36.6) [1], 'Light' variants of fonts are identified as 'Semi-Light' in Inkscape, but the style cannot be applied - neither via text tool controls bar nor via 'Text and Font' dialog.

Surprising detail: the font style can actually be used in trunk if typing 'Light' into the style selector on the text tool controls bar: the result renders as expected on-canvas, but the style is not recognized in the 'Text and Font' dialog (selects 'Normal').

Font used for tests: Adobe's 'Source Sans Pro'
Systems: Mac OS X 10.7.5 (me), Debian sid (houz, via irc)

Likely relevant changes in Pango 1.36.6:
- support for a new font weight: PANGO_WEIGHT_SEMILIGHT

Comparison with other GTK+ apps:
- gtk demo font picker: lists style as 'Light', renders preview ok
- GIMP 2.8.14: lists font style as 'Semi-Light', renders font as expected on-canvas

Upgrading fontconfig to latest git master didn't help (tested on OS X only).

Affects current stable Inkscape 0.48.5 (r10040) and trunk (0.91pre2) (r13543).

Wrt related upstream changes in pango (and fontconfig), see also
- https://bugzilla.gnome.org/show_bug.cgi?id=733764
- https://bugs.freedesktop.org/show_bug.cgi?id=81453

--
[1] verified by downgrading pango to earlier version 1.36.5: the same inkscape builds then list the font style as 'Light', allow to assign it to text and render it on-canvas as expected.

su_v (suv-lp)
description: updated
Revision history for this message
su_v (suv-lp) wrote :

Related new warnings when building Inkscape (trunk) with pango 1.36.6 installed:

  CXX libnrtype/font-lister.o
../../src/libnrtype/font-lister.cpp:616:16: warning: enumeration value 'PANGO_WEIGHT_SEMILIGHT' not handled in switch [-Wswitch-enum]
      switch ( weight ) {
               ^
1 warning generated.

  CXX libnrtype/Layout-TNG-Output.o
../../src/libnrtype/Layout-TNG-Output.cpp:510:13: warning: enumeration value 'PANGO_WEIGHT_SEMILIGHT' not handled in switch [-Wswitch-enum]
    switch (w) {
            ^
1 warning generated.

Revision history for this message
ScislaC (scislac) wrote :

Confirmed with trunk r13543 on Utopic

Changed in inkscape:
status: New → Confirmed
ScislaC (scislac)
Changed in inkscape:
importance: Undecided → Medium
Revision history for this message
Tavmjong Bah (tavmjong-free) wrote :

I've added 'PANGO_WEIGHT_SEMILIGHT' to both trunk and experimental branches. Does this fix the problem? (I don't have Pango 1.36.6.)

Revision history for this message
su_v (suv-lp) wrote :

> Does this fix the problem?

No - at least not on OS X using pango 2.36.8 (tested with both backends: X11, Quartz): fonts with 'Light' styles list 'Semi-Light' in the style dropdown list (and in the Text & Font dialog), but selecting that style doesn't work. The workaround (typing 'Light' into the style entry on the text tool controls bar works as before).

Revision history for this message
Tavmjong Bah (tavmjong-free) wrote :

I cleaned up the code a bit. Might or might not help... simplifying the conversion of Pango weight values to CSS weight values.

Some notes:

With Pango 1.36.1:

  Source Sans Pro (six weights):

    Works as expected in trunk and experimental branch.

  Source Han Sans (seven weights):

    Installed via Fedora 20 RPM (adobe-source-han-sans-cn-fonts-1.000-4.fc20.noarch):
      Pango maps both medium and regular to CSS medium weight.
Trunk specifically skips duplicate CSS weights thus only six weight shown. Experimental shows seven but only displays six (as expected since SVG stores weights using CSS).

    Installed via downloading source (http://sourceforge.net/adobe/source-han-sans/wiki/Home/):
      Pango maps

Revision history for this message
Tavmjong Bah (tavmjong-free) wrote :

Wasn't finished with comment above...

I cleaned up the code a bit. Might or might not help... simplifying the conversion of Pango weight values to CSS weight values.

Some notes:

With Pango 1.36.1:

  Source Sans Pro (six weights):

    Works as expected in trunk and experimental branch.

  Source Han Sans (seven weights):

    Installed via Fedora 20 RPM (adobe-source-han-sans-cn-fonts-1.000-4.fc20.noarch):

      Pango maps both medium and regular to CSS medium weight.
      Trunk specifically skips duplicate CSS weights thus only six weight shown.
      Experimental shows seven but only renders six (as expected since SVG stores weights using CSS).

    Installed via downloading source (http://sourceforge.net/adobe/source-han-sans/wiki/Home/):

      Pango maps both extralight and light to light, regular and medium to medium.
      Trunks shows five weights, experimental seven.

I commented in another bug that Pango uses the PS Weight value in determining weights but this seems to not be true in the case of Source Han Sans where the PS Weight value for all faces is set to Regular (FontForge: Element->Font Info...->PS Names->Weight). The PS Weight values are "correct" in Source Sans Pro.

Looks like I'll have to install Pango 1.36.6 to make any more progress...

Revision history for this message
Tavmjong Bah (tavmjong-free) wrote :

Pango has broken the one to one mapping between Pango weights and CSS weights by adding Semi-Light = 350 (well it was already broken with Book = 380 and Ultra-Heavy = 1000 but they are rarely used). Every font face that I have installed that previously had a Light weight now has a Semi-Light weight. Semi-Light is being mapped to CSS Normal. This is causing nasty problems with the code.

Revision history for this message
Tavmjong Bah (tavmjong-free) wrote :

Revision 13577 in trunk seems to fix the problem. It converts any Pango Semi-Light to Light. Not the best solution. Better solutions would be:

1. Implement CSS @font-face rules.

2. Use the Font "Display Name" rather than the "CSS Name" in tracking fonts (via -inkscape-fontspec). This would work for Inkscape but fail for any other renderer since SVG relies on CSS values.

Revision history for this message
su_v (suv-lp) wrote :

Fix confirmed with Inkscape 0.91pre2 r13577 and pango 1.36.8 on OS X 10.7.5

Changed in inkscape:
assignee: nobody → Tavmjong Bah (tavmjong-free)
milestone: none → 0.91
status: Confirmed → Fix Committed
Bryce Harrington (bryce)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.