codidact / qpixel

Q&A-based community knowledge-sharing software
https://codidact.com
GNU Affero General Public License v3.0
382 stars 69 forks source link

Font support for other languages #270

Closed cellio closed 1 year ago

cellio commented 3 years ago

https://languages.codidact.com/questions/277352

Support for other alphabets/languages is iffy. One approach is to expand the font stack (Noto was mentioned there). Another is to enable language tagging (requires HTML; Markdown doesn't support this). If we can do it with additions to the font stack (without causing other problems) that sounds like the friendliest approach, but I don't know how feasible it is.

MoshiKoi commented 3 years ago

I forgot that I made that post 👀

Actually, I believe the easiest way to do this is just add lang as a permitted attribute here: https://github.com/codidact/qpixel/blob/f200846d89d03f6cc3cbc1f910e7c40374f2acbc/app/helpers/posts_helper.rb#L15

ArtOfCode- commented 3 years ago

@MoshiKoi the lang attribute indicates language, not font

MoshiKoi commented 3 years ago

Through another thing is, we don't have span allowed (if this goes through, maybe we should). Without it, we won't be able to switch language inline, which while inconvienient isn't particularly blocking.

MoshiKoi commented 3 years ago

@ArtOfCode- Ay, but the specific issue on the linked post ended up being language considerations

MoshiKoi commented 3 years ago

@cellio As a representative of the Judaism community (which is the other community with major font considerations), would you prefer having a specific font for Hebrew, different from the English font?

cellio commented 3 years ago

@MoshiKoi we want to be able to paste Hebrew into the post box and have it Just Work. If we would have to do manual HTML edits, that would be a regression for us. We found a font that has a reasonable Hebrew in its stack. (Waves hands; I don't know if I'm correctly describing this. I don't know a lot about fonts; msh210 might be able to provide better input.)

MoshiKoi commented 3 years ago

@cellio Of course, we'd still have a fallback font stack. This would just be on top of it, not replacing it. However, while it might work for Judaism, a pure font stack is... less than feasible for Languages. For example, lets say we have a font stack of X, Y where X looks great for Hebrew and English, but looks terrible for Greek, while Y looks great for Greek but terrible for Hebrew. What's the solution?

Now multiply that problem by 10+ different scripts.

cellio commented 3 years ago

Right, I wasn't trying to say that what works on Judaism, where we need to support two primary languages, works everywhere. I was just trying to answer your question about usage on Judaism. I don't know enough about fonts to have a useful opinion on how to solve the general problem.

MoshiKoi commented 3 years ago

@cellio I wasn't trying to force my method on Judaism either, it's just that it would affect it and I was wondering if there were special considerations needed.

cellio commented 3 years ago

How would things change for Judaism? Assume nobody does any special language tagging in HTML and we continue to cut/paste Hebrew into posts and comments. Does that Hebrew rendering change?

MoshiKoi commented 3 years ago

@cellio no, it wouldn't. However, they'd get the choice to start tagging the language, so it'd still affect them, even if not in a major way.

MoshiKoi commented 3 years ago

Oh yeah, I forgot to mention this, but there are also some QoL stuff that could be added with lang attributes like

[lang='he'], [lang='ar'] /* and whatever other RTL languages there are */ {
    direction: rtl;
}

Which would right-justify Hebrew and Arabic texts.

cellio commented 1 year ago

The HTML version of this works (demonstrated in an answer on the linked question). No markdown, but with the HTML I think we can close this.