OpenCasCade(OCC)中国語ディスプレイ

問題の説明
OpenCasCadeの通常の漢字を表示できません。eryarのブログOpenCascadeChinese Text Renderingを参照したところ、以前のバージョンでは、OCCTのVDrawText関数にResource_Unicode :: ConvertGBToUnicode()を追加できることがわかりました。このコマンドは実装できます。バージョンでは7.2、プロトタイプこの関数は大幅に変更されました。このアイデアに従って、この関数はAIS_LabelTextに実装されています。

コード

    TCollection_ExtendedString tostr;
	Standard_CString str= "OpenCasCade 你好啊";
	Resource_Unicode::ConvertGBToUnicode(str,tostr);
	Handle(AIS_TextLabel) aLabel = new AIS_TextLabel();
	aLabel -> SetText(tostr);
	aLabel -> SetColor(Quantity_NOC_RED);
	aLabel -> SetFont("SimHei");//一定要设置合适的字体,不然不能实现功能
	Handle(AIS_InteractiveContext) myAISContext = GetDocument()->GetIC();
	myAISContext->Display(aLabel,Standard_False);

エフェクト表示
ここに画像の説明を挿入

おすすめ

転載: blog.csdn.net/qq_40247982/article/details/106765819