Poor font rendering in okular

Bug #48146 reported by Logan Lewis
58
This bug affects 6 people
Affects Status Importance Assigned to Milestone
poppler (Ubuntu)
Confirmed
Low
Unassigned
Nominated for Karmic by reini

Bug Description

Binary package hint: kpdf

For Kubuntu 6.06 and 5.10 (can't speak for earlier releases), kpdf font rendering is of poor quality. Strangely, xpdf renders the same document at the same zoom level much better. The text in kpdf is still readable, but some characters will seem more "bold" than others, and overall it just isn't as readable when zoomed out.

I've also compared screenshots of the rendering with that done by kpdf under FC4, which looks much better. I'm really puzzled about what the cause of the difference might be. I found some old bugs in the KDE repository a few months ago that indicated an old version of truetype was causing some more severe rendering problems, but this particular issue persists in Kubuntu 6.06. I also considered that it might be a font server at work in Fedora, but that doesn't explain why xpdf would render properly.

For reference, I was using the nvidia binary driver under both Kubuntu and FC4, and the FC4 install has used KDE 3.4 and 3.5, none of which exhibited a rendering problem.

I'd be happy to provide screenshots or do other testing.

Revision history for this message
Frode M. Døving (frode) wrote :

Could this be related to the kpdf poppler patches?

Revision history for this message
Logan Lewis (lkubuntu) wrote :

This font problem in kpdf persists even in 6.10. Some files are probably worse than others, but a very simple PDFLaTeX generated file will demonstrate the problem. The more the document is zoomed out, the worse the effect.

See http://www.proxc.com/kpdf/ for 4 files - a test pdf file, and screenshots at 150% for kpdf in Kubuntu 6.10 and FC6 and xpdf in Kubuntu 6.10. The differences are smaller at this zoom level, but still very noticeable (especially lower case i's).

Revision history for this message
Olaf (john-robinson) wrote :

I can confirm this on two installations of Feisty. The images provided by Logan Lewis in the link above are representative for the (poor) quality of rendering provided by kpdf on 7.04. On SuSE 9.3 and PCLinuxOS 2004 & 2004 kpdf-rendered documents look much like the FC6 image provided by Logan (i.e. significantly better than on Feisty). I have also used the nvidia properietary binary driver for all comparisons.

Revision history for this message
Logan Lewis (lkubuntu) wrote :

I'd just like to add that that this occurs on more than the nvidia binary driver. I'm running Feisty on a laptop with Intel graphics (955 chipset) running the i810 driver. PDF rendering via kpdf is still poor on this setup.

Revision history for this message
Stephen (smagill) wrote :

I can also confirm this bug. I am using Ubuntu Feisty and an ATI card with the proprietary fglrx driver.

Revision history for this message
D. Brodzik (amyrose) wrote :

Well, the kpdf devs told me they just made it incompatible with poppler for this reason. Upgrading to KDE 3.5.7 on Feisty gets rid of the problem.

Revision history for this message
jinn (asil-jinn) wrote :

Running latest kde 3.5.7 stuff in Archlinux.. same problem. acroread works just fine..

Revision history for this message
Logan Lewis (lkubuntu) wrote :

I just upgraded to Gutsy and the rendering is still poor. I haven't done a side by side comparison to see if it was better than Feisty (it might be slightly better), but it still looks inferior to kpdf on FC6, for example.

I should note that kdvi on a file generated by LaTeX file looks great (and has all along), by comparison. Is anyone familiar with how these fonts (and graphics) are getting rendered by kpdf relative to other distributions?

Revision history for this message
Harald Sitter (apachelogger) wrote :

After having 4 people look at the screenshots the only thing we noticed for sure is that Kubuntu uses a different font than the xpdf and fedora screenshot of comment #2.
I tried the provided test PDF in Okular (KPDF replacement) and can honestly say it renders quite well.

Thank you for spending some time to help us improve the user experience in Kubuntu. :-)

Changed in kdegraphics:
status: New → Fix Released
Revision history for this message
Logan Lewis (lkubuntu) wrote :

Harald,

Thanks for looking at this. I'm not sure i understand your comment about using different fonts - the document has the font (Computer Modern, the default LaTeX font) embedded in the file. I'm no typographer, but the font itself is identical to me between those screenshots; the difference is in the font hinting/rendering.

