Skip to content

Translations: fonts that support other languages (specifically Japanese) #504

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

Open
lwasser opened this issue May 19, 2025 · 12 comments
Open

Comments

@lwasser
Copy link
Member

lwasser commented May 19, 2025

During our sprint today, @flpm noticed that an error popping up with the packaging guide build (specific to Japanese translation) might be a font / missing character issue.

By default we are using the Google Font Poppins which does NOT have a Japanese character base. We might want to vendor another font, that supports Japanese and add it as an fallback to our css styles

font-family: "Poppins", san-serif

and maybe instead we vendor another font and do
font-family: "Poppins", "another-font", san-serif

@flpm
Copy link
Member

flpm commented May 20, 2025

Here is a sample of the Warnings that appear during building:

/home/runner/work/python-package-guide/python-package-guide/.nox/build-release-languages/lib/python3.9/site-packages/sphinxext/opengraph/socialcards.py:179: UserWarning: Glyph 12497 (\N{KATAKANA LETTER PA}) missing from font(s) Roboto Flex.
  fig.savefig(path, facecolor=None)
/home/runner/work/python-package-guide/python-package-guide/.nox/build-release-languages/lib/python3.9/site-packages/sphinxext/opengraph/socialcards.py:179: UserWarning: Glyph 12483 (\N{KATAKANA LETTER SMALL TU}) missing from font(s) Roboto Flex.
  fig.savefig(path, facecolor=None)
/home/runner/work/python-package-guide/python-package-guide/.nox/build-release-languages/lib/python3.9/site-packages/sphinxext/opengraph/socialcards.py:179: UserWarning: Glyph 12465 (\N{KATAKANA LETTER KE}) missing from font(s) Roboto Flex.
  fig.savefig(path, facecolor=None)
/home/runner/work/python-package-guide/python-package-guide/.nox/build-release-languages/lib/python3.9/site-packages/sphinxext/opengraph/socialcards.py:179: UserWarning: Glyph 12540 (\N{KATAKANA-HIRAGANA PROLONGED SOUND MARK}) missing from font(s) Roboto Flex.
  fig.savefig(path, facecolor=None)

@lwasser
Copy link
Member Author

lwasser commented May 20, 2025

Here is an example of a page rendered in Firefox on a mac . Note that the font of choice on my machine is

Hiragino Kaku Gothic ProN

Image

@flpm
Copy link
Member

flpm commented May 20, 2025

On my computer, (Firefox/Pop OS), the font used is Noto Sans CJK JP.

Image

@lwasser
Copy link
Member Author

lwasser commented May 20, 2025

@tkoyama010 do you happen to know which fonts might be ideal to support Japanese characters? We can vendor another font to support what is missing, potentially. 🙌🏻

@flpm
Copy link
Member

flpm commented May 20, 2025

Our current font config in CSS:

  /* Fonts (overrides base theme) */
  --pst-font-family-heading: "Poppins", sans-serif;
  --pst-font-family-base: "Poppins", sans-serif;
  --pyos-font-family-h1: "Itim", serif;

Since Poppins does not support Japanese and we don't specify any other option, the browser is selecting a font from the sans-serif family. That would explain why the fonts in Linux, Mac and the font picked during the build in sphinx are all different.

@lwasser
Copy link
Member Author

lwasser commented May 29, 2025

I've posted about this issue on Slack. Let's give it a few days, and if no one replies there or knows, I can then post on social. surely someone else can help! OR we can try what i found below:

This font (Noto Sans Japanese) - https://fonts.google.com/noto/specimen/Noto+Sans+JP?preview.text=noto
We could potentially vendor it and use it as a css fallback to see if it resolves the errors and renders properly?

@sneakers-the-rat
Copy link
Contributor

i figure the technology wizards in this group can figure out how to embed the font, but also just sharing a cool tool i like - this thing makes it very easy to embed a google font without leaking information to google on every page load :) generates the download for you and the css to just copy/paste : https://gwfh.mranftl.com/fonts

omg font decisions are so hard to make especially when u don't read the language, i have no idea what looks good in a Japanese font! that Noto Sans looks good to me but also i have no frame of reference.

@ZacWarham
Copy link

ZacWarham commented May 30, 2025

Someone reached out to me because I'm learning Japanese at the moment asking for me to provide my opinion here between Noto Sans JP and M Plus.

For me as a learner, Noto Sans JP is better because it's more simple. The M Plus has a few extra accents that make it trickier for a learner to understand. Granted, I doubt they're an issue for native speakers. I also asked a Japanese friend and they said they prefer Noto Sans as well.

From the few times I've worked with Japanese computers in my IT roles, most windows users just use the default font that comes with the Windows IME keyboard/language pack.

But that's my 2 cents as a foreigner so take my comments with a grain of salt, hopefully more native speakers can provide better feedback

@lwasser
Copy link
Member Author

lwasser commented Jun 2, 2025

@all-contributors please add @ZacWarham for idea, review

@ZacWarham thank you so much for this. It seems like we might have a consensus here around trying Noto Sans JP!

Also @sneakers-the-rat - that site is awesome! It will make the vendoring part a lot easier. I am going to create a subissue here to vendor and use Noto Sans JP as a fall back!! And link to that helper site too!!

Copy link
Contributor

@lwasser

I've put up a pull request to add @ZacWarham! 🎉

@chendaniely
Copy link

Comment from my Japanese friend who does Japanese <> English translations

Common ones are mincho which is equivalent to Times Roman, and meiryo which is more like Tahoma
Noto... To me it looks like Ariel-equivalent

@tkoyama010
Copy link
Member

@tkoyama010 do you happen to know which fonts might be ideal to support Japanese characters? We can vendor another font to support what is missing, potentially. 🙌🏻

https://mplusfonts.github.io/ is awesome!

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

No branches or pull requests

6 participants