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

Skipped because proportional CJK #175

Open
yisibl opened this issue Oct 20, 2023 · 6 comments
Open

Skipped because proportional CJK #175

yisibl opened this issue Oct 20, 2023 · 6 comments

Comments

@yisibl
Copy link
Contributor

yisibl commented Oct 20, 2023

I am trying to execute a command on a Chinese font:

ast-asian-spacing -o build foo.ttf

Skipped because proportional CJK: "foo font name"

Does this project have any special requirements for the glyphs in the font or what characters need to be included?

@yisibl
Copy link
Contributor Author

yisibl commented Oct 24, 2023

I think it might be caused by the lack of width of the punctuation. The width of many of the fonts I tested was 750, which is less than UPM(1000).

@kojiishi
Copy link
Owner

Does this project have any special requirements for the glyphs in the font or what characters need to be included?

Yes, because the CJK em-box isn't well-defined in the OpenType format, it needs a heuristic to determine it. The current list is chosen to see if two different fullwidth punctuation characters have the same width as 3 commonly used ideographic characters. Please see:
https://github.com/kojiishi/east_asian_spacing/blob/main/east_asian_spacing/config.py#L41

If your font doesn't have all these glyphs, the current logic fails. I could add some fallback logic, but I wasn't sure what options/fallback logic to add, so I relied the users to provide one.

You can specify the CJK em-box size or characters to compute it from by the --em option:
https://github.com/kojiishi/east_asian_spacing/blob/main/east_asian_spacing/builder.py#L229
or you can create a python code to customize it like this:
https://github.com/googlefonts/chws_tool/blob/main/src/chws_tool/config.py#L63

I have to admit that the former isn't well tested, please let me know if it doesn't work as you expect.

@yisibl
Copy link
Contributor Author

yisibl commented Oct 24, 2023

@kojiishi Thanks for the answer, indeed, the width of 「」() in my test font is less than em-box (1000).

@yisibl
Copy link
Contributor Author

yisibl commented Oct 24, 2023

I have to say this is a very great project!

Is it possible to add an option to generate fea files for a specific language? That way I can manually compile chws into fonts via fonttools, which is sometimes more flexible.

@yisibl
Copy link
Contributor Author

yisibl commented Oct 24, 2023

This is my test font (free for commercial use):

@kojiishi
Copy link
Owner

kojiishi commented Nov 7, 2023

@kojiishi Thanks for the answer, indeed, the width of 「」() in my test font is less than em-box (1000).

If all punctuation characters have the same widths, you should be able to use --em '「」()' or --em 900. Isn't it the case?

aarongable pushed a commit to chromium/chromium that referenced this issue Jan 21, 2024
This patch changes `HanKerning::FontData` to check glyph
bounding box against its advances, not against `1ch`.

Under specific scale, some fonts may return advances of CJK
fullwidth punctuation characters slightly different from the
`1ch` (the advance of U+0x6C34).

Also some fonts are known to have narrower CJK fullwidth
punctuation characters than `1ch`, though they have enough
space to apply kerning[1].

This patch makes these cases applicable, as long as:
* The font has `halt` feature, claiming it can apply kerning.
* Each group of characters have the same advances.
* Characters that have language-dependent conventions have
  enough internal space to apply kerning.

[1] kojiishi/east_asian_spacing#175

Bug: 1519775, 1463891
Change-Id: I6dd8311acee4d0cc3602176a1d2105a90f0b74d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5216027
Commit-Queue: Kent Tamura <[email protected]>
Reviewed-by: Kent Tamura <[email protected]>
Auto-Submit: Koji Ishii <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1249933}
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