Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Meta

Mixed fonts within a sentence (and proposed fixes)

+2
−0

The problem

Currently, there are no fonts listed for languages other than English. This leads to an issue I see a lot - mixed fonts. (looking at you, Google Translate)

Take a simple Japanese sentence, for instance: 日本語が分かりません

This is what it looks like on my machine:

rendering example

It loads both PMingLiu ('serif' Chinese) and Meiryo ('sans serif' Japanese), leading to this messed up looking sentence.

My preferred solution: Language tags

There is no way that a simple global font list will work, since it will lead to Chinese being loaded for Japanese or vice versa. However, if we take advantage of a html feature (which was basically designed for this), we could do this:

<p>This is a sentence with <span lang="zh-Hant">中文</span> characters</p>

Or, taking my example from earlier:

<span lang="ja">日本語が分かりません</span>

You could then easily set fonts based on the language displayed.

The main issues I can see with this are

  1. Creating the fonts list for every language
  2. Markdown support

The first one has a relatively simple solution; If someone needs language support that doesn't currently exist, they can just request it. In fact, browsers will change their fonts based on the language tag, so people requesting fonts should be quite rare.

The second bullet is the main hurdle. As far as I can tell, the CommonMark specification doesn't have any sort of html attribute support (outside of literally writing html). I don't think it'd be a massive task to have a custom extension to it though. Personally, I'd go with something similar to Wikipedia, like

The Japanese name for Japan is {{ja|日本}}.

An alternate solution

The other solution I'm thinking of is using something like Noto Fonts. From their page,

Google has been developing a font family called Noto, which aims to support all languages with a harmonious look and feel.

This would solve the problem of mixed fonts, as it was designed for the very purpose of seamlessly blending any languages. This comes with it's own drawbacks, namely:

Not everyone has Noto installed. There's no point in a solution if it doesn't work for most people. If you think this can be solved with webfonts, be aware that we would have to webfont almost all the languages with this solution.

If not using Noto, we'd have to handpick fonts that work well even when mixed. Keep in mind still that not everyone has every font, so we'd have to come up with multiple combinations of fonts.


If anyone has ideas on how to implement either solution, or other solutions altogether, feel free to add that as an answer.

History
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

General comments (10 comments)

1 answer

+0
−0

Markdown doesn't work, but HTML does. The HTML source for the following is taken from the question ("preferred solution"):

This is a sentence with 中文 characters

日本語が分かりません

History
Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »