moodle-fileconverter_librelambda icon indicating copy to clipboard operation
moodle-fileconverter_librelambda copied to clipboard

Adding CJK rendering

Open peterspicer-catalyst opened this issue 5 years ago • 2 comments

We have a client that has docx files with Chinese in, which don't render correctly when converted to PDF.

What I've done thus far is 'encourage' the bundled LO instance to have some CJK fonts since I couldn't see how to otherwise install them via yum in the built result.

So, I manually dismantled the lo.tar.xz file, added the .ttf files from ftp://ftp.gnu.org/non-gnu/chinese-fonts-truetype/ into instdir/share/fonts/truetype (once gunzipped) and rebuilt lo.tar.xz and this seems to work for now.

Other things:

  • The fonts look slightly fancier and have different hinting rules than students might be expecting, though for a lot of cases it won't matter too much.
  • I couldn't figure out how to use OpenType fonts (e.g. Noto Sans) with this; LO has a list of folders it goes through and I couldn't see how to write to any of them, short of mangling the result container to have a font directory in /tmp, and then mangle all the other system fonts to be there too... there probably is something more elegant for this - note that Noto ships all the main font families as TTF, except for the CJK fonts which only ship as OTF.
  • I haven't attempted Arabic but I imagine something similar will be the case there.

It'd be nice to get CJK rendering supported, either by default or as a configurable rather than what I've got here, but this does seem to work.

peterspicer-catalyst avatar Jan 02 '20 16:01 peterspicer-catalyst