You are not logged in.

#1 2010-03-20 23:42:45

herzen
Member
From: Pennsylvania, US
Registered: 2009-10-28
Posts: 38

[SOLVED] Evince is unable to correctly use its dependency gsfonts

Hello,

When using a new Arch installation (inside an OpenSolaris system using BrandZ), I noticed that Evince and LyX use a boldface font when they should be using a normal Roman font. Thus, for a PDF file without embedded fonts, Times-Roman gets displayed bold, as if it were Times-Bold. Similarly, if you start LyX and go to Help -> Introduction, you will find that plain text gets displayed as boldface, so that there is no difference between the section headings and the paragraphs of content.

It took me a while to figure out what was wrong. I have a desktop and laptop with Arch installed where this problem doesn't occur. Finally, I noticed that these systems have the package ttf-dejavu installed but the system with the problem doesn't. Installing ttf-dejavu fixes the problem.

Thus, it seems to me that ttf-dejavu should be made a dependency for Evince and LyX, or at the very least an optional dependency.

I didn't file a bug report for this, because there are two packages involved (maybe more?) and because I have a fix, and I'm not sure if bug reports should be filed if the fix is already known.

I've been working with the current versions of the packages, evince-2.28.2-1 and lyx-1.6.5-3.

Last edited by herzen (2010-03-22 21:31:44)

Offline

#2 2010-03-21 00:08:36

n0dix
Member
Registered: 2009-09-22
Posts: 956

Re: [SOLVED] Evince is unable to correctly use its dependency gsfonts

herzen wrote:

I didn't file a bug report for this, because there are two packages involved (maybe more?) and because I have a fix, and I'm not sure if bug reports should be filed if the fix is already known.

I don't think so.  This is more like contribution thread.

Offline

#3 2010-03-21 00:57:04

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: [SOLVED] Evince is unable to correctly use its dependency gsfonts

Hi herzen,

What's happening is that both programs are simply trying to call a generic font name like 'serif' or 'monospace'. If you have DejaVu, Bitstream Vera, or one of the other more complete font sets with these properties defined, it will use one of them. So having an optional dependency on one font set doesn't make sense when a number of them will suffice.

Offline

#4 2010-03-21 01:58:02

herzen
Member
From: Pennsylvania, US
Registered: 2009-10-28
Posts: 38

Re: [SOLVED] Evince is unable to correctly use its dependency gsfonts

Hi skottish,

I see. I didn't realize that there are a variety of font sets available that will do the job. So it turns out that my post was a request for assistance as opposed to a kind of bug report with solution after all.

I just looked at the beginner's guide, and it does suggest that you should install some font sets. So I guess why I ran into this problem whereas no one else seems to is that I was doing a very minimal install, without an X environment.

Offline

#5 2010-03-21 02:31:01

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: [SOLVED] Evince is unable to correctly use its dependency gsfonts

herzen wrote:

Hi skottish,

I see. I didn't realize that there are a variety of font sets available that will do the job. So it turns out that my post was a request for assistance as opposed to a kind of bug report with solution after all.

I just looked at the beginner's guide, and it does suggest that you should install some font sets. So I guess why I ran into this problem whereas no one else seems to is that I was doing a very minimal install, without an X environment.

Yeah, there are no complete font sets required for a minimal install. Bitstream Vera had been sort of the standard font on Linux distros for years and DejaVu is based on that and more. I'm somewhat disconnected with Bitstream's status in terms of getting pulled in as a dependency these days mainly because I use DejaVu everywhere in apps. 

I remember a similar discussion coming up about the ttf-ms-fonts package in regards to PDF files. If the creator of a PDF document used bitmap fonts but didn't embed them, some PDF viewers wouldn't try a workaround. So if the end user didn't have ttf-ms-fonts installed, they would see a terribly rendered set of bitmap fonts. Evince has been good for years about trying a replacement table, but the last time that I checked ePDFview didn't.

Offline

#6 2010-03-21 03:42:35

herzen
Member
From: Pennsylvania, US
Registered: 2009-10-28
Posts: 38

Re: [SOLVED] Evince is unable to correctly use its dependency gsfonts

skottish wrote:

I use DejaVu everywhere in apps. 

I remember a similar discussion coming up about the ttf-ms-fonts package in regards to PDF files.

I've installed the ttf-ms-fonts package. I'm used to the standard Adobe fonts that you get on laser printers, which I use with LaTeX; the Microsoft fonts look like them, but the DejaVu ones don't.

