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

The ascii characters rendered by the external font are particularly wide. I don't know if there was something wrong. #201

Open
vvlookman opened this issue Dec 29, 2024 · 4 comments

Comments

@vvlookman
Copy link

image
@vvlookman vvlookman changed the title The English characters rendered by the external font are particularly wide. I don't know if there was something wrong. The ascii characters rendered by the external font are particularly wide. I don't know if there was something wrong. Dec 29, 2024
@vvlookman
Copy link
Author

Even if you copy the built-in font file and load it as an external font, the rendering effect will be different from using the built-in font directly, and it will be also so wide

@fschutt
Copy link
Owner

fschutt commented Jan 2, 2025

Yeah, it means the widths of the glyphs are not parsed / encoded correctly.

What font is this? Does your font support vertical writing (in that case it could be because it's using the /DW2 instead of the /DW dictionary)?

printpdf usually normalizes character widths but falls back to the "default" width if the width of a glyph is not found, and that width is a square, i.e. for the glyph width = height, which is why they appear oddly spaced.

@vvlookman
Copy link
Author

This should have nothing to do with fonts, because I have also tested built-in fonts, and directly imported the ttf file of the built-in fonts as an external font will have the same effect.

My workaround is to separate ASCII characters from non-ASCII characters in the text. ASCII characters are rendered using built-in fonts and non-ASCII characters are rendered using external fonts. So, this problem may be that there may be a problem with the way external fonts calculate character widths?

@vvlookman
Copy link
Author

Yeah, it means the widths of the glyphs are not parsed / encoded correctly.

What font is this? Does your font support vertical writing (in that case it could be because it's using the /DW2 instead of the /DW dictionary)?

printpdf usually normalizes character widths but falls back to the "default" width if the width of a glyph is not found, and that width is a square, i.e. for the glyph width = height, which is why they appear oddly spaced.

The font is Noto Sans CJK

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

2 participants