|
How to put a fontawesome symbol within the rest of the text in my legend? |
Posted by KC on Oct-25-2016 04:13 |
|
I've got a customised legend box where I've added a key myself.
This is what I want to do:
cleg=c.addLegend (10,10,0,"",10)
cleg.addKey("someTextInFont1 SymbolFromFontAwesome someTextInFont1", Transparent,0)
I know that I have the fontawesome font in the chartdirector fonts folder (along with my Font1), but I cannot get ChartDirector (python) to pick it up, I just get square symbols. I've tried both the ttf and the otf from the fontAwesome downloads.
Do I give the unicode for the symbol, do I need to encode it, and how do I do all this please? Just passing the font and unicode eg "" hasn't worked.
Please could I have a worked example of how to do this?
http://fontawesome.io/cheatsheet/
fa-eye []
Thanks |
Re: How to put a fontawesome symbol within the rest of the text in my legend? |
Posted by Peter Kwan on Oct-26-2016 03:53 |
|
Hi KC,
I have just tried myself with the code below, and it works normally. I have attached the resulting chart image for your reference.
c = XYChart(400, 300)
c.addTitle("ABC <*font=fontawesome-webfont.ttf*>xEFx81xAE<*/font*> DEF")
c.makeChart("test.png")
In brief, ChartDirector uses UTF8, so you just need to enter the character in UTF8 encoding. As I am not sure which encoding your Python script source code is using, I just use plain ASCII encoding, and use escape sequence for the UTF8 character.
Hope this can help.
Regards
Peter Kwan
|
Re: How to put a fontawesome symbol within the rest of the text in my legend? |
Posted by Peter Kwan on Oct-27-2016 02:05 |
|
Hi KC,
Sorry, the correct code is:
c = XYChart(400, 300)
c.addTitle("ABC <*font=fontawesome-webfont.ttf*>\\xEF\\x81\\xAE<*/font*> DEF")
c.makeChart("test.png")
(The forum software remove the backslashes in my previous post.)
Regards
Peter Kwan |
|