Amerio.Stephane Posted May 3, 2024 Posted May 3, 2024 Hello, Is it possible to have Kanji and other non-latin text in ObjectText? I tried with the simple Tahoma.ttf windows font, but the text Osaka 大阪市 does not show up correctly. Do I need to somehow prepare the font in any way? Or should I give up and go to basic textures? Note: I plan to present the texts in 2D as billboards, planted hover a 3D map. Maybe there is a better option here?
silent Posted May 3, 2024 Posted May 3, 2024 Hi Stephane, It works for me with a Japanese font that I found over the Internet (NotoSansJp): But somehow it doesn't work with Rich text option. Using the latest 2.18.1 SDK. 1 How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
Amerio.Stephane Posted May 4, 2024 Author Posted May 4, 2024 Nice, these fonts work! Bonus question: as Rich text doesn't work, is there any way to make multi line centered text? Or at least, a way to know the width of the text to manually center it?
silent Posted May 6, 2024 Posted May 6, 2024 I was able to make it center with rich text (and wrap) enabled. Not sure why it doesn't work at the first place: Could you please check if that's what you want to achieve? You need to specify wrap width, enable rich text and use <center></center> or <p align="center"></p> tags. Thanks! 1 How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
silent Posted May 6, 2024 Posted May 6, 2024 But if that's not sufficient you can calculate width and height of the ObjectText using following code: vec2 getObjectTextSize(const ObjectTextPtr &obj_text) { if (obj_text.isNull()) return vec2_zero; BoundBox bb = obj_text->getBoundBox(); return vec2(bb.maximum.x, -bb.minimum.y); } How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
Recommended Posts