When you define a Text element using UTF-8 characters, be sure to include a compatible font.
e.g.
Code Block |
---|
void CHPSView::OnUserCode3()
{
auto segKey = GetCanvas().GetFrontView().GetAttachedModel().GetSegmentKey();
TextKit tk1; //font set
tk1.SetFont("Yu Gothic");
tk1.SetText("こんにちは");
tk1.SetPosition(Point(0, 0, 0));
segKey.InsertText(tk1);
TextKit tk2; //font not set
tk2.SetText("こんにちは");
tk2.SetPosition(Point(0, 5, 0));
segKey.InsertText(tk2);
} |
...
⚠ Note: for this code sample to work, you need to make sure the CPP file is encoded in UTF-8 without BOM.
This code sample insert a japanese text and uses the default Yu Gothic font to display it.
On Windows, this is the list of default font available for the different characters sets: https://docs.microsoft.com/en-us/typography/fonts/windows_10_font_list To learn more, please check out our forum post.
https://forum.techsoft3d.com/t/how-to-insert-text-with-with-non-english-characters/1492