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

Comments on Mixed fonts within a sentence (and proposed fixes)

Post

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)
General comments
Sigma‭ wrote over 3 years ago

What OS / browser are you using?

Moshi‭ wrote over 3 years ago · edited over 3 years ago

@Sigma Windows 10 / Edge, but it really comes up everywhere since it's not actually a bug

Skipping 1 deleted comment.

msh210‭ wrote over 3 years ago · edited over 3 years ago

Can't we just say "If language X looks like boxes, install one of these fonts; for a more seamless look, install Noto"? Those who care will do so; everyone else can suffer.

Moshi‭ wrote over 3 years ago

@msh210 "everyone else can suffer" That's... pretty callous, no matter how I see it

Moshi‭ wrote over 3 years ago

@msh210 besides... I do have Noto. But because Noto isn't listed in the font stack for the site, my browser doesn't decide to use it.

msh210‭ wrote over 3 years ago · edited over 3 years ago

(Right, I agree Noto should be in the site's font stack.) Callous? Fonts traditionally are the purview of the client, not the server. You want to be able to read stuff, install the right font. Arguably, the site should just specify "sans-serif" and the lang attributes and let the clients take it from there.

Moshi‭ wrote over 3 years ago

@msh210 So we basically agree then. There should be more fonts in the font stack for language coverage. lang attributes are my preferred choice as well, but @ArtOfCode said that they didn't want to use them (don't ask me why).

ArtOfCode‭ wrote over 3 years ago

I don't believe I've said I don't want to use them, @Moshi - I said there's no Markdown support for them, which means you have to write HTML - not a great solution, because plenty of users don't know how to use HTML and shouldn't have to learn just to get things to display correctly.

Moshi‭ wrote over 3 years ago

@ArtOfCode I'm pretty sure you said you didn't want to use them... (I asked, you said there's no need, that's what I'm taking as a rejection)

Moshi‭ wrote over 3 years ago

@ArtOfCode besides, it's not like we can't just make a tool for people to set the language of some text. Judaism has Sefaria (though I haven't used it) and SciSpec has LaTeX, I don't see what would be difficult about it.