-
Notifications
You must be signed in to change notification settings - Fork 823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text spaciing changes on export to PDF #1390
Comments
Do you know if this only affects text objects, or does it affect other objects such as images and latex? |
I only noticed with text, it came up because I was typing data into a PDF. |
This may be caused by changing DPI scaling without restarting the application. Does this occur if you open Xournal++, load the file, and then export the PDF without changing DPI settings? Edit: we should either warn users to restart or make a restart unnecessary. |
I've repeated it now, using latest master Same issue persists. I created this without any modifications of DPI: simply opened x++, drew two lines, added text so that it's on either side of the lines, and then exported to PDF. |
See attached. Image seems OK, text still odd. Confusingly, it worked OK the first time I tried it, then I rebooted and created a new file (which has original issue) Here's the time it worked OK, in case you can diagnose something from that: |
Same problem here: Don't know why, but the I think the text changes his stretching/size and the drawing stays the same. By the way: Thanks for this amazing free software! |
I see the same behavior. (xournalpp built from GitHub master at 86aa7e5, Fedora 29, x86_64) With a PDF background in xournalpp and added (and scaled) Text (in light blue): |
Currently the way to get the least difference between xopp-file text spacing and exported pdf-file text spacing can be obtained by increasing the font size in small steps inside Xournal++ such that the line spacing remains exactly the same in the xopp-file (while the horizontal space it takes increases), but increases in the exported pdf. For example Sans Regular 20, 20.1, 20.2, 20.3, 20.4 up to 20.47 are all perfectly aligned to the lines of the Ruled background in the xopp-file. In the export Sans Regular 20 has quite a bit smaller line spacing, whereas Sans Regular 20.47 is almost aligned to the lines. See here: To reproduce: |
I'm somewhat confused by this report. There is:
|
The relation is as follows: The vertical line spacing is correct onscreen when using pango_layout_set_line_spacing(layout, 1.0); (which is only available in pango>=1.44). However using it would introduce a new bug where empty lines don't contribute to the text height. About the horizontal spacing I'm not sure how that is related. That would have to be checked again with different pango versions. |
That's the part I understood... I even looked at the pango code and scratched my head, wondering how other programs use it to produce reliable text layout.
So it's not clear if it's related, but the "view on screen" codepath uses a different library from the "export to PDF" codepath, right? (Just trying to see if I can help with any release blockers.) |
Both "view on screen" and "export to PDF" use |
So, the 20pt xopp in At 20.47pt xournalpp view and PNG look exactly the same as at 20pt (in terms of line spacing), whereas SVG and PDF almost line up with the paper ruling now. Somehow, some of these codepaths must involve setting the line spacing to the natural line spacing for the font whereas others use a default line spacing. Also, onscreen, the line spacing "jumps" if you go from 19.99 to 20. I tend to think there is some hidden float to int and back at play... |
Related issue: https://gitlab.freedesktop.org/cairo/cairo/-/issues/426 (referring to https://gitlab.gnome.org/GNOME/pango/-/issues/506) |
Fixed by PR #2182. |
Affects versions :
Describe the bug
The spacing of text entered using the "text" tool changes on export to PDF. See attached xournal file, and the resulting pdf. Note that the numbers are on either side of the lines in the xournal file, but no longer in the PDF.
To Reproduce
Steps to reproduce the behavior:
Draw vertical lines with pen. Open text box, write numbers interspaced with spaces over each line. Export to PDF. See how numbers no longer align with lines.
See attached files (zipped because .xopp upload not allowed): textAndLines.zip
Expected behavior
PDF looks like xournal file.
The text was updated successfully, but these errors were encountered: