1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef SCENE_INTERFACE_ITEXT_H 17 #define SCENE_INTERFACE_ITEXT_H 18 19 #include <scene/base/types.h> 20 21 SCENE_BEGIN_NAMESPACE() 22 23 enum class FontMethod : uint8_t { 24 /** Normal raster fonts */ 25 RASTER = 0, 26 /** Sdf fonts */ 27 SDF = 1, 28 /** 3D Text */ 29 TEXT3D = 2 30 }; 31 32 class IText : public CORE_NS::IInterface { 33 META_INTERFACE(CORE_NS::IInterface, IText, "762c970b-456f-4405-b698-e453e60b426d") 34 public: 35 META_PROPERTY(BASE_NS::string, Text) 36 META_PROPERTY(BASE_NS::string, FontFamily) 37 META_PROPERTY(BASE_NS::string, FontStyle) 38 META_PROPERTY(float, FontSize) 39 META_PROPERTY(float, Font3DThickness) 40 META_PROPERTY(SCENE_NS::FontMethod, FontMethod) 41 META_PROPERTY(BASE_NS::Math::Vec4, TextColor) 42 }; 43 44 META_REGISTER_CLASS(TextNode, "fd2f62e8-d91f-4408-b653-038a76b08121", META_NS::ObjectCategoryBits::NO_CATEGORY) 45 SCENE_END_NAMESPACE() 46 47 META_TYPE(SCENE_NS::FontMethod) 48 META_INTERFACE_TYPE(SCENE_NS::IText) 49 50 #endif 51