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

How to add a new font to support Cyrillic? #9

Open
ciukstar opened this issue Sep 10, 2022 · 3 comments
Open

How to add a new font to support Cyrillic? #9

ciukstar opened this issue Sep 10, 2022 · 3 comments

Comments

@ciukstar
Copy link

ciukstar commented Sep 10, 2022

Hello.

As I understand, the standard fonts provided by "Graphics.PDF.Fonts.Standard.Font" do not provide support for Cyrillic.
So I followed the HPDF/Test/onepage.hs example without success. The generated .pdf does not display Cyrillic text.
I have tried several other fonts besides DroidSans: OpenSans, DejaVuSans, FreeSerif, TimesNewRoman, all without success.

Note that I used fontforge to convert .ttf to .pfb and .afm files as below:
$ fontforge -lang=ff -c 'Open($1); Generate($2); Close();' DroidSans.ttf DroidSans.pfb
Some of them had issues with underscores (i.e. "_") and numeric digits (like "6") in .amf files when parsed with HPDF.

Is there anything else besides the example given on HPDF/Test/onepage.hs?
Or maybe it needs to be done in a completely different way?

Env:

LTS Haskell 19.22 (ghc-9.0.2)
HPDF 1.6.0

Thanks.

@hsyl20
Copy link
Owner

hsyl20 commented Nov 18, 2022

Hi,
Sadly I don't know how the existing .afm files were generated, nor if the parser supports the full spec (is there one?).

Perhaps @pkamenarsky knows more about this topic as he made changed related to fonts in HPDF?

@unhammer
Copy link

Did you ever figure this out? I also notice I don't get subscripts, e.g. with Times_Roman, the string "C₂₁H₃₀O₅" prints as CHO

@ciukstar
Copy link
Author

Did you ever figure this out? I also notice I don't get subscripts, e.g. with Times_Roman, the string "C₂₁H₃₀O₅" prints as CHO

No. I couldn't figure out. I have tried many different .pfb and .afm files (CTAN) but it seems that it doesn't support uniXXXXX tokens in .afm files and when those tokens are missing in .afm files it returns error *** Exception: head: empty list

There is a TODO.txt file which says that "The MAIN missing feature is the support for unicode and the bidirectionnal layout algorithm that will then be required".
I guess, it is just not implemented.

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

No branches or pull requests

3 participants