Server: Characters from Korean, Chinese, etc don’t show in txt/md file previews

Created on 4 Apr 2017  Â·  9Comments  Â·  Source: nextcloud/server

Steps to reproduce

  1. Create a text file in Korean
  2. Preview image has broken fonts because the default OpenSans-Regular.ttf has no Korean fonts

Expected behaviour

There should be a way to specify a user font file for TXT preview in config.php. Something like $CONFIG['fontFile']

Actual behaviour

Broken text in preview or I have to modify lib/private/Preview/TXT.php to point $fontFile to a user font file.

1. to develop bug previews and thumbnails

All 9 comments

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:

special characters file

And here its preview, broken:
special characters file preview

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?

Was this page helpful?
0 / 5 - 0 ratings