Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

When you define a Text element using UTF-8 characters, be sure to include a compatible font.

e.g.

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

  • No labels