Open HuidaeCho opened 7 years ago
I would vote for no config option, but a font that actually support Korean and Latin characters.
cc @georgehrke @jancborchardt
Can we add a fallback font to the preview generator? In case characters don't exist, it should simply use Liberation Sans for example.
cc @georgehrke @rullzer @icewind1991
Similar of #13377
It’s not similar, as #13377 is about the interface fonts, and there it uses fallback fonts which are perfectly readable – just not as nice.
But for the previews, it shows no fallback font, but rectangle boxes. (Just like for emojis etc.)
Here is the file in the text editor, perfectly fine:
And here its preview, broken:
Well, adding more compatible fonts to the system like #13377 suggest and to the preview generator will fix it, so yes, this is similar.
The text editor uses your own system font as a fallback.
@jancborchardt Shall we add this into the todo of the other issue?
@skjnldsv ok, if you say it’s heavily related we can add it as todo of the other issue.
@jancborchardt Well, it make sense to me, but I might be missing some keys here :wink: :see_no_evil: Let's leave this one opened as even if one is also the solution to the other, we'll not forget there are two parts to the problem! :smile_cat:
Just as a note, this is not fixed by using a native font stack as per https://github.com/nextcloud/server/pull/16055 as this is only for the interface fonts.
For the preview generator we would need TTF files for all the different fonts (as I guess WOFF2 is not supported by the preview generator?) And that means loading a lot of files for Korean, Chinese and Japanese:
These would be the woff2 files, 184 for both regular and bold: https://fonts.googleapis.com/css?family=Noto+Sans+KR:400,700&display=swap
@rullzer is this doable somehow?
Hi, I'm not sure this issue have been fixed. I'm using the latest container version of nextcloud(Nextcloud 20.0.1)and I find out the preview of markdown file got no Chinese character. really strange. The picture 1 is the real content and the picture 2 is the preview.
Hope someone can tell me how to fix it, thank very much. @jancborchardt
can anyone help me on this? @rullzer @MorrisJobke @jancborchardt @HuidaeCho
can anyone help me on this? @rullzer @MorrisJobke @jancborchardt @HuidaeCho
It may have changed now, but for version 13.0.12, I added one line after line 72 in lib/private/Preview/TXT.php
:
$fontFile = __DIR__;
$fontFile .= '/../../../core';
$fontFile .= '/fonts/OpenSans-Regular.ttf'; # line 72
# by Huidae Cho
$fontFile = '/usr/local/share/fonts/TTF/UnDotum.ttf'; # here, specify your own font path
Fonts that support CJK characters can be 20MB each. Is it acceptable to add these fonts to /core/fonts
in this repo? If so, I can try to fix this, (also #13376). If not, we may need to add a config that allows us to choose our own font file.
Thank you @HuidaeCho. In my case version 20.0.2, I changed more.
lib/private/Avatar/Avatar.php:152: $font = __DIR__ . '/../../core/fonts/NotoSans-Regular.ttf';
lib/private/Avatar/Avatar.php:187: $font = __DIR__ . '/../../../core/fonts/NotoSans-Regular.ttf';
@HuidaeCho @ludishur Hi, I'm not so familiar with php program. when you said change the code. and then what? just restart the nextcloud container?
@HuidaeCho @ludishur I changed the code and restart the container, It seems didn't work. I also copied the ttf file into the dir the code mention。
@Kellermaan There is no need to restart container after modifying the code. You need to change username to see the code in action. User can change user name in settings menu. Admin can be renamed in the user/group menu. The avatar png file seems to be recreated when the username is changed. The browser cache may remain, so it is recommended to open the secret mode browser and check it. I hope it goes well.
@ludishur For me, the problem is the preview of md file can now show the chinese character. And I tried your method, it didn't work, am I missing some configuration? Thanks for your reply!!
@ludishur I fixed the issue, it turnes out that the default noto font doesn't include Chinese character. So I downloaded one include Chinese Japaness. Now it worked, thanks anyway.
Hi, please update to at least 23.0.12 and report back if it fixes the issue. Thank you!
Re-opened because as far as I can tell CJK support was never added for MD/TXT previews/thumbnails. Triggered by a post on the forum and some code review on my part.
There was discussion about it in #16040 and #25529 and elsewhere, but the bundled fonts in core/fonts
don't include the CJK (and other) variants of Noto as far as I can tell.
@joshtrichards good catch. Do you know what needs to be done and/or could submit a pull request?
(Also cc @juliushaertl regarding the previews)
It’s probably best if we switch to Noto for this as it has the broadest support for various alphabets: https://fonts.google.com/noto/fonts?query=noto
FYI @sorbaugh for planning