[poppler] Scaling factor and placement accuracy

Thomas Freitag thomas.freitag.bbr at gmail.com
Mon Mar 27 10:17:41 UTC 2017


This problem is not solvable, at least not completely:

1. You draw a stave with graphical operators
2. You draw stave notes as glyphs of a font.
3. You render it to an image with in this case much too low resolution 
(141.146 dpi)

So we have here either splash or cairo (for drawing the stave) and 
freetype (for drawing the glyphs) which draw it to an image without 
having pixel boundaries.

This problem was discussed a lot of times also in the bug reports, s. 
i.e. https://bugs.freedesktop.org/show_bug.cgi?id=37347

If anyone is able to develop a pixel scissors I would take a deeper look 
into it (and would nominate him to get a Nobel Prize J ), in the 
meantime I would advice to take a much higher resolution when render it 
to an image (at least 300 dpi)

Cheers,
Thomas

Am 26.03.2017 um 22:11 schrieb William Bader:
>
> When I open the test PDF in atril (the Mate desktop version of evince) 
> and change the window size (with 'fit page width'), once I get below 
> about 80%, small changes make the bars of the staff go up and down, 
> and not all of the bars of the staff shift equally, so the space 
> between the bars is not equal, and that might contribute to the effect 
> that the notes are misplaced. I am not sure, but it seems as if it is 
> not antialiasing the bars. When you reduce the image to the point 
> where pixels are significant and the total number of pixels is not the 
> exact amount to leave the same number of pixels between each bar, 
> rounding can't create more pixels. You need to simulate fractional 
> pixels through antialiasing. The 'w' command in PDF sets the line 
> width. It looks like it is drawing lines of 0.4, 0.65, 0.8, and 1 
> point. The tests for thinLineMode are in splash/Splash.cc.
>
>
> William
>
>
> ------------------------------------------------------------------------
> *From:* poppler <poppler-bounces at lists.freedesktop.org> on behalf of 
> pqt at LEFerguson.com <pqt at LEFerguson.com>
> *Sent:* Sunday, March 26, 2017 12:34 PM
> *To:* Albert Astals Cid; poppler at lists.freedesktop.org
> *Subject:* Re: [poppler] Scaling factor and placement accuracy
> >> ourParent->document->setRenderHint(Poppler::Document::Antialiasing);
> >> ourParent->document->setRenderHint(Poppler::Document::TextAntialiasing
> >>ourParent->document->setRenderHint(Poppler::Document::ThinLineSolid);
>
> >Tried thin line shape instead of thing line solid?
>
> Thanks, Albert, I just tried it, same result.
>
> I spent a couple hours last night trying to find the area of code that 
> does the actual placement without any real luck, to see if there is 
> any kind of rounding issue.   I saw a lot of other possible areas like 
> anti-aliasing, but basically got lost in the code because I don't know 
> enough to know what is actually inside the PDF (I tried 
> PDFStreamDumper and can see what's inside, and even seeing it I do not 
> understand it).
>
> So far making the x/y scale factor integral appears to avoid the 
> problem; it's hard to prove a negative, but I have not seen it occur 
> in that case. This just very slightly throws off the desired size I 
> want, and I just needed to put a proper color border into the overall 
> page to avoid showing an outline, so it's very workable for what I 
> want, if it keeps working.
>
> Thanks again,
>
> Linwood
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/poppler
> poppler Info Page - freedesktop.org 
> <https://lists.freedesktop.org/mailman/listinfo/poppler>
> lists.freedesktop.org
> Subscribing to poppler: Subscribe to poppler by filling out the 
> following form. You will be sent email requesting confirmation, to 
> prevent others from ...
>
>
>
>
>
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/poppler


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/poppler/attachments/20170327/3a1cfc0d/attachment-0001.html>


More information about the poppler mailing list