I just compared Okular to the kpdf on Kubuntu screenshot and the font rendering is identical, and still suboptimal. The test file may not be ideal, but you can see on the "6.06" how the 6 is just isn't as readable as it is rendered in xpdf or Fedora. I can try to find a test file which demonstrates the problem more distinctly, but unfortunately many I've come across have been journal articles for which I have no permission to redistribute.

Thanks again for your time.

Revision history for this message
Jeremy (crisjss) wrote :

Hi,

I made a simple test case.

In the attachment there are two latex files:

- "example1.tex" uses Latin Modern font (the new standard font in LaTeX);
- "example2.tex" uses Computer Modern.

In the attachment there are also two folders with pdfs created in openSuse 10.2 and kubuntu 8.04, and a folder with screenshots of pdf renders in openSuse 11.

By what I have seen the problem is always equal between kpdf and okular.

The pdfs created in opensuse 10.2 are better than the ones created in kubuntu, when they are rendered in kubuntu. But, both are equal and much better rendered when viewed in openSuse 10.2 .
So there are differences about where the pdf is created and where it is rendered.

The pdfs created and rendered in openSuse 11 have the same problem of the kubuntu ones.

One thing I had remember is that openSuse 10.2 has tetex and kubuntu, as openSuse 11, has texlive TeX distributions.

All the pdfs have equal quality when viewed in other programs.

I hope someone finds the problem cause, and the solution, soon.

Thank you all,
Cristóvão Sousa

Revision history for this message
Jeremy (crisjss) wrote :

I forget to say that:

- the problem is worse at 150% zoom;
- the problem is much worse when using Latin Modern fonts;
- to compile just do "pdflatex exampleX.tex".

Cristóvão Sousa (Jeremy)

Logan Lewis (lkubuntu)
Changed in kdegraphics:
status: Fix Released → New
Revision history for this message
Thomas Zell (tz-thp) wrote :

I do not believe, that Jeremys example has anything to do with the bug filed here.

However, I do experience the bug described by Jeremy. I suggest to move his example to a new bug report. For this report I have one additional contribution: You can can get an equally bad rendering in xpdf if you type:
xpdf -t1lib no

Revision history for this message
Sergei Ivanov (svivanov) wrote :

I observe this bug too, both in kpdf (hardy) and okular (intrepid).
Rendering is especially bad for Cyrillic fonts in pdfs generated by TeX
(I guess this is because these fonts are bitmapped) but the problem
is visible with latin fonts too. This bug annoyed me for a long time and
I spent some time investigating it (with KDE3 on hardy)

Rendering is good in Opensuse 10.3 and in Fedora 8. I narrowed the difference
down to the file /usr/lib/kde3/libkpdfpart.so. Copying this file from Fedora to Ubuntu
fixes the problem.

I thought that the difference is due to compile-time options or patches but
this is not the case. I compiled kdegraphics-3.5.10 (the upstream source
with no patches) via 'configure && make' on the two systems.
On Fedora, this compilation produced a good binary. On Ubuntu, it produced a bad binary.
(The binaries were tested by copying the file libkpdfpart.so to the Ubuntu system
and running kpdf, so it's not a matter of not having some library in the system).

I am trying to investigate the issue futher. Does anyone know what can possibly cause
this surprising effect?

Revision history for this message
Sergei Ivanov (svivanov) wrote :

I fond the origin of the problem and a solution. The rendering propblem occurs when you have all of the following:

1. TrueType bytecode interpreter enabled in the freetype library. (This is a compile-time option which is off by default due to patent issues, Ubuntu turns it on while Fedora does not.)

2. Kpdf using anti-aliasing. (No idea where this is configured, maybe from the global KDE setting).

3. A pdf file with embedded bitmapped (or maybe any non-TrueType) fonts. This is typical for pdfs generated by TeX.

When all of this happens, kpdf uses its own (or KDE's) anti-aliasing *and* freetype's autohinting. Each of the features is supposed to improve the view but their combination works poorly.

A solution is to turn off the check for bytecode interpreter in kpdf. On Ubuntu, this piece of code actually lives in libpoppler which is a separate package. The attached patch to poppler fixes the problem for me. I don't know if it breaks something else. I checked evince and it does not seem to be affected.

The same file is present in kpdf source. It should be patched there if kpdf is compiled without poppler.

Revision history for this message
ViktigLemma (jorgsk) wrote :

Is this also the cause of the poor fonts I get in Okular with my tex-generated documents? If not I will start another bug thread.

If it is, I wonder what file I should apply the patch to. I don't have the SplashFTFont.cc file. I'm using Ubuntu and Gnome.

Revision history for this message
Sergei Ivanov (svivanov) wrote : Re: [Bug 48146] Re: Poor font rendering in kpdf

> Is this also the cause of the poor fonts I get in Okular with my tex-
> generated documents? If not I will start another bug thread.

I did not test the patch with okular, I'm still using KDE3.

> If it is, I wonder what file I should apply the patch to. I don't have
> the SplashFTFont.cc file. I'm using Ubuntu and Gnome.

It's in another package named poppler (it is a library that kpdf and okular use).

Revision history for this message
Diego (diego-guadagnoli) wrote : Re: Poor font rendering in kpdf

I have kubuntu 9.04 on a 64bit machine.
I have a similar problem as above of bad font rendering with okular.
I need a quite large zoom factor in order to read the text decently.

With acrobat reader the font rendering can be improved through
Preferences/Page Display and selecting Smooth Text
for Laptops / LCD screens. In this way the text is much better readable.

Please compare the two screenshots in attachment, that show acroread
vs okular rendering performances.

Allowing subpixel rendering in KDE 4 System Settings doesn't seem to
do the trick in okular. Any hints?

Revision history for this message
Diego (diego-guadagnoli) wrote :

Sorry, here's the corresponding snapshot for acroread...

Revision history for this message
reini (rrumberger) wrote :

Seems that there is enough evidence of this bug to mark it as confirmed.

Changed in kdegraphics (Ubuntu):
status: New → Confirmed
summary: - Poor font rendering in kpdf
+ Poor font rendering in okular
Revision history for this message
Jonathan Thomas (echidnaman) wrote :

This would be a bug in poppler, the PDF renderer that Okular uses.

affects: kdegraphics (Ubuntu) → poppler (Ubuntu)
Changed in poppler (Ubuntu):
importance: Medium → Low
Revision history for this message
ssameer (ssameer) wrote :

To get around this issue in pdfs produced from Latex files, use TrueType fonts, as Sergei Ivanov pointed out.
\usepackage[T1]{fontenc}
in the preamble should do the job.

Revision history for this message
Diego (diego-guadagnoli) wrote :

Hi,

thanks for the tip. In attachment the screenshot of a tex document
with vs without the \usepackage[T1]{fontenc} line.

Unfortunately, I would say quality is comparable on okular: while TrueType
fonts are indeed slightly sharper, they look a bit "irregular" with
respect to the other case (e.g. look at the words "Review" and "Physics"
in ref. [7] of the document).

In addition TrueType fonts look pretty strange if I open the same document
with Acroread...

D

Revision history for this message
Diego (diego-guadagnoli) wrote :

... and here the second attachment.
(Is there no way to attach more than one file in a single comment?)

Revision history for this message
Theq (thekju) wrote :

Wow this goes for a long time now, anyway still same bug in Okular 0.9 from KDE 4.3.

Revision history for this message
Theq (thekju) wrote :

ah forgot to add, evince on the left, okular on the right. As a work around I use evince since kpdf ;)

Revision history for this message
Diego (panda84) wrote :

Take a look at this patch:
http://bjacob.livejournal.com/10641.html

Revision history for this message
Stephan Burkhardt (oceanofsolaris) wrote :

I don't know whether the patch Diego mentions leads to regressions in any cases, but if it doesn't, I would propose backporting it also to jaunty. The reason is, that this simply makes okular look terrible with certain documents and thus gives a very bad impression of kubuntu. The patch seems pretty simple (only three lines) and should therefore be easy to apply.

Revision history for this message
Diego (diego-guadagnoli) wrote :

Just wanted to say that I just updated my kubuntu 9.04 (64bit), because there were some
poppler patches. Well, now okular just crashes after opening pdf files. The KDE Crash
handler is unable to create a valid backtrace for this bug.

Fortunately evince works, and has better font rendering.

Needless to say, all this doesn't help my enthusiasm for KDE.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Related questions

Remote bug watches

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