I still think there might be a bug here, though. If I remove both ttf-ms-fonts and ttf-dejavu, and I open a pdf file that uses Times-Roman but doesn't embed it (because it's present on PostScript laser printers) in Evince, letters get displayed nicely at any magnification (thus, a scalable font must be being used), but a boldface font is used instead of a roman font: my original problem.

I don't know how to determine what font Evince is using. But surely if the system can find a boldface scalable font, it should be able to find the roman font from the same family (which is what is required), too? Here is what "pacman -Q | grep fonts" produces:

fontsproto 2.1.0-1
gsfonts 8.11-5
xorg-fonts-alias 1.0.2-1
xorg-fonts-encodings 1.0.3-1
xorg-fonts-misc 1.0.1-1

The font Evince uses must be coming from gsfonts as far as I can tell, and that package is described as "Ghostscript standard Type1 fonts". So that package has got to have Times-Roman. So it seems to me that something is wrong either with gsfonts, or with the font system. Because I think that Evince together with gsfonts should be able to render a PDF file containing Times-Roman correctly.

Edit: I installed xpdf, and that renders the text correctly.

Times-Roman is a very standard font, and it's in gsfonts. Evidently, xpdf can get it from gsfonts, but Evince can't. So I'm pretty sure we've got a bug here. (And praise be to Arch for still making xpdf readily available!) That's especially clear since the Evince package declares gsfonts to be one of its dependencies. (Thus, the original title of this thread misrepresents the problem. So I've changed the title from the original "Evince and LyX should depend on ttf-dejavu". The dependencies are correct; they just don't work as they're supposed to.) The bug could be from upstream, though.

Last edited by herzen (2010-03-21 05:03:02)

Offline

#7 2010-03-21 05:09:07

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: [SOLVED] Evince is unable to correctly use its dependency gsfonts

I'm still not sure that we're talking about a bug or a dependency issue, although I may be wrong of course. Installed fonts do make a huge difference, which we all agree on. I was only making a point about what should be considered a dependency, optional or not. Somewhere in the freedesktop.org specification lies the generic calls to 'monospace' and 'serif'. Apps like xpdf don't, or at least didn't, care about that in part because it's far older than the specification.

Offline

#8 2010-03-21 05:35:43

herzen
Member
From: Pennsylvania, US
Registered: 2009-10-28
Posts: 38

Re: [SOLVED] Evince is unable to correctly use its dependency gsfonts

Hi skottish,

The way I'm coming at this is as an old LaTeX user. TeX came with its own fonts; soon people made it work with the standard Type1 PostScript fonts that the gsfonts package provides. If you created a TeX document that used the standard Type1 fonts, ghostscript would be able to render it, using its own fonts, those in the gsfonts package. xpdf still works that way. But Evince can't correctly render a pdf file containing only standard Type1 fonts, even though its package has as a dependency gsfonts, which provides those fonts.

I don't think this is a dependency issue any more, since the Evince package declares gsfonts to be one of its dependencies. That is a correct dependency, since that's the way it was done in the old days, before Evince came into existence. The problem is that Evince cannot use the fonts in gsfonts correctly.

If you want, I can post LaTeX files which produce pdf files using the Times-Roman and Times-Bold fonts. There is no question that such pdf files should be rendered correctly using gsfonts alone, since that is the purpose of gsfonts. But although xpdf can do that using only gsfonts, Evince cannot. That's a bug either in Evince or, more likely, in the way it gets its font information (since LyX suffers from the same problem).

Like I said, there's a good chance this bug comes from upstream. In any case, it bothers me, because in the old days, you could depend upon pdf files using only the standard Type 1 fonts to be rendered by means of gsfonts.

Offline

#9 2010-03-21 13:29:31

bt
Member
Registered: 2007-04-11
Posts: 195

Re: [SOLVED] Evince is unable to correctly use its dependency gsfonts

This may be off-base, but could the problem be that Evince does not see the appropriate fonts because the database is not up-to-date. Assuming the fonts are in a proper directory (see the wiki on fonts for specifics) if you run fc-cache -vf,  it should update the database Evince uses. I use xetex and have limited myself to open-type fonts (.otf). Evince reads and prints perfectly.

If addition I have added the following to ~/.fonts.conf

      Private font directory
