Japanese fonts display as square characters with question marks on CentOS hosted Confluence

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.

  

Summary

If you have followed all of the KB articles and applied the detailed workaround outlined below, CentOS might not have the correct font to render Japanese texts within office files.

You may see Japanese texts being rendered as expected in thumbnail but upon clicking preview these Japanese texts are shown as squares with a question mark in it.

Environment

Confluence version 6.13.6

CentOS 6, 7, 8

Diagnosis

  1. Install all Japanese fonts using the following command.

    yum groupinstall Fonts
  2. Apply the following parameters into the setenv.sh file.

    CATALINA_OPTS="-Dconversion.sandbox.java.options=-Dconfluence.document.conversion.fontpath=/usr/share/fonts ${CATALINA_OPTS}"
    CATALINA_OPTS="-Dconversion.sandbox.java.options=-Dconfluence.document.conversion.slides.defaultfontname.regular=IPAGothic,-Dconfluence.document.conversion.slides.defaultfontname.asian=IPAGothic,-Dconfluence.document.conversion.slides.defaultfontname.symbol=IPAGothic,-Dconfluence.document.conversion.words.defaultfontname=IPAGothic  ${CATALINA_OPTS}"
  3. Manually install all Japanese fonts onto CentOS.

    yum install ipa-gothic-fonts
    yum install ipa-mincho-fonts
    yum install vlgothic-fonts
    yum install vlgothic-p-fonts
    yum install ipa-pmincho-fonts
    yum install ipa-pgothic-fonts
  4. Verify installed Japanese fonts using fc-list command.

    $ fc-list :lang=ja
    /usr/share/fonts/ipa-gothic/ipag.ttf: IPAGothic:style=Regular
    /usr/share/fonts/wqy-microhei/wqy-microhei.ttc: WenQuanYi Micro Hei,文泉驛微米黑:style=Regular
    /usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc: WenQuanYi Zen Hei:style=Regular
    /usr/share/fonts/vlgothic/VL-Gothic-Regular.ttf: VL Gothic:style=regular
    /usr/share/fonts/horai-ume/ume-tms3.ttf: Ume Mincho S3:style=Regular
    /usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc: WenQuanYi Zen Hei Sharp,文泉驛點陣正黑:style=Regular
    /usr/share/fonts/ipa-mincho/ipam.ttf: IPAMincho:style=Regular
    /usr/share/fonts/wqy-microhei/wqy-microhei.ttc: WenQuanYi Micro Hei Mono,文泉驛等寬微米黑:style=Regular
    /usr/share/fonts/vlgothic/VL-PGothic-Regular.ttf: VL PGothic:style=regular
    /usr/share/fonts/horai-ume/ume-tmo3.ttf: Ume Mincho:style=Regular
    /usr/share/fonts/ipa-pgothic/ipagp.ttf: IPAPGothic:style=Regular
    /usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc: WenQuanYi Zen Hei Mono:style=Regular
  5. Install document-conversion-library-2.0.14-SNAPSHOT.jar onto Confluence via UPM as detailed in Installing Marketplace apps.

  6. Add/set the following logging packages to ALL.

    com.atlassian.plugins.conversion.AsposeUtils
    com.atlassian.plugins.conversion.convert.image.WordsConverter
    com.atlassian.plugins.conversion.convert.image.SlidesConverter
  7. Attempt to reproduce the issue by uploading a Word/Powerpoint file with Japanese texts and then click preview to trigger the conversion service.

  8. You should find warning messages explaining the font cannot be found on the operating system alongside the respective replacement. In the following example, it states that the TakaoPGothic cannot be found and therefore using the FreeSerif instead.

    2020-09-09 17:09:22,443 WARN [conversion-thread-0-internal] [conversion.convert.image.WordsConverter] warning AsposeWarningHandler.warning:  
    getSource:1 
    getWarningType:131072 
    getDescription:Font 'TakaoPGothic' has not been found. Using 'FreeSerif' font instead. Reason: default font setting. 
    missingFonts:Calibri,等线,Times New Roman 

Cause

Takao font is the missing fonts Confluence required to render the Japanese texts properly. CentOS defaults TakaoFonts for Japanese texts instead of the typical Japanese fonts e.g. IPAGothic used by other Linux distributions. Takao font is a derivative of the IPAGothic as described in this Japanese website: https://beyondjapan.com/blog/2017/01/japanese-gothic-fonts-on-linux/

Some Linux distributions use this Takao font as the default Japanese font. That should be the case, and the Takao font is a derivative version of the IPA font. It seems that the Takao font was created to maintain the IPA font, which has a gentle release cycle, in a way that makes a small turn. By the way, Takao is said to have been given by Mr. Takao Hayashi, the designer of TB font, which was the source of IPA font. If you tilt the other side, the TB font itself is a paid font, and you can purchase it in the TypeBank font family TB Gothic.

Solution

  1. Shut down Confluence.
  2. Verify your font path within the setenv.sh file. If you don't find the following parameter, the default font path is {{/usr/share/fonts}}

    -Dconfluence.document.conversion.fontpath=/usr/share/fonts
  3. Download TakaoFonts_00303.01.zip onto your CentOS, unzip and extract the contents onto your dedicated fonts folder.
  4. Restart Confluence.

    You may need to re-download and attach the office files to trigger the file conversion using the right fonts. Squares with question marks may still present on existing office files.


Last modified on Oct 13, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.