Currently, for users to generate graphs with unicode characters (japanese, chinese, arabic, etc.) users need to [http://piwik.org/faq/how-to-install/#faq_142
upload on their server the unitfont.ttf as explained in this faq]
Obviously this is not user friendly.. it's not even explained in the UI, so users will have to browse the FAQ or doc to find out.
Instead we could:
- if the unifont is not found in the expected path, and if the user is using the UI in any language we know needs unifont, display in General Settings a little warning / notice message explaining that the font is needed.
- the first time the unifont is needed to generate a static graph, in the language it is known to be required:
- if there is no right permission in the folder to put the font
piwik/plugins/ImageGraph/fonts/unifont.ttf we could write in tmp/assets/unifont.ttf
- if still no permission, cancel
- we could then attempt to download the font from the piwik server or the official original server (if it is mirrored?)
- The request to download should handle redirect ie. $followDepth = 3 or so
- if the download fails, set a flag
- Do we retry downloading later, or fail once and do not try again, ie. generate the graph with the default font?
See related code to refactor a bit: https://github.com/piwik/piwik/blob/master/plugins/ImageGraph/API.php#L110