Skip to content
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

Add support for libpodofo version >= 0.10.0 #755

Merged
merged 7 commits into from
Feb 11, 2024

Conversation

fk0815
Copy link

@fk0815 fk0815 commented Oct 28, 2023

This adds support for new libpodofo 0.10.0 or newer and keeps legacy support as well.

Build here: https://build.opensuse.org/package/show/home:frank_kunz/horizon-next

tested on openSUSE Tumbleweed (new libpodofo) and 15.4/15.5 (old libpodofo).

@fk0815 fk0815 changed the title Add support for libpodofo version > 0.10.0 Add support for libpodofo version >= 0.10.0 Oct 29, 2023
Frank Kunz added 2 commits October 29, 2023 19:01
With libpodofo 0.10.0 there are backwards incompatible API changes.

Signed-off-by: Frank Kunz <[email protected]>
Keep old pdf export implementation for libpodofo up to version 0.9.8.
Meson build tries to detect the correct podofo version. With 0.10.0
it is possible to use pkgconfig.

Signed-off-by: Frank Kunz <[email protected]>
@carrotIndustries
Copy link
Member

Thanks a lot for taking this on!

I tried it on my system and it crashed since document.GetFonts().SearchFont("Helvetica") returns a nullptr.

I then replaced it with GetStandard14Font(PoDoFo::PdfStandard14FontType::Helvetica). This then didn't segfault but throws an exception when trying to draw non-ascii(?) characters:

PdfErrorCode::InvalidFontData, The font data is invalid.
Callstack:t#0 Error Source: main/PdfEncoding.cpp(82), Information: The provided string can't be converted to CID encoding

@fk0815
Copy link
Author

fk0815 commented Nov 2, 2023

I tried that as well, but I did not get any error with your proposed change. I used some umlauts (ÄÖÜ) added as text to the schematic and that works for me. How do you add non ascii chars? What is the operating system?

@carrotIndustries
Copy link
Member

How do you add non ascii chars? What is the operating system?

In my case it was the ohm symbol from a resistor value. OS is Arch Linux.

@fk0815
Copy link
Author

fk0815 commented Nov 3, 2023

I can reproduce that issue when removing the ghostscript-fonts-std package from my openSUSE tumbleweed system. I do not understand what kind of magic has been done on older podofo versions as the dependency to the helvetica font has also been in horizon before. Not sure how to handle that properly, is there an other default font which is available on all systems?

@carrotIndustries carrotIndustries merged commit 8274cb8 into horizon-eda:master Feb 11, 2024
21 of 22 checks passed
@carrotIndustries
Copy link
Member

Arch Linux having dropped legacy podofo motivated me to revisit this PR. I fixed the font issue by bundling it.

Thanks a lot for your contributions! ❤️

@fk0815
Copy link
Author

fk0815 commented Feb 12, 2024

Is there a new release in the queue? Or would it make sense to backport that to 2.5.0 ?

@carrotIndustries
Copy link
Member

Good question, it's almost been a year since the last release, so it's about time for a new one and there are new features worth it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants