[Okular-devel] [PATCH] Fix rendering of DVI documents

Benoit Jacob jacob.benoit.1 at gmail.com
Sat Oct 3 00:27:53 CEST 2009


2009/10/2 Albert Astals Cid <aacid at kde.org>:
> A Divendres, 2 d'octubre de 2009, Benoit Jacob va escriure:
>> 2009/10/2 Albert Astals Cid <aacid at kde.org>:
>> > A Divendres, 2 d'octubre de 2009, Benoit Jacob va escriure:
>> >> Hi List,
>> >>
>> >> I noticed that the rendering of DVI documents was broken exactly in
>> >> the same way as what I observed with PDF documents, namely, it used
>> >> auto-hinting which looks especially bad with TeX fonts.
>> >>
>> >> Attached is a 1-line patch that changes it. I need your permission to
>> >>  commit.
>> >>
>> >> Screenshots:
>> >> * original :
>> >>  http://picasaweb.google.ca/lh/photo/fry54ANy23UesNpFhbWanA?feat=directl
>> >>ink * fixed :
>> >>  http://picasaweb.google.ca/lh/photo/OjQIZ7Of6wP74k7fKUwXTw?feat=directl
>> >>ink
>> >>
>> >> Here are some comments before one objects that disabling hinting is
>> >> just a matter of taste, etc.
>> >>
>> >> First, it's obvious that the "original" screenshot linked above is
>> >> horrible and that the "fixed" is the one that looks good.
>> >>
>> >> Second, it is a consensus on the Poppler/PDF side that one should use
>> >> no hinting, and then, there's no reason why DVI should be any
>> >> different. To summarize the situation on the PDF side:
>> >> * poppler/cairo (hence Evince) 's code completely disables hinting
>> >> * poppler/splash (hence Okular) 's code _meant_ to completely disable
>> >> hinting (actually only auto-hinting, but in the context of DVI that's
>> >> really the same because almost all DVI files use Type 1 fonts, and
>> >> bytecode only exists in TrueType fonts). It was a clear bug in the
>> >> code, where it was clear that the code didn't do what it intended,
>> >> that resulted in hinted fonts being used.
>> >>
>> >> Third, the old KDVI used to not do any hinting, I'm completely sure of
>> >> that because I've spent hundreds of hours looking at documents in it.
>> >> I remember distinctly the (imho beautiful) slightly fuzzy look of the
>> >> TeX fonts in it, that is characteristic of non-hinted text, although
>> >> at that time I didn't know about hinting. That said, I used "svn
>> >> annotate" to see who enabled hinting in the C++ code, and it turns out
>> >> to be Stefan Kebekus himself in an old revision (240000-something). I
>> >> am puzzled about that, but I still maintain that KDVI didn't use
>> >> hinting on all the Linux systems that I tried. My best guess is that
>> >> Stefan Kebekus _thought_ that he had enabled hinting but for some
>> >> reason it wasn't used. I haven't investigated further as this is quite
>> >> intricate, and of course I only have Okular's code at hand, I haven't
>> >> looked at the actual KDVI code.
>> >>
>> >> OK to commit?
>> >
>> > No, actually what it is clear that *you* don't like hinting, and you have
>> > a certain amount of followers, the problem is that typically people that
>> > is happy with a setting is not much active defending it because they are
>> > happy in their sofas.
>>
>> Come on. There's no way at all that the "original" screenshot that I
>> posted could be satisfactory. Look at the letters, they border on
>> unreadable. The e look like c, etc.
>>
>> There is no way that that screenshot can be acceptable.
>>
>> It's not a matter of liking hinting or not. I'm just saying that that
>> particular screenshot should not happen.
>>
>> Thus, what we have here is a BUG. I'd like you to acknowledge that.
>
> No.
> I acknowledge hinting produces bad results in that file

Good. And Okular forces the use of hinting, hence Okular produces bad
results in that file.

> I acknowledge you think hinting make all files look ugly

No, I never said that.

For DVI: I said that hinting makes almost all DVI files look ugly,
that's for sure. Again, here we're talking about DVI, that's a very
special case.

For non-DVI: that's not the topic here. I said in *another* thread
that hinting makes some non-DVI files look ugly, but i didn't say all
files. Nevertheless, I said that hinting should be disabled, but that,
again, is another thread, on Poppler, and I won't repeat the arguments
here.

> I know some people like to have hinting in their fonts

In their ___TeX___ fonts ?

Again here we're talking about DVI files. We're talking about TeX
fonts. And specifically, the default TeX font. Which is used in a
large majority of TeX documents.

>> There's nothing wrong about having bugs.
>
> I know, i fix a lot of bugs, have a look at
> http://poppler.freedesktop.org/releases.html at least the half of the bug
> fixes are mind. Actually it's almost the only thing i do lately, so don't
> accuse me of not accepting bugs.

Great, actually, like everyone, I know that you are a major KDE and
Poppler developer and as such you fix a lot of bugs. I never said the
opposite. I said that you fail to acknowledge _this_ bug.

It doesn't matter anymore, since you agreed to add an option and to
default to no hinting.

>
>> The next question is how to fix that bug. When I first suggested that
>> it could be caused by auto-hinting, you told me that there was no
>> reason why I should claim that, since I was no expert. Fair enough.
>> Then here I come, making a patch to disable hinting, and bingo!
>> Suddenly the bug appears fixed.
>>
>> Conclusion:
>>
>> At least of THAT PARTICULAR font, hinting was a bad thing --- it was
>> the cause of the bug.
>
> Agreed

Good

>> Now if this were a PDF document, one could still say, hey! But just
>> because that particular font looks bad with hinting, doesn't mean that
>> all fonts will! Well, even with that, Poppler/Cairo is still disabling
>> hinting and Poppler/Splash still _meant_ to disable auto-hinting. ( By
>> the way you never addressed this point. )
>
> Which point? Poppler/Cairo disabling hinting? Or Poppler/Splash patch?

The fact that both Poppler/Cairo AND Poppler/Squash meant to disable
auto-hinting, hence it should have been considered a consensus from
the onset that Poppler disables auto-hinting, period.

It is only because of a plain bug in the code (introduced long ago and
NOT by you) that Poppler/Squash did not disable auto-hinting. That
never was the intended behavior. Again, the bug was that a feature of
the runtime configuration and of the font was trying to be detected
from a preprocessor #define, which wasn't the right thing to test for.

>> But here we're not talking about PDF documents, we're talking about
>> DVI, and there it's even 100x more of a no-brainer.
>>
>> Because DVI documents, ultimately, are all generated by TeX or PDFTeX,
>> using TeX fonts. And there aren't too many TeX fonts, almost everybody
>> uses the standard fonts that are Roman, Computer Modern, and Times.
>>
>> That's just 3 fonts to check and I already checked one for you. The
>> _default_ one (on modern tex distros), i.e., I think, Computer Modern.
>>
>> Feel free to check the 2 other ones, but I won't waste more time,
>> because the truth is that, out of the dozens of DVI documents that I
>> tried, NONE looked good in Okular.
>
> Given your taste.
>
> Tastes are like colours, everyone has a favourite one.

Ah, great. Then, since again we're talking about DVI here, I'll test
the most recent articles on arXiv.org in various domains, and post
screenshots here. You'll be the judge.

>
> Though lots of people like the taste of lobster and not much the taste of
> kidneys. And that's why we provide configuration options and try to find the
> lobster to set it as default.

OK, we're making some progress here.

>
>> > My suggestion is adding a configuration option that lets the user choose
>> > between "No Hinting", "Hinting" and "Hinting as set in KDE settings". For
>> > KDE 4.3.x we can add it, it set in "Hinting" and the only configuration
>> > option will be thought non GUI as we can't add translatable texts. For
>> > KDE 4.4.x we can default to "No Hinting" if others here (basically Pino,
>> > Brad, Tokoe) agree.
>>
>> As long as "no hinting" is the default, I am happy. This is useless
>> for DVI but may be useful for PDF, for the reasons explained above.
>
> Exact

OK

>
>> You run no risk of getting hordes of angry users slamming you for
>> this. For if you had any exposure to potential angry users, you would
>> already have been slammed quite a bit by the users who are unhappy
>> about the current state of Okular. I mean, Okular currently messes the
>> rendering of, say, all DVI files (unconditionally) and perhaps half of
>> PDF files (at least on Ubuntu and openSUSE).
>
> I have experienced both, i won't bother seraching and giving you the addresses
> but i have received mails from people saying:
>  * I want subpixel hinting and you are a useless man for not programming it
>  * I don't want subpixel hinting and you are a useless man for not removing it
> (even we don't do subpixel hinting)
>  * I want hinting and you are a useless man for not programming it (even it
> seems it's enabled)
>  * I do not want hinting and you are a useless man for not programming it

First, the situation is NOT symmetrical. Hinting is not a neutral
choice, like choosing between the color blue and red. Hinting is the
solution that adds extra complexity and requires extra code.

Second, what my screenshots really show is bugs in the auto-hinter.
When you look at the first word, "ABSTRACT", and the top of the
letters are at different heights, well that's a bug.

So, to users who demand hinting, you could just have said: good that
hinting works for you, but it is completely broken in other cases, so
we can't make it default.

> So yes, i've received quite a lot of hate mail regarding this issue and the
> tone of your mails isn't really helping much.

I've only started being defensive in my 2 last emails. Before that,
the tone of my mails was 100% friendly. You, on the other hand, have
aggressed me ever since your first reply on kde-devel.

>
> So to recap:
>  * No Hinting is the default for 4.4 and the setting can be changed via the
> GUI
>  * Hinting is the default for 4.4.3 and the setting can't be changed via the
> GUI

Good.

>
> Do you agree on that or you prefer to continue with the flaming?

I agree with that.

I hate having entered in a flamewar with you and I don't want this to
come off as a bad experience for either of us.

Benoit


More information about the Okular-devel mailing list