fc-match Courier:spacing=0 ⇒ n022024l.pfb: "Nimbus Mono L" "Bold Oblique"

Bug #268812 reported by Allison Karlitskaya
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fontconfig
Invalid
Medium
poppler (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

it seems like there are quite a lot of bugs about fontconfig doing the wrong thing. here's one more.

when trying to match plain Courier (non-bold, non-oblique) with additional constraint "spacing=0" you end up with Bold, Oblique Nimbus Mono.

Here's

$ FC_DEBUG=1 fc-match Courier:spacing=0

on my hardy box:

Match Pattern has 18 elts (size 32)
 family: "Courier"(s) "Liberation Mono"(w) "Nimbus Mono L"(w) "Nimbus Mono L"(s) "NimbusMonL-Regu"(w) "Courier New"(w) "Liberation Mono"(w) "Cumberland AMT"(w) "Liberation Mono"(w) "Cumberland"(w) "Courier"(w) "DejaVu Sans Mono"(w) "Bitstream Vera Sans Mono"(w) "Andale Mono"(w) "Courier New"(w) "Cumberland AMT"(w) "Luxi Mono"(w) "Nimbus Mono L"(w) "Courier"(w) "AR PL UMing HK"(w) "AR PL UMing CN"(w) "Miriam Mono"(w) "VL Gothic"(w) "IPAMonaGothic"(w) "IPAGothic"(w) "Sazanami Gothic"(w) "Kochi Gothic"(w) "AR PL KaitiM GB"(w) "AR PL ShanHeiSun Uni"(w) "AR PL SungtiL GB"(w) "AR PL Mingti2L Big5"(w) "ZYSong18030"(w) "Baekmuk Dotum"(w) "Baekmuk Gulim"(w) "Lohit Bengali"(w) "Lohit Gujarati"(w) "Lohit Hindi"(w) "Lohit Punjabi"(w) "Lohit Tamil"(w) "Lohit Malayalam"(w) "Lohit Kannada"(w) "Lohit Telugu"(w) "Lohit Oriya"(w) "LKLUG"(w) "FreeMono"(w) "monospace"(w) "TlwgTypist"(w) "TlwgMono"(w) "Terafik"(w)
 slant: 0(i)(s)
 weight: 100(i)(s)
 width: 100(i)(s)
 size: 12(f)(s)
 pixelsize: 12.5(f)(s)
 spacing: 0(i)(s)
 hintstyle: 3(i)(s)
 hinting: FcTrue(s)
 verticallayout: FcFalse(s)
 autohint: FcFalse(s)
 globaladvance: FcTrue(s)
 dpi: 75(f)(s)
 scale: 1(f)(s)
 lang: "en-CA"(s)
 fontversion: 2147483647(i)(s)
 embeddedbitmap: FcTrue(s)
 decorative: FcFalse(s)

Best score 0 0 3 100 2 0 0 0 11000 10000 0 0 0 0 0 2.14748e+11Pattern has 15 elts (size 15)
 family: "Nimbus Mono L"(w)
 style: "Bold Oblique"(w)
 slant: 110(i)(w)
 weight: 200(i)(w)
 width: 100(i)(w)
 foundry: "urw"(w)
 file: "/usr/share/fonts/type1/gsfonts/n022024l.pfb"(w)
 index: 0(i)(w)
 outline: FcTrue(w)
 scalable: FcTrue(w)
 charset: 0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffdffe ffffffff ffffffff
 0001: ffffffff ffffffff fffff1ff ffffffff 00040000 00000000 00000000 00000000
 0002: 03000000 00000000 00000000 00000000 00000000 00000000 3f0000c0 00000000
 0004: ffffffff ffffffff ffffffff 00000000 0ccf0000 0ccff00c faff0007 033ffffc
 0020: 77180000 06010047 00000010 00000000 00000000 00001000 00000000 00000000
 0021: 00400000 00000004 00000000 00000000 00000000 00000000 00000000 00000000
 0022: 44060044 00000000 00000000 00000031 00000000 00000000 00000000 00000000
 0025: 00000000 00000000 00000000 00000000 00000000 00000000 00000400 00000000
 00f6: 00000000 00000000 00000000 00000000 00000000 00000000 000001f8 00000000
 00fb: 00000006 00000000 00000000 00000000 00000000 00000000 00000000 00000000
(w)
 lang: aa|ast|ava|ay|be|bg|bi|br|bs|bua|ca|ce|ch|co|cs|da|de|en|eo|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gv|ho|hr|hu|ia|id|ie|ik|io|is|it|ki|kl|kum|kv|ky|la|lb|lez|lt|lv|mg|mh|mk|mt|nb|nds|nl|nn|no|nr|nso|ny|oc|om|os|pl|pt|rm|ru|sel|sh|sk|sl|sma|smj|so|sq|sr|ss|st|sv|sw|tg|tn|tr|ts|tyv|uk|uz|vo|vot|wa|wen|xh|yap|zu(w)
 fontversion: 0(i)(w)
 fontformat: "Type 1"(w)
 decorative: FcFalse(w)

n022024l.pfb: "Nimbus Mono L" "Bold Oblique"

Without specifying "spacing=0" I get the expected output (or at least an acceptable one: "Nimbus regular", although I would prefer one of the fonts I explicitly installed from liberation or the courier from msttcorefonts).

So why do I care about "spacing=0"? This is what poppler requests when you open the attached PDF file using evince. The PDF includes no font information since "Courier" is one of the PDF base fonts. fontconfig gives evince the bold/oblique font which results in incorrect output.

Revision history for this message
In , Allison Karlitskaya (desrt) wrote :

Created an attachment (id=18764)
fo file

Revision history for this message
In , Allison Karlitskaya (desrt) wrote :

Created an attachment (id=18765)
pdf file

Revision history for this message
In , Allison Karlitskaya (desrt) wrote :

Created an attachment (id=18766)
png file

Revision history for this message
In , Albert Astals Cid (aacid) wrote :

I've no idea of which poppler version you are using, but anyways, this is not a bug.

The PDF has Courier NOT embedded in the file, so when rendering we have to ask the system for a font named Courier and draw what it gives us.

We are using Fontconfig for that and using poppler 0.9.0 i get the "correct" answer (n022003l.pfb), so if it does not for you, either update your poppler or fix your fontconfig to give the correct font when asking for Courier.

Revision history for this message
In , Allison Karlitskaya (desrt) wrote :

Some more information I managed to dig up (this seems to be the source of the problem):

desrt@moonpix:~$ fc-match Courier
n022003l.pfb: "Nimbus Mono L" "Regular"
desrt@moonpix:~$ fc-match Courier:spacing=0
n022024l.pfb: "Nimbus Mono L" "Bold Oblique"

Behdad says he can reproduce this so I'm reopening and reassigning.

Revision history for this message
Allison Karlitskaya (desrt) wrote :
Download full text (3.6 KiB)

it seems like there are quite a lot of bugs about fontconfig doing the wrong thing. here's one more.

when trying to match plain Courier (non-bold, non-oblique) with additional constraint "spacing=0" you end up with Bold, Oblique Nimbus Mono.

Here's

$ FC_DEBUG=1 fc-match Courier:spacing=0

on my hardy box:

Match Pattern has 18 elts (size 32)
 family: "Courier"(s) "Liberation Mono"(w) "Nimbus Mono L"(w) "Nimbus Mono L"(s) "NimbusMonL-Regu"(w) "Courier New"(w) "Liberation Mono"(w) "Cumberland AMT"(w) "Liberation Mono"(w) "Cumberland"(w) "Courier"(w) "DejaVu Sans Mono"(w) "Bitstream Vera Sans Mono"(w) "Andale Mono"(w) "Courier New"(w) "Cumberland AMT"(w) "Luxi Mono"(w) "Nimbus Mono L"(w) "Courier"(w) "AR PL UMing HK"(w) "AR PL UMing CN"(w) "Miriam Mono"(w) "VL Gothic"(w) "IPAMonaGothic"(w) "IPAGothic"(w) "Sazanami Gothic"(w) "Kochi Gothic"(w) "AR PL KaitiM GB"(w) "AR PL ShanHeiSun Uni"(w) "AR PL SungtiL GB"(w) "AR PL Mingti2L Big5"(w) "ZYSong18030"(w) "Baekmuk Dotum"(w) "Baekmuk Gulim"(w) "Lohit Bengali"(w) "Lohit Gujarati"(w) "Lohit Hindi"(w) "Lohit Punjabi"(w) "Lohit Tamil"(w) "Lohit Malayalam"(w) "Lohit Kannada"(w) "Lohit Telugu"(w) "Lohit Oriya"(w) "LKLUG"(w) "FreeMono"(w) "monospace"(w) "TlwgTypist"(w) "TlwgMono"(w) "Terafik"(w)
 slant: 0(i)(s)
 weight: 100(i)(s)
 width: 100(i)(s)
 size: 12(f)(s)
 pixelsize: 12.5(f)(s)
 spacing: 0(i)(s)
 hintstyle: 3(i)(s)
 hinting: FcTrue(s)
 verticallayout: FcFalse(s)
 autohint: FcFalse(s)
 globaladvance: FcTrue(s)
 dpi: 75(f)(s)
 scale: 1(f)(s)
 lang: "en-CA"(s)
 fontversion: 2147483647(i)(s)
 embeddedbitmap: FcTrue(s)
 decorative: FcFalse(s)

Best score 0 0 3 100 2 0 0 0 11000 10000 0 0 0 0 0 2.14748e+11Pattern has 15 elts (size 15)
 family: "Nimbus Mono L"(w)
 style: "Bold Oblique"(w)
 slant: 110(i)(w)
 weight: 200(i)(w)
 width: 100(i)(w)
 foundry: "urw"(w)
 file: "/usr/share/fonts/type1/gsfonts/n022024l.pfb"(w)
 index: 0(i)(w)
 outline: FcTrue(w)
 scalable: FcTrue(w)
 charset: 0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffdffe ffffffff ffffffff
 0001: ffffffff ffffffff fffff1ff ffffffff 00040000 00000000 00000000 00000000
 0002: 03000000 00000000 00000000 00000000 00000000 00000000 3f0000c0 00000000
 0004: ffffffff ffffffff ffffffff 00000000 0ccf0000 0ccff00c faff0007 033ffffc
 0020: 77180000 06010047 00000010 00000000 00000000 00001000 00000000 00000000
 0021: 00400000 00000004 00000000 00000000 00000000 00000000 00000000 00000000
 0022: 44060044 00000000 00000000 00000031 00000000 00000000 00000000 00000000
 0025: 00000000 00000000 00000000 00000000 00000000 00000000 00000400 00000000
 00f6: 00000000 00000000 00000000 00000000 00000000 00000000 000001f8 00000000
 00fb: 00000006 00000000 00000000 00000000 00000000 00000000 00000000 00000000
(w)
 lang: aa|ast|ava|ay|be|bg|bi|br|bs|bua|ca|ce|ch|co|cs|da|de|en|eo|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gv|ho|hr|hu|ia|id|ie|ik|io|is|it|ki|kl|kum|kv|ky|la|lb|lez|lt|lv|mg|mh|mk|mt|nb|nds|nl|nn|no|nr|nso|ny|oc|om|os|pl|pt|rm|ru|sel|sh|sk|sl|sma|smj|so|sq|sr|ss|st|sv|sw|tg|tn|tr|ts|tyv|uk|uz|vo|vot|wa|wen|xh|yap|zu(w)
 fontversion: 0(i)(w)
 fontformat: "Type 1"(w)
 decorative: FcFalse(w)

n022024l.pfb: "Nimbus Mono L" "Bold Oblique"

Without specif...

Read more...

Revision history for this message
Allison Karlitskaya (desrt) wrote :
Revision history for this message
Allison Karlitskaya (desrt) wrote :

The PDF was generated by Apache FOP, by the way, using this input:

<root xmlns='http://www.w3.org/1999/XSL/Format'>
  <layout-master-set>
    <simple-page-master master-name='plain'
                        page-width='20cm' page-height='6cm'>
      <region-body/>
    </simple-page-master>
    <page-sequence-master master-name='master'>
      <single-page-master-reference master-reference='plain'/>
    </page-sequence-master>
  </layout-master-set>

  <page-sequence master-reference='master'>
    <flow flow-name='xsl-region-body'>
      <block font-family='monospace' font-size='148pt'>
        o hai!
      </block>
    </flow>
  </page-sequence>
</root>

The reason I report this here is because the PDF looks fine using xpdf and adobe acrobat reader and also looks fine on Red Hat (according to some people I've talked to on IRC).

Revision history for this message
Allison Karlitskaya (desrt) wrote :

Just talked to Behdad about this. Seems like it's actually not ubuntu-only. Attached upstream report.

بهداد: humm
بهداد: is it 2.4.2?
desrt: 2.5.0
 * بهداد can reproduce
بهداد: I remember seeing something similar before
بهداد: it definitely is
بهداد: it's not a configuration issue
بهداد: it's something broken in the library

Changed in fontconfig:
status: Unknown → Confirmed
Revision history for this message
In , Freedesktop (freedesktop) wrote :

For some reason the Nimbus Mono L Bold Oblique is not getting any spacing value detected for it, and that happens to better match 0 than the spacing=100 in the rest of them. Investigating.

Revision history for this message
In , Freedesktop (freedesktop) wrote :

In fact the question is why does fontconfig detect spacing=100 (FC_MONO) for the three of them.

Revision history for this message
In , Freedesktop (freedesktop) wrote :

Sorry. It's Mono after all, so detecting spacing=100 is correct. It fails for Bold Oblique version though.

Another question I guess is, why does poppler request for spacing=0 instead of leaving that pattern field empty?

Revision history for this message
In , Freedesktop (freedesktop) wrote :

Glyph 227 of Nimbus Mono L Bold Oblique has a width much wider than the rest of the glyphs in the font (740 vs 600), so the font is detected as having proportional spacing, not mono spacing.

Revision history for this message
In , Freedesktop (freedesktop) wrote :

No idea if there's any upstream for urw-fonts. Reported to Fedora:
https://bugzilla.redhat.com/show_bug.cgi?id=478332

Revision history for this message
In , Freedesktop (freedesktop) wrote :

Actually this was fixed in poppler earlier this year. Poppler now doesn't set spacing unless it wants to ask for mono. Dupping.

*** This bug has been marked as a duplicate of bug 14883 ***

Changed in fontconfig:
status: Confirmed → Invalid
Revision history for this message
Vish (vish) wrote :

Upstream had marked fontconfig bug as a dup of poppler bug http://bugs.freedesktop.org/show_bug.cgi?id=14883
Which has been fixed a while ago. Closing bug report

affects: fontconfig (Ubuntu) → poppler (Ubuntu)
Changed in poppler (Ubuntu):
status: New → Fix Released
Changed in fontconfig:
importance: Unknown → Medium
status: Invalid → Unknown
Changed in fontconfig:
importance: Medium → Unknown
Changed in fontconfig:
importance: Unknown → Medium
Changed in fontconfig:
status: Unknown → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

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