when running matomo on websites which have special characters such as japanese or chinese characters, we are not able to get them in the daily report even if we follow https://matomo.org/faq/how-to-install/faq_142/.
Having the characters displayed in the PDF report
Current unicode characters are not displayed in the PDF report
Create a webpage with a title in chinese or in japanese.
Check in the report that these characters are well displayed in the page title report.
create a daily report with page titles.
check the generated pdf that the characters for the chinese page are not well displayed.
app/core/ReportRenderer.php line 24:
const DEFAULT_REPORT_FONT_FAMILY = 'dejavusans';
dejavusansdoesn't support CJK glyphs
tcpdf; no font family shipped with
app/vendor/tecnickcom/tcpdf/fontssupport CJK glyphs unless it's set according to Matomo chosen locale (no support for mixed content)
app/core/ReportRenderer.phpline 24 and adding the corresponding font files to
app/vendor/tecnickcom/tcpdf/fontsresult in reports showing CJK glyphs properly
Because no TTF or OTF font can accommodate all 100k+ glyphs (limit 64k), a suggestion would be to allow font selection/upload for different language combinations in settings to override the automatically chosen font per language.
I'll mark this for now as a regression as I think this used to work?
Note in case there are discrepancies between different shipped versions: I am using Matomo Analytics - Ethical Stats. Powerful Insights. v4.5.0 for WordPress
The website's language is English, but with mixed language content.
I guess, to view the report with the correct format need to change the Matomo language to the same language that the report has. how to change language is here. https://matomo.org/faq/how-to/how-can-i-change-the-language-of-matomo-as-a-user/
it actually take the last param in the URL as laguage in my case is
It seems like this is not a regression. More like a FAQ. Or we can add a config variable in the config.ini.php called
report_lang @tsteur any suggestion?
What about when a user has mixed language content? The base language is English, but the content is bilingual, primarily English with some Chinese characters, maybe, for example? The interface language would need to be English for the user (so
language=en seems right), but the Chinese characters supported nonetheless to handle displaying the content, like the behavior in a browser?
Great, thanks for the update!
As a suggestion for possible further improvement - how difficult would it be to set the font in
config.ini.php so that it doesn't break at update? I specifically have the WordPress plugin in mind, which I think replaces all the files entirely during plugin update (but not the
config.ini.php because it's located outside of the plugin directory) - but that may be a valid concern for matomo as a whole.
It seems only 3 files would need what it looks like minor changes in a few places - calling the
Piwik\Config\Config::getInstance(), test for the existence of the config in the file, and if not, use a default one:
app/core/Mail/EmailStyles.php app/core/ReportRenderer/Pdf.php app/core/ReportRenderer.php
I might be totally off base here, so please ignore if it's irrelevant.
@froger-me that make sense to me, set up fonts in the config will be easier, but I can't make the judgment call. Can I copy the request to another tickets category as an enhancement (new feature), which I am sure the management team will pick up,
Can I copy the request to another tickets category as an enhancement (new feature), which I am sure the management team will pick up
Absolutely :) !