• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 #include "core/interfaces/native/node/text_timer_modifier.h"
16 
17 #include "bridge/common/utils/utils.h"
18 #include "core/components/text/text_theme.h"
19 #include "core/components_ng/base/view_abstract.h"
20 #include "core/components_ng/pattern/texttimer/text_timer_model_ng.h"
21 #include "core/components_ng/pattern/texttimer/text_timer_event_hub.h"
22 #include "core/common/resource/resource_parse_utils.h"
23 namespace OHOS::Ace::NG {
24 constexpr Dimension DEFAULT_FONT_SIZE = Dimension(16.0, DimensionUnit::FP);
25 const std::vector<std::string> DEFAULT_FONT_FAMILY = { "HarmonyOS Sans" };
26 const std::string DEFAULT_FORMAT = "HH:mm:ss.SS";
27 constexpr Ace::FontWeight DEFAULT_FONT_WEIGHT = Ace::FontWeight::NORMAL;
28 
29 namespace TextTimerModifier {
SetFontColor(ArkUINodeHandle node,ArkUI_Uint32 color)30 void SetFontColor(ArkUINodeHandle node, ArkUI_Uint32 color)
31 {
32     auto *frameNode = reinterpret_cast<FrameNode *>(node);
33     CHECK_NULL_VOID(frameNode);
34     TextTimerModelNG::SetFontColor(frameNode, Color(color));
35 }
36 
SetFontColorRes(ArkUINodeHandle node,ArkUI_Uint32 color,void * colorRawPtr)37 void SetFontColorRes(ArkUINodeHandle node, ArkUI_Uint32 color, void* colorRawPtr)
38 {
39     auto* frameNode = reinterpret_cast<FrameNode*>(node);
40     CHECK_NULL_VOID(frameNode);
41     TextTimerModelNG::SetFontColor(frameNode, Color(color));
42     if (SystemProperties::ConfigChangePerform()) {
43         if (colorRawPtr) {
44             auto* color = reinterpret_cast<ResourceObject*>(colorRawPtr);
45             auto colorResObj = AceType::Claim(color);
46             TextTimerModelNG::CreateWithResourceObj(frameNode, JsTextTimerResourceType::TEXTCOLOR, colorResObj);
47         } else {
48             TextTimerModelNG::CreateWithResourceObj(frameNode, JsTextTimerResourceType::TEXTCOLOR, nullptr);
49         }
50     }
51 }
52 
ResetFontColor(ArkUINodeHandle node)53 void ResetFontColor(ArkUINodeHandle node)
54 {
55     auto *frameNode = reinterpret_cast<FrameNode *>(node);
56     CHECK_NULL_VOID(frameNode);
57     auto pipelineContext = PipelineBase::GetCurrentContext();
58     CHECK_NULL_VOID(pipelineContext);
59     auto theme = pipelineContext->GetTheme<TextTheme>();
60     CHECK_NULL_VOID(theme);
61     TextTimerModelNG::SetFontColor(frameNode, theme->GetTextStyle().GetTextColor());
62     if (SystemProperties::ConfigChangePerform()) {
63         TextTimerModelNG::CreateWithResourceObj(frameNode, JsTextTimerResourceType::TEXTCOLOR, nullptr);
64         TextTimerModelNG::SetTextColorByUser(frameNode, false);
65     }
66 }
67 
SetFontSize(ArkUINodeHandle node,ArkUI_Float32 value,ArkUI_Int32 unit)68 void SetFontSize(ArkUINodeHandle node, ArkUI_Float32 value, ArkUI_Int32 unit)
69 {
70     auto *frameNode = reinterpret_cast<FrameNode *>(node);
71     CHECK_NULL_VOID(frameNode);
72     TextTimerModelNG::SetFontSize(frameNode, Dimension(value, static_cast<DimensionUnit>(unit)));
73 }
74 
SetFontSizeRes(ArkUINodeHandle node,ArkUI_Float32 value,ArkUI_Int32 unit,void * fontSizeRawPtr)75 void SetFontSizeRes(ArkUINodeHandle node, ArkUI_Float32 value, ArkUI_Int32 unit, void* fontSizeRawPtr)
76 {
77     auto* frameNode = reinterpret_cast<FrameNode*>(node);
78     CHECK_NULL_VOID(frameNode);
79     TextTimerModelNG::SetFontSize(frameNode, Dimension(value, static_cast<DimensionUnit>(unit)));
80     if (SystemProperties::ConfigChangePerform()) {
81         if (fontSizeRawPtr) {
82             auto* fontSize = reinterpret_cast<ResourceObject*>(fontSizeRawPtr);
83             auto fontSizeResObj = AceType::Claim(fontSize);
84             TextTimerModelNG::CreateWithResourceObj(frameNode, JsTextTimerResourceType::FONTSIZE, fontSizeResObj);
85         } else {
86             TextTimerModelNG::CreateWithResourceObj(frameNode, JsTextTimerResourceType::FONTSIZE, nullptr);
87         }
88     }
89 }
90 
ResetFontSize(ArkUINodeHandle node)91 void ResetFontSize(ArkUINodeHandle node)
92 {
93     auto *frameNode = reinterpret_cast<FrameNode *>(node);
94     CHECK_NULL_VOID(frameNode);
95     TextTimerModelNG::SetFontSize(frameNode, DEFAULT_FONT_SIZE);
96     if (SystemProperties::ConfigChangePerform()) {
97         TextTimerModelNG::CreateWithResourceObj(frameNode, JsTextTimerResourceType::FONTSIZE, nullptr);
98         TextTimerModelNG::SetFontSizeByUser(frameNode, false);
99     }
100 }
101 
SetFontStyle(ArkUINodeHandle node,ArkUI_Uint32 value)102 void SetFontStyle(ArkUINodeHandle node, ArkUI_Uint32 value)
103 {
104     auto *frameNode = reinterpret_cast<FrameNode *>(node);
105     CHECK_NULL_VOID(frameNode);
106     TextTimerModelNG::SetFontStyle(frameNode, static_cast<Ace::FontStyle>(value));
107 }
108 
ResetFontStyle(ArkUINodeHandle node)109 void ResetFontStyle(ArkUINodeHandle node)
110 {
111     auto *frameNode = reinterpret_cast<FrameNode *>(node);
112     CHECK_NULL_VOID(frameNode);
113     TextTimerModelNG::SetFontStyle(frameNode, OHOS::Ace::FontStyle::NORMAL);
114 }
115 
SetFontWeight(ArkUINodeHandle node,ArkUI_CharPtr fontWeight)116 void SetFontWeight(ArkUINodeHandle node, ArkUI_CharPtr fontWeight)
117 {
118     auto *frameNode = reinterpret_cast<FrameNode *>(node);
119     CHECK_NULL_VOID(frameNode);
120     std::string fontWeightStr = fontWeight;
121     TextTimerModelNG::SetFontWeight(frameNode, Framework::ConvertStrToFontWeight(fontWeightStr));
122 }
123 
SetFontWeightRes(ArkUINodeHandle node,ArkUI_CharPtr fontWeight,void * fontWeightRawPtr)124 void SetFontWeightRes(ArkUINodeHandle node, ArkUI_CharPtr fontWeight, void* fontWeightRawPtr)
125 {
126     auto* frameNode = reinterpret_cast<FrameNode*>(node);
127     CHECK_NULL_VOID(frameNode);
128     std::string fontWeightStr = fontWeight;
129     TextTimerModelNG::SetFontWeight(frameNode, Framework::ConvertStrToFontWeight(fontWeightStr));
130     if (SystemProperties::ConfigChangePerform() && fontWeightRawPtr) {
131         if (fontWeightRawPtr) {
132             auto* fontWeight = reinterpret_cast<ResourceObject*>(fontWeightRawPtr);
133             auto fontWeightResObj = AceType::Claim(fontWeight);
134             TextTimerModelNG::CreateWithResourceObj(frameNode, JsTextTimerResourceType::FONTWEIGHT, fontWeightResObj);
135         } else {
136             TextTimerModelNG::CreateWithResourceObj(frameNode, JsTextTimerResourceType::FONTWEIGHT, nullptr);
137         }
138     }
139 }
140 
ResetFontWeight(ArkUINodeHandle node)141 void ResetFontWeight(ArkUINodeHandle node)
142 {
143     auto *frameNode = reinterpret_cast<FrameNode *>(node);
144     CHECK_NULL_VOID(frameNode);
145     TextTimerModelNG::SetFontWeight(frameNode, DEFAULT_FONT_WEIGHT);
146     if (SystemProperties::ConfigChangePerform()) {
147         TextTimerModelNG::CreateWithResourceObj(frameNode, JsTextTimerResourceType::FONTWEIGHT, nullptr);
148         TextTimerModelNG::SetFontWeightByUser(frameNode, false);
149     }
150 }
151 
SetFontFamily(ArkUINodeHandle node,ArkUI_CharPtr fontFamily)152 void SetFontFamily(ArkUINodeHandle node, ArkUI_CharPtr fontFamily)
153 {
154     auto* frameNode = reinterpret_cast<FrameNode*>(node);
155     CHECK_NULL_VOID(frameNode);
156     std::string familiesStr = fontFamily;
157     std::vector<std::string> fontFamilyResult = Framework::ConvertStrToFontFamilies(familiesStr);
158     TextTimerModelNG::SetFontFamily(frameNode, fontFamilyResult);
159 }
160 
SetFontFamilyRes(ArkUINodeHandle node,ArkUI_CharPtr fontFamily,void * fontFamilyRawPtr)161 void SetFontFamilyRes(ArkUINodeHandle node, ArkUI_CharPtr fontFamily, void* fontFamilyRawPtr)
162 {
163     auto* frameNode = reinterpret_cast<FrameNode*>(node);
164     CHECK_NULL_VOID(frameNode);
165     std::string familiesStr = fontFamily;
166     std::vector<std::string> fontFamilyResult = Framework::ConvertStrToFontFamilies(familiesStr);
167     TextTimerModelNG::SetFontFamily(frameNode, fontFamilyResult);
168     if (SystemProperties::ConfigChangePerform()) {
169         if (fontFamilyRawPtr) {
170             auto* fontFamily = reinterpret_cast<ResourceObject*>(fontFamilyRawPtr);
171             auto fontFamilyResObj = AceType::Claim(fontFamily);
172             TextTimerModelNG::CreateWithResourceObj(frameNode, JsTextTimerResourceType::FONTFAMILY, fontFamilyResObj);
173         } else {
174             TextTimerModelNG::CreateWithResourceObj(frameNode, JsTextTimerResourceType::FONTFAMILY, nullptr);
175         }
176     }
177 }
178 
ResetFontFamily(ArkUINodeHandle node)179 void ResetFontFamily(ArkUINodeHandle node)
180 {
181     auto *frameNode = reinterpret_cast<FrameNode *>(node);
182     CHECK_NULL_VOID(frameNode);
183     TextTimerModelNG::SetFontFamily(frameNode, DEFAULT_FONT_FAMILY);
184     if (SystemProperties::ConfigChangePerform()) {
185         TextTimerModelNG::CreateWithResourceObj(frameNode, JsTextTimerResourceType::FONTFAMILY, nullptr);
186         TextTimerModelNG::SetFontFamilyByUser(frameNode, false);
187     }
188 }
189 
SetFormat(ArkUINodeHandle node,ArkUI_CharPtr format)190 void SetFormat(ArkUINodeHandle node, ArkUI_CharPtr format)
191 {
192     auto* frameNode = reinterpret_cast<FrameNode*>(node);
193     CHECK_NULL_VOID(frameNode);
194     std::string formatStr = format;
195     std::smatch result;
196     std::regex pattern("(([YyMdD]+))");
197     if (std::regex_search(formatStr, result, pattern)) {
198         if (!result.empty()) {
199             formatStr = DEFAULT_FORMAT;
200         }
201     }
202 
203     std::string target = "HmsS:.";
204     for (auto ch : formatStr) {
205         if (target.find(ch) == std::string::npos) {
206             formatStr = DEFAULT_FORMAT;
207         }
208     }
209 
210     auto pos = formatStr.find("hh");
211     if (pos != std::string::npos) {
212         formatStr.replace(pos, sizeof("hh") - 1, "HH");
213     }
214     TextTimerModelNG::SetFormat(frameNode, formatStr);
215 }
216 
ResetFormat(ArkUINodeHandle node)217 void ResetFormat(ArkUINodeHandle node)
218 {
219     auto* frameNode = reinterpret_cast<FrameNode*>(node);
220     CHECK_NULL_VOID(frameNode);
221     TextTimerModelNG::SetFormat(frameNode, DEFAULT_FORMAT);
222 }
223 
SetTextShadow(ArkUINodeHandle node,struct ArkUITextShadowStruct * shadows,ArkUI_Uint32 length)224 void SetTextShadow(ArkUINodeHandle node, struct ArkUITextShadowStruct* shadows, ArkUI_Uint32 length)
225 {
226     CHECK_NULL_VOID(shadows);
227     auto* frameNode = reinterpret_cast<FrameNode*>(node);
228     CHECK_NULL_VOID(frameNode);
229     std::vector<Shadow> shadowList(length);
230     for (uint32_t i = 0; i < length; i++) {
231         Shadow shadow;
232         ArkUITextShadowStruct* shadowStruct = shadows + i;
233         shadow.SetBlurRadius(shadowStruct->radius);
234         shadow.SetShadowType(static_cast<ShadowType>(shadowStruct->type));
235         shadow.SetColor(Color(shadowStruct->color));
236         shadow.SetOffsetX(shadowStruct->offsetX);
237         shadow.SetOffsetY(shadowStruct->offsetY);
238         shadow.SetIsFilled(static_cast<bool>(shadowStruct->fill));
239         shadowList.at(i) = shadow;
240     }
241     TextTimerModelNG::SetTextShadow(frameNode, shadowList);
242 }
243 
ParseShadowRadiusUpdate(const RefPtr<ResourceObject> & radiusResObj,Shadow & shadow)244 void ParseShadowRadiusUpdate(const RefPtr<ResourceObject>& radiusResObj, Shadow& shadow)
245 {
246     if (!radiusResObj) {
247         return;
248     }
249     auto&& updateFunc = [](const RefPtr<ResourceObject>& resObj, Shadow& shadow) {
250         double radius = 0.0;
251         ResourceParseUtils::ParseResDouble(resObj, radius);
252         shadow.SetBlurRadius(std::max(radius, 0.0));
253     };
254     shadow.AddResource("shadow.radius", radiusResObj, std::move(updateFunc));
255 }
256 
ParseShadowColorUpdate(const RefPtr<ResourceObject> & colorResObj,Shadow & shadow)257 void ParseShadowColorUpdate(const RefPtr<ResourceObject>& colorResObj, Shadow& shadow)
258 {
259     if (!colorResObj) {
260         return;
261     }
262     auto&& updateFunc = [](const RefPtr<ResourceObject>& resObj, Shadow& shadow) {
263         Color color;
264         ResourceParseUtils::ParseResColor(resObj, color);
265         shadow.SetColor(color);
266     };
267     shadow.AddResource("shadow.colorValue", colorResObj, std::move(updateFunc));
268 }
269 
ParseShadowOffsetXUpdate(const RefPtr<ResourceObject> & offsetXResObj,Shadow & shadow)270 void ParseShadowOffsetXUpdate(const RefPtr<ResourceObject>& offsetXResObj, Shadow& shadow)
271 {
272     if (!offsetXResObj) {
273         return;
274     }
275     auto&& updateFunc = [](const RefPtr<ResourceObject>& resObj, Shadow& shadow) {
276         CalcDimension xValue;
277         ResourceParseUtils::ParseResResource(resObj, xValue);
278         shadow.SetOffsetX(xValue.Value());
279     };
280     shadow.AddResource("shadow.offsetX", offsetXResObj, std::move(updateFunc));
281 }
282 
ParseShadowOffsetYUpdate(const RefPtr<ResourceObject> & offsetYResObj,Shadow & shadow)283 void ParseShadowOffsetYUpdate(const RefPtr<ResourceObject>& offsetYResObj, Shadow& shadow)
284 {
285     if (!offsetYResObj) {
286         return;
287     }
288     auto&& updateFunc = [](const RefPtr<ResourceObject>& resObj, Shadow& shadow) {
289         CalcDimension yValue;
290         ResourceParseUtils::ParseResResource(resObj, yValue);
291         shadow.SetOffsetY(yValue.Value());
292     };
293     shadow.AddResource("shadow.offsetY", offsetYResObj, std::move(updateFunc));
294 }
295 
SetTextShadowRes(ArkUINodeHandle node,ArkUITextShadowStruct * shadows,ArkUITextShadowResStruct * shadowsRes,ArkUI_Uint32 length)296 void SetTextShadowRes(
297     ArkUINodeHandle node, ArkUITextShadowStruct* shadows, ArkUITextShadowResStruct* shadowsRes, ArkUI_Uint32 length)
298 {
299     CHECK_NULL_VOID(shadows);
300     CHECK_NULL_VOID(shadowsRes);
301     auto* frameNode = reinterpret_cast<FrameNode*>(node);
302     CHECK_NULL_VOID(frameNode);
303     std::vector<Shadow> shadowList(length);
304     for (uint32_t i = 0; i < length; i++) {
305         Shadow shadow;
306         ArkUITextShadowStruct* shadowStruct = &shadows[i];
307         ArkUITextShadowResStruct* shadowResStruct = &shadowsRes[i];
308         shadow.SetBlurRadius(shadowStruct->radius);
309         shadow.SetShadowType(static_cast<ShadowType>(shadowStruct->type));
310         shadow.SetColor(Color(shadowStruct->color));
311         shadow.SetOffsetX(shadowStruct->offsetX);
312         shadow.SetOffsetY(shadowStruct->offsetY);
313         shadow.SetIsFilled(static_cast<bool>(shadowStruct->fill));
314         if (SystemProperties::ConfigChangePerform()) {
315             auto* radius = shadowResStruct->radiusResObj ?
316                 reinterpret_cast<ResourceObject*>(shadowResStruct->radiusResObj) : nullptr;
317             if (radius) {
318                 ParseShadowRadiusUpdate(AceType::Claim(radius), shadow);
319             }
320             auto* color = shadowResStruct->colorResObj ?
321                 reinterpret_cast<ResourceObject*>(shadowResStruct->colorResObj) : nullptr;
322                 if (color) {
323                 ParseShadowColorUpdate(AceType::Claim(color), shadow);
324             }
325             auto* offsetX = shadowResStruct->offsetXResObj ?
326                 reinterpret_cast<ResourceObject*>(shadowResStruct->offsetXResObj) : nullptr;
327             if (offsetX) {
328                 ParseShadowOffsetXUpdate(AceType::Claim(offsetX), shadow);
329             }
330             auto* offsetY = shadowResStruct->offsetYResObj ?
331                 reinterpret_cast<ResourceObject*>(shadowResStruct->offsetYResObj) : nullptr;
332             if (offsetY) {
333                 ParseShadowOffsetYUpdate(AceType::Claim(offsetY), shadow);
334             }
335         }
336         shadowList.at(i) = shadow;
337     }
338     TextTimerModelNG::SetTextShadow(frameNode, shadowList);
339 }
ResetTextShadow(ArkUINodeHandle node)340 void ResetTextShadow(ArkUINodeHandle node)
341 {
342     auto* frameNode = reinterpret_cast<FrameNode*>(node);
343     CHECK_NULL_VOID(frameNode);
344     Shadow shadow;
345     shadow.SetOffsetX(0.0);
346     shadow.SetOffsetY(0.0);
347     TextTimerModelNG::SetTextShadow(frameNode, std::vector<Shadow> { shadow });
348 }
349 
setTextTimerOptions(ArkUINodeHandle node,ArkUI_Bool isCountDown,ArkUI_Float64 count)350 void setTextTimerOptions(ArkUINodeHandle node, ArkUI_Bool isCountDown, ArkUI_Float64 count)
351 {
352     auto* frameNode = reinterpret_cast<FrameNode*>(node);
353     CHECK_NULL_VOID(frameNode);
354     TextTimerModelNG::SetIsCountDown(frameNode, isCountDown);
355     if (isCountDown) {
356         TextTimerModelNG::SetInputCount(frameNode, count);
357     }
358 }
359 
SetTextTimerOnTimer(ArkUINodeHandle node,void * callback)360 void SetTextTimerOnTimer(ArkUINodeHandle node, void* callback)
361 {
362     auto* frameNode = reinterpret_cast<FrameNode*>(node);
363     CHECK_NULL_VOID(frameNode);
364     if (callback) {
365         auto onTimer = reinterpret_cast<ChangeEvent*>(callback);
366         TextTimerModelNG::SetOnTimer(frameNode, std::move(*onTimer));
367     } else {
368         TextTimerModelNG::SetOnTimer(frameNode, nullptr);
369     }
370 }
371 
ResetTextTimerOnTimer(ArkUINodeHandle node)372 void ResetTextTimerOnTimer(ArkUINodeHandle node)
373 {
374     auto* frameNode = reinterpret_cast<FrameNode*>(node);
375     CHECK_NULL_VOID(frameNode);
376     TextTimerModelNG::SetOnTimer(frameNode, nullptr);
377 }
378 } // namespace TextTimerModifier
379 
380 namespace NodeModifier {
GetTextTimerModifier()381 const ArkUITextTimerModifier* GetTextTimerModifier()
382 {
383     CHECK_INITIALIZED_FIELDS_BEGIN(); // don't move this line
384     static const ArkUITextTimerModifier modifier = {
385         .setFontColor = TextTimerModifier::SetFontColor,
386         .setFontColorRes = TextTimerModifier::SetFontColorRes,
387         .resetFontColor = TextTimerModifier::ResetFontColor,
388         .setFontSize = TextTimerModifier::SetFontSize,
389         .setFontSizeRes = TextTimerModifier::SetFontSizeRes,
390         .resetFontSize = TextTimerModifier::ResetFontSize,
391         .setFontStyle = TextTimerModifier::SetFontStyle,
392         .resetFontStyle = TextTimerModifier::ResetFontStyle,
393         .setFontWeight = TextTimerModifier::SetFontWeight,
394         .setFontWeightRes = TextTimerModifier::SetFontWeightRes,
395         .resetFontWeight = TextTimerModifier::ResetFontWeight,
396         .setFontFamily = TextTimerModifier::SetFontFamily,
397         .setFontFamilyRes = TextTimerModifier::SetFontFamilyRes,
398         .resetFontFamily = TextTimerModifier::ResetFontFamily,
399         .setFormat = TextTimerModifier::SetFormat,
400         .resetFormat = TextTimerModifier::ResetFormat,
401         .setTextShadow = TextTimerModifier::SetTextShadow,
402         .setTextShadowRes = TextTimerModifier::SetTextShadowRes,
403         .resetTextShadow = TextTimerModifier::ResetTextShadow,
404         .setTextTimerOptions = TextTimerModifier::setTextTimerOptions,
405         .setTextTimerOnTimer = TextTimerModifier::SetTextTimerOnTimer,
406         .resetTextTimerOnTimer = TextTimerModifier::ResetTextTimerOnTimer,
407     };
408     CHECK_INITIALIZED_FIELDS_END(modifier, 0, 0, 0); // don't move this line
409 
410     return &modifier;
411 }
412 
GetCJUITextTimerModifier()413 const CJUITextTimerModifier* GetCJUITextTimerModifier()
414 {
415     CHECK_INITIALIZED_FIELDS_BEGIN(); // don't move this line
416     static const CJUITextTimerModifier modifier = {
417         .setFontColor = TextTimerModifier::SetFontColor,
418         .setFontColorRes = TextTimerModifier::SetFontColorRes,
419         .resetFontColor = TextTimerModifier::ResetFontColor,
420         .setFontSize = TextTimerModifier::SetFontSize,
421         .setFontSizeRes = TextTimerModifier::SetFontSizeRes,
422         .resetFontSize = TextTimerModifier::ResetFontSize,
423         .setFontStyle = TextTimerModifier::SetFontStyle,
424         .resetFontStyle = TextTimerModifier::ResetFontStyle,
425         .setFontWeight = TextTimerModifier::SetFontWeight,
426         .setFontWeightRes = TextTimerModifier::SetFontWeightRes,
427         .resetFontWeight = TextTimerModifier::ResetFontWeight,
428         .setFontFamily = TextTimerModifier::SetFontFamily,
429         .setFontFamilyRes = TextTimerModifier::SetFontFamilyRes,
430         .resetFontFamily = TextTimerModifier::ResetFontFamily,
431         .setFormat = TextTimerModifier::SetFormat,
432         .resetFormat = TextTimerModifier::ResetFormat,
433         .setTextShadow = TextTimerModifier::SetTextShadow,
434         .setTextShadowRes = TextTimerModifier::SetTextShadowRes,
435         .resetTextShadow = TextTimerModifier::ResetTextShadow,
436     };
437     CHECK_INITIALIZED_FIELDS_END(modifier, 0, 0, 0); // don't move this line
438 
439     return &modifier;
440 }
441 } // namespace NodeModifier
442 } // namespace OHOS::Ace::NG
443