|
Chinese legend labels |
Posted by David Langhals on Jul-09-2020 23:21 |
|
Hi everybody,
I have an issue displaying Chinese characters in an XY-Chart legend label.
I have already made sure to encode everything in UTF8 (Russian labels work fine) and I assume square boxes instead of gibberish means that it is more of a font than an encoding issue, right? The rest of my software displays Chinese characters without a problem.
This is how I add the legend (C++):
c->addLegend(75, 5, false, "arialbd.ttf", 8)->setBackground(Chart::Transparent);
I also tried not setting any specific font and size:
c->addLegend(75, 5, false)->setBackground(Chart::Transparent);
Both don't seem to work.
See attached screenshot.
What am I doing wrong?
Thank you for your input.
|
Re: Chinese legend labels |
Posted by Peter Kwan on Jul-10-2020 00:32 |
|
Hi David,
The square character means the encoding is correct, but there is no such character in the font used (arialbd.ttf in your code).
To solve the problem, please use a font that contains Chinese characters. You can specify multiple fonts if you like. For example:
// Use the simsun.ttc font. (This assumes the font exists on the computer.)
c->addLegend(75, 5, false, "simsun.ttc", 8)->setBackground(Chart::Transparent);
or
// Use the arial bold font. If the character is not supported, try the simsun.ttc font with boldening.
c->addLegend(75, 5, false, "arialbd.ttf;simsun.ttc bold", 8)->setBackground(Chart::Transparent);
Hope this can help.
Regards
Peter Kwan |
Re: Chinese legend labels |
Posted by David Langhals on Jul-10-2020 15:15 |
|
Hi Peter,
thank you for your quick response.
I will try that.
- David |
|