-
Notifications
You must be signed in to change notification settings - Fork 138
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
Printing recipes with Polish letters #729
Comments
I did a bit of research on this. Our PDF generating library, Reportlab, by default uses one of the so-called "Base 14" fonts (mostly Arial, Times Roman, and Courier in Regular, Bold, etc.), which do not have to be included in the PDF, as they're guaranteed to be available in all PDF viewers. Unfortunately, those fonts apparently do not include Latin-2 glyphs (i.e. Eastern European diacritics like ogoneks or hačeks). To solve this, I've changed the code locally to use a custom font that covers those glyphs (as e.g. the FreeFont family does, i.e. FreeSans, FreeSerif, and FreeMono), which then gets embedded into the PDF, increasing its file size. It worked, but in order to make this sort of hack available to all users, I need to
The latter option seems desirable, but it's probably a bit hard to translate a Pango font description (or whatever is returned by GTK's FontChooser) into something that Reportlab understands. (Easier if I fix #708) I'll give this some more thought. Thanks for pointing this out to me anyway, and feel free to add your thoughts on this in the meantime. |
Dear Ockham, |
Here you go: https://gist.github.com/ockham/7362154 |
Works like a charm now. Thank you very much!!! |
Glad to help. |
Maybe a temporary solution to select the .ttf file via a file dialog (e.g. in the settings) would be feasible until a proper one is implemented? |
I propose detecting if non-Latin-2 characters are present in the recipe while exporting to PDF, and if that's detected, then embed a cut-down version of a font which includes only the character descriptions for the characters actually present in the document. I'm quite sure PDF allows you to do that. If this option is chosen as default, it should be easy to use for non-technical users and save some space in the exported file at the same time. There could be extra options for advanced users to choose their own font and/or choose whether to embed the full or cut-down versions. Any idea which parts of the source I should be looking at to get started? |
Again the same issue in version 0.17.4, but this time the code in ../gourmet/plugins/import_export/ changed ,and gist from Ockham: https://gist.github.com/ockham/7362154 do not work anymore. |
It is surprising, that no one could help with such regression like this. |
In 2020 again, trying to print gives black squares, and the solution given by Ockham no longer applicable, as the way how files are organized are changed. |
When I am trying to print recipe, I get black squares instead of polish letters:
The same error as above exists in PDF document, which I get when I clik Print Preview.
In recipe view Polish letters are displayed correctly. To get correct export, I need to do Plain text export or HTML export, and then print resulting file, but it is annoying to exporting to file to print.
I didn't find any options to set encoding of PDF files...
Is someone could point me how to fix this annoying issue?
The text was updated successfully, but these errors were encountered: