At 02.02.2014 02:28, Octavio Alvarez wrote:
On 02/01/2014 02:14 PM, Octavio Alvarez wrote:* Considering that the only difference between cairo-pdf and cairo-alpha-png is the cairo_*_surface_create() call and that cairosimple also renders to a PNG file, I considered cairosimple should failed too, so I compiled and cairosimple. Text rendered correctly.I must correct myself. I think I have some useful information. After reading bug #341481 [1] (pango), I modified cairosimple, the example from Pango docs, to use a tweakable cairo_scale(). I attach the resulting code. Here's how to use it: [1] https://bugzilla.gnome.org/show_bug.cgi?id=341481 Compile it with: gcc -o cairosimple-scale cairosimple-scale.c \ `pkg-config --cflags --libs pangocairo` -lm Run it with: ./cairosimple-scale test-output.png ... and check test-output.png with eog or your favorite visualizer.
The new Pango bug is https://bugzilla.gnome.org/show_bug.cgi?id=700592
[...]
>
When debugging I changed DIAG_NOTES to fprintf(stderr, ...) because I didn't know how to enable DIAG_NOTES and added some extras.
Please look into diacairo.h for the intended definition.
Thanks for the analysis. I tend to agree although I think it could be fixed completely on the Pango side. But patching Dia is easier for me ;-)I noticed pango_font_description_set_absolute_size() was being called with a value of 866. Curiously enough, in the default cairosimple, it must be called with about 27 * PANGO_SCALE * DPI / 72.0 where PANGO_SCALE == 1024 and DPI == 96, so about 36,000 to get the an equivalent font size. This means a value of 866 would be the equivalent of 0.6 points. This results in a big precision loss. So, even though the Pango team clearly has to fix some calculations to do, Dia also has to find the way to scale back to better font sizes.
The attached patch basically does a mix of the two. But only for fonts/text to avoid the huge modification otherwise required.I'm not sure my interpretation of the tests are correct, but if they are, the options for fix/workaround for Dia are: If there is another internal rendering scaling multiplier, it will be simpler: to adjust cairo_scale() to bring it back to better values and use the internal multiplier to adjust the actual sizes of the objects to render. If there is not, an implementation of it is in order, but this could horribly require to modify each rendering calculation, like the TWEAKABLE_SCALE technique.
Thanks again for the analysis. I'll commit the patch to master as soon as I've tested it on Linux with Pango > 1.32I gave it a shot, modifying renderer->scale at diacairo.c:165 but the image just increases in DPI. Font size is still called with absolute size of 866. So, no sucess yet.
Hans -------- Hans "at" Breuer "dot" Org ----------- Tell me what you need, and I'll tell you how to get along without it. -- Dilbert
Attachment:
pango-kerning-bug.diff
Description: Text document