-->
<dir>/usr/share/texmf-dist/fonts/opentype</dir>
<dir>/usr/share/texmf-dist/fonts/type1</dir>
<dir>/usr/local/share/texmf/fonts/type1</dir>

<!--

It may be as simple as updating you font cache.

Last edited by bt (2010-03-21 17:32:42)

Offline

#10 2010-03-21 15:41:36

brebs
Member
Registered: 2007-04-03
Posts: 3,644

Re: [SOLVED] Evince is unable to correctly use its dependency gsfonts

A bit of clarification:

Evince uses fontconfig to choose its fonts (see that URL for useful info). Firstly, run:

/usr/bin/pdffonts yourpdffile.pdf

Then consider your fontconfig rules in /etc/fonts/conf.d/ and ~/.fonts.conf

edit: This bug is a good example, relevant to this thread.

Last edited by brebs (2010-03-21 16:45:24)

Offline

#11 2010-03-21 20:00:22

herzen
Member
From: Pennsylvania, US
Registered: 2009-10-28
Posts: 38

Re: [SOLVED] Evince is unable to correctly use its dependency gsfonts

bt and brebs,

Thanks for explaining that to me. I didn't know anything about fontconfig. I guess this is an upstream bug in gsfonts and/or fontconfig. If I wanted to fix it, I evidently would have to add entries to /etc/fonts/conf.d/ or d ~/.fonts.conf, as you say. But that sounds complicated, and I have a fully acceptable workaround: installing ttf-dejavu and/or ttf-ms-fonts.

I guess the underlying problem is that other font sets like DejaVu have effectively replaced gsfonts (the URW fonts) in modern LaTeX distributions, but Evince and xpdf still have gsfonts and only gsfonts as a dependency, for historical reasons. (Oddly, the ghostscript package does not specify gsfonts as a dependency. Also, Fedora and OpenSUSE for example do not specify any font sets as a dependency for Evince, apparently.)

Offline

#12 2010-03-22 05:20:46

brebs
Member
Registered: 2007-04-03
Posts: 3,644

Re: [SOLVED] Evince is unable to correctly use its dependency gsfonts

RUN that pdffonts command, so we can balance out the idle speculation with some facts.

Offline

#13 2010-03-22 08:32:16

herzen
Member
From: Pennsylvania, US
Registered: 2009-10-28
Posts: 38

Re: [SOLVED] Evince is unable to correctly use its dependency gsfonts

I did run the pdffonts command, and I appreciated your suggestion that I try it. I didn't find it necessary to address this issue specifically, because pdffonts reported exactly what I said in my original post: Times-Roman. Anyway, here are those facts:

[arch@archbox ~]$ pdffonts pdffile.pdf
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
Times-Roman                          Type 1            no  no  no      23  0
Times-Italic                         Type 1            no  no  no      24  0
Courier                              Type 1            no  no  no      25  0
Times-Bold                           Type 1            no  no  no      34  0
MIHUPH+MTSY                          Type 1            yes yes no     108  0
JTNRKM+RMTMI                         Type 1            yes yes no     105  0
Times-Roman                          Type 1            no  no  no     397  0
[arch@archbox ~]$

The facts are that that PDF file comes from a standard TeX installation of about five years ago ("Times-Roman" is the name of that standard font that all printers that understand PostScript are aware of) and that Evince is able to render the file correctly when either ttf-dejavu or ttf-ms-fonts is installed.

So I stand by my suggestion that gsfonts should be removed as a dependency from Evince and xpdf and deprecated, given that there are now better font sets available than gsfonts, so that it is not worth bothering to fix gsfonts and/or fontconfig to work correctly with pdf files of the kind I have, since both ttf-dejavu and ttf-ms-fonts already do so.

Offline

#14 2010-03-22 09:17:30

brebs
Member
Registered: 2007-04-03
Posts: 3,644

Re: [SOLVED] Evince is unable to correctly use its dependency gsfonts

So here's an interesting test:

$ fc-match --sort "Times" | head -n7
n021003l.pfb: "Nimbus Roman No9 L" "Regular"
DejaVuSerif.ttf: "DejaVu Serif" "Book"
DejaVuSerif-Bold.ttf: "DejaVu Serif" "Bold"
DejaVuSerif-Italic.ttf: "DejaVu Serif" "Italic"
DejaVuSerif-BoldItalic.ttf: "DejaVu Serif" "Bold Italic"
times.ttf: "Times New Roman" "Normal"
luxirr.ttf: "Luxi Serif" "Regular"

