AuburnSounds / printed

Generate PDF/SVG/HTML with D, with a Canvas-style API. Now with a flow document emitter.
36 stars 7 forks source link

Arsd-official conflict #22

Closed drug007 closed 4 years ago

drug007 commented 5 years ago

importing of arsd-official:nanovega makes printed to print blank pages only. Tested under Ubuntu 18.04

p0nce commented 5 years ago

Hello,

Did not managed to reproduce using the simple example, with:

"arsd-official:nanovega": "~>4.0"

as dependency and importarsd.nanovega`. Can you provide a sample project? What's your PDF reader ?

Does it work without nanovega ?

drug007 commented 5 years ago

Could you try example/treeview from nanogui? No need for the whole nanogui, you can copy only example/treeview to test. In the current state the pdf file I get is blank, if I comment dependency on arsd in dub.sdl then the pdf file is correct

p0nce commented 5 years ago

Using your example I get a correct PDF with or without the nanovega line.

Please post the empty PDF so that we could discard a different reader as potential problem. Btw I think you need to depend on printed:canvas instead of printed, but that isn't the problem of course

drug007 commented 5 years ago

Yes, obviously it is my local problem, I can't reproduce it using another box. I'll upload the incorrect pdf later.

drug007 commented 5 years ago

incorrect output.pdf correct output.pdf

p0nce commented 5 years ago

OK it should indeed generate the same PDF whether nanovega is included or not. Let's see what the diff says...

p0nce commented 5 years ago

Super fun bug actually: it seems it uses a different routine for converting numbers.

incorrect.pdf

4 0 obj<</Length 5 0 R>>stream
2,834650 0,000000 0,000000 -2,834650 0,000000 841,891052 cm q 1,000000 0,000000 0,000000 1,000000 5,000000 25,000000 cm BT/F0 3,880556 Tf 0,000000 -0,000000 Td q 1,000000 0,000000 0,000000 -1,000000 0,000000 0,000000 cm

vs

correct.pdf

4 0 obj<</Length 5 0 R>>stream
2.83465 0 0 -2.83465 0 841.891052 cm q 1 0 0 1 5 25 cm BT/F0 3.880556 Tf 0 -0 Td q 1 0 0 -1 0 0 cm

And it's like that throughout the PDF file, which does not end well.

That's why a bit of everything is wrong, and I'm really surprised some PDF reader parse it at all... it's just very wrong.

p0nce commented 5 years ago

So it means nanovega changes the locale and it changes sprintf behaviour! https://stackoverflow.com/questions/27562647/c-which-locale-is-considered-by-sprintf

p0nce commented 5 years ago

Hello @drug007 this should be fixed with v0.0.12 . Could you please check?

drug007 commented 4 years ago

Yes, it is fixed in v0.0.12. The reason is that in Russian locale decimal separator is comma, not point. In French decimal separator is comma too, as I know (by googling)?

p0nce commented 4 years ago

Yes but still I didn't manage to reproduce a format or sprintf with a comma. Re-opened because SVG has many times the same bug.

drug007 commented 4 years ago

I think the following should reproduce the bug:

sudo locale-gen ru_RU.UTF-8 # generate locale where decimal separator is comma, not point
LC_NUMERIC=ru_RU.UTF8   # enable the generated locale for numbers
p0nce commented 4 years ago

Fixed for SVG and HTML in v0.0.13