OpenCAX/entry/src/main/cpp/NativeEGLOCCT/TextStyle/TextStyle.cpp

38 lines
1.1 KiB
C++

//
// Created on 2026/3/6.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".
#include "TextStyle.h"
#ifndef NATIVE_TAG
#define NATIVE_TAG "TEXTSTYLE"
#endif
namespace NativeOpenCAX {
TextStyle::TextStyle() : text(nullptr) {}
TextStyle::~TextStyle() {}
bool TextStyle::InitTextStyle() {
try {
text = new Prs3d_TextAspect();
text->SetFont("HarmonyOS Sans");
text->SetHeight(12);
text->Aspect()->SetColor(Quantity_NOC_GRAY95);
text->Aspect()->SetColorSubTitle(Quantity_NOC_BLACK);
text->Aspect()->SetDisplayType(Aspect_TODT_SHADOW);
text->Aspect()->SetTextFontAspect(Font_FA_Bold);
text->Aspect()->SetTextZoomable(false);
text->SetHorizontalJustification(Graphic3d_HTA_LEFT);
text->SetVerticalJustification(Graphic3d_VTA_BOTTOM);
HILOG_INFO(NATIVE_TAG, "InitTextSyle Done");
return true;
} catch (std::exception &e) {
HILOG_INFO(NATIVE_TAG, "InitTextSyle Fail:%{public}d", e.what());
return false;
}
}
}