fix: fix corner annotation chinese text render bug

This commit is contained in:
kradchen
2025-10-24 13:30:52 +08:00
parent a930ca91fc
commit 2ec3ed9143

View File

@@ -9,7 +9,9 @@
#include <vtkCoordinate.h>
vtkStandardNewMacro(FastCornerAnnotationActor);
namespace{
const char* FONT_FILE_PATH = "C:/Windows/Fonts/simhei.ttf";
}
FastCornerAnnotationActor::FastCornerAnnotationActor()
: vtkProp(){
for (int i = 0; i < 8; ++i) {
@@ -17,8 +19,8 @@ FastCornerAnnotationActor::FastCornerAnnotationActor()
Actors[i]->Register(this);
Actors[i]->SetTextScaleModeToNone();
Actors[i]->SetUseBorderAlign(true);
Actors[i]->GetTextProperty()->SetFontFamilyToCourier();
Actors[i]->GetTextProperty()->SetFontSize(6);
Actors[i]->GetTextProperty()->SetFontFamily(VTK_FONT_FILE);
Actors[i]->GetTextProperty()->SetFontFile(FONT_FILE_PATH);
Actors[i]->GetTextProperty()->BoldOn();
Actors[i]->GetTextProperty()->ShadowOn();
Actors[i]->GetActualPositionCoordinate()->SetCoordinateSystemToDisplay();