The relevant rules are in /etc/fonts/conf.avail/30-metric-aliases.conf

I have n021003l.pfb in my ~/.fonts/ , placed there manually.

So, my hopefully interesting conclusion/point is that the font that evince shows is a combination of the fontconfig rules, and the actual fonts available to fontconfig.

Evince and LyX use a boldface font when they should be using a normal Roman font.

This surprises me - please show the result of that fc-match command above.

Offline

#15 2010-03-22 18:30:22

herzen
Member
From: Pennsylvania, US
Registered: 2009-10-28
Posts: 38

Re: [SOLVED] Evince is unable to correctly use its dependency gsfonts

fc-match: now that looks like a useful program for this situation.

$ fc-match --sort "Times" | head -n7
n021004l.pfb: "Nimbus Roman No9 L" "Medium"
n021003l.pfb: "Nimbus Roman No9 L" "Regular"
d050000l.pfb: "Dingbats" "Regular"
s050000l.pfb: "Standard Symbols L" "Regular"
12x13ja.pcf.gz: "Fixed" "ja"
6x12-ISO8859-1.pcf.gz: "Fixed" "SemiCondensed"
6x12.pcf.gz: "Fixed" "SemiCondensed"

It appears that Medium is the Nimbus Roman name for bold. Executing the command with "Times-Roman" instead of "Times" produces the same results.

I have n021004l.pfb and n021003l.pfb in /usr/share/fonts/Type1, which is where the gsfonts package places them.

Please note that this is with a fresh install into VirtualBox that I did to troubleshoot what was going on in my Arch installation into a Solaris branded zone. (Since the support of Arch by Solaris BrandZ is experimental, I was uncertain whether the trouble was being caused by Arch or by BrandZ.)

When I install ttf-dejavu (the "solution" I give in my original post), here is what happens:

$ fc-match --sort "Times" | head -n7
DejaVuSerif.ttf: "DejaVu Serif" "Book"
DejaVuSerif-Bold.ttf: "DejaVu Serif" "Bold"
DejaVuSerif-Italic.ttf: "DejaVu Serif" "Italic"
DejaVuSerif-BoldItalic.ttf: "DejaVu Serif" "Bold Italic"
n021004l.pfb: "Nimbus Roman No9 L" "Medium"
DejaVuSans.ttf: "DejaVu Sans" "Book"
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"

Sorry, as you can gather, I know virtually nothing about fonts in Linux, so I can't figure out where the problem is. It appears that your system and mine have different fontconfig rules, since "Nimbus Roman No9 L" "Medium" comes up at the top for me, but doesn't come up at all for you. As I said, I have an (up-to-date) fresh install, and I obviously have not specified any fontconfig rules myself.

Look at what I just found: FS#10593 - [gsfonts] Nimbus Roman No9 L always appears bold. That's almost two years old.

Offline

#16 2010-03-22 20:07:35

brebs
Member
Registered: 2007-04-03
Posts: 3,644

Re: [SOLVED] Evince is unable to correctly use its dependency gsfonts

herzen wrote:

your system and mine have different fontconfig rules

I'm an ex-Arch user, currently running Lunar with my own fontconfig which includes Ubuntu's patches for better LCD rendering.

I'm a bit surprised that the differences would affect the subject of this thread, so let's do a bit of checking...

Here's a pastebin of my /etc/fonts/conf.d/30-urw-aliases.conf ...

Aha! Check comment 16 on the freedesktop bug, which links to Gentoo, which links to Fedora.

So I suggest you grab n021003l.* from urw-fonts Fedora rpm and compare it to your two n021003l files. Hopefully they fix the problem, meaning that the problem is with the font files, rather than fontconfig or its rules, after all.

Last edited by brebs (2010-03-22 20:08:19)

Offline

#17 2010-03-22 21:28:14

herzen
Member
From: Pennsylvania, US
Registered: 2009-10-28
Posts: 38

Re: [SOLVED] Evince is unable to correctly use its dependency gsfonts

brebs,

That works! Thanks so much for all your help. You've solved a bug whose bug report page states "Not sure how we can fix this issue." I'll mention this fix there.

By the way, I copied all the pfb and afm files, because when I copied just n021003l, there was still a problem with italics roman showing up as italics bold. Also, I had to run fc-cache -vf.

Cheers,
herzen

Offline

Board footer

Powered by FluxBB