Jump to content

Kanji and other oriental text in ObjectText


photo

Recommended Posts

Posted

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?

Posted

Hi Stephane,

It works for me with a Japanese font that I found over the Internet (NotoSansJp):

image.png

But somehow it doesn't work with Rich text option. Using the latest 2.18.1 SDK.

  • Like 1

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted

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?

Posted

I was able to make it center with rich text (and wrap) enabled. Not sure why it doesn't work at the first place:

image.png

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!

  • Like 1

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted

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:

×
×
  • Create New...