diff --git a/code/DocsSample/graphic/ArkGraphics2D/ComplexTextDrawing/entry/src/main/ets/pages/Index.ets b/code/DocsSample/graphic/ArkGraphics2D/ComplexTextDrawing/entry/src/main/ets/pages/Index.ets index c6375ef3dafd01b7931a6f4bb268893a205fa9ad..6377501e78b474e6351670305f80451646a6756a 100644 --- a/code/DocsSample/graphic/ArkGraphics2D/ComplexTextDrawing/entry/src/main/ets/pages/Index.ets +++ b/code/DocsSample/graphic/ArkGraphics2D/ComplexTextDrawing/entry/src/main/ets/pages/Index.ets @@ -326,10 +326,10 @@ struct RenderTest { .shadow(ShadowStyle.OUTER_DEFAULT_LG) } .width('100%') - .justifyContent(FlexAlign.Center) - .shadow(ShadowStyle.OUTER_DEFAULT_SM) - .alignItems(VerticalAlign.Bottom) - .layoutWeight(1) + .justifyContent(FlexAlign.Center) // 设置当前Row容器内子元素在主轴上居中对齐 + .shadow(ShadowStyle.OUTER_DEFAULT_SM) // 设置Row容器外阴影效果 + .alignItems(VerticalAlign.Bottom) // 设置当前Row容器内子元素在交叉轴(垂直方向)上的对齐方式为底部对齐 + .layoutWeight(1) // 设置当前Row在父容器Column中的布局权重为1 } } } \ No newline at end of file diff --git a/code/DocsSample/graphic/ArkGraphics2D/CustomFont/entry/src/main/ets/pages/Index.ets b/code/DocsSample/graphic/ArkGraphics2D/CustomFont/entry/src/main/ets/pages/Index.ets index 78b39e126b2591501fef0a154d872db73f4dda5d..3b211fb9f1a802e9078bf8536c45d2ede1e7c1d8 100644 --- a/code/DocsSample/graphic/ArkGraphics2D/CustomFont/entry/src/main/ets/pages/Index.ets +++ b/code/DocsSample/graphic/ArkGraphics2D/CustomFont/entry/src/main/ets/pages/Index.ets @@ -122,10 +122,10 @@ struct RenderTest { .shadow(ShadowStyle.OUTER_DEFAULT_LG) } .width('100%') - .justifyContent(FlexAlign.Center) - .shadow(ShadowStyle.OUTER_DEFAULT_SM) - .alignItems(VerticalAlign.Bottom) - .layoutWeight(1) + .justifyContent(FlexAlign.Center) // 设置当前Row容器内子元素在主轴上居中对齐 + .shadow(ShadowStyle.OUTER_DEFAULT_SM) // 设置Row容器外阴影效果 + .alignItems(VerticalAlign.Bottom) // 设置当前Row容器内子元素在交叉轴(垂直方向)上的对齐方式为底部对齐 + .layoutWeight(1) // 设置当前Row在父容器Column中的布局权重为1 } } } \ No newline at end of file diff --git a/code/DocsSample/graphic/ArkGraphics2D/SimpleTextDrawing/entry/src/main/ets/pages/Index.ets b/code/DocsSample/graphic/ArkGraphics2D/SimpleTextDrawing/entry/src/main/ets/pages/Index.ets index 4261a2b9fee42c003cdcfd0aea155d77874ee04e..21bc70a70f91823356bd0140cac45200c15244e0 100644 --- a/code/DocsSample/graphic/ArkGraphics2D/SimpleTextDrawing/entry/src/main/ets/pages/Index.ets +++ b/code/DocsSample/graphic/ArkGraphics2D/SimpleTextDrawing/entry/src/main/ets/pages/Index.ets @@ -125,10 +125,10 @@ struct RenderTest { .shadow(ShadowStyle.OUTER_DEFAULT_LG) } .width('100%') - .justifyContent(FlexAlign.Center) - .shadow(ShadowStyle.OUTER_DEFAULT_SM) - .alignItems(VerticalAlign.Bottom) - .layoutWeight(1) + .justifyContent(FlexAlign.Center) // 设置当前Row容器内子元素在主轴上居中对齐 + .shadow(ShadowStyle.OUTER_DEFAULT_SM) // 设置Row容器外阴影效果 + .alignItems(VerticalAlign.Bottom) // 设置当前Row容器内子元素在交叉轴(垂直方向)上的对齐方式为底部对齐 + .layoutWeight(1) // 设置当前Row在父容器Column中的布局权重为1 } } } \ No newline at end of file diff --git a/code/DocsSample/graphic/ArkGraphics2D/SystemFontInfoGet/entry/src/main/ets/pages/Index.ets b/code/DocsSample/graphic/ArkGraphics2D/SystemFontInfoGet/entry/src/main/ets/pages/Index.ets index ccdfca51a5032286dc55314a34442ef973d325d3..5a12b78f7a7605f52f7fa3ab4fd63920610743b6 100644 --- a/code/DocsSample/graphic/ArkGraphics2D/SystemFontInfoGet/entry/src/main/ets/pages/Index.ets +++ b/code/DocsSample/graphic/ArkGraphics2D/SystemFontInfoGet/entry/src/main/ets/pages/Index.ets @@ -146,8 +146,8 @@ struct RenderTest { }.width('100%') } .width('100%') - .justifyContent(FlexAlign.Center) - .shadow(ShadowStyle.OUTER_DEFAULT_SM) - .layoutWeight(1) + .justifyContent(FlexAlign.Center) // 设置当前Row容器内子元素在主轴上居中对齐 + .shadow(ShadowStyle.OUTER_DEFAULT_SM) // 设置Row容器外阴影效果 + .layoutWeight(1) // 设置当前Row在父容器Column中的布局权重为1 } } \ No newline at end of file diff --git a/code/DocsSample/graphic/ArkGraphics2D/TextMetrics/entry/src/main/ets/pages/Index.ets b/code/DocsSample/graphic/ArkGraphics2D/TextMetrics/entry/src/main/ets/pages/Index.ets index 7466ca6243e3e8262f910c97175db6af66a7ca76..56eb942be5bfcaba4804311ad9df004d53c059c4 100644 --- a/code/DocsSample/graphic/ArkGraphics2D/TextMetrics/entry/src/main/ets/pages/Index.ets +++ b/code/DocsSample/graphic/ArkGraphics2D/TextMetrics/entry/src/main/ets/pages/Index.ets @@ -155,9 +155,9 @@ struct RenderTest { .height(40) } .width('100%') - .justifyContent(FlexAlign.Center) - .alignItems(VerticalAlign.Bottom) - .layoutWeight(1) + .justifyContent(FlexAlign.Center) // 设置当前Row容器内子元素在主轴上居中对齐 + .alignItems(VerticalAlign.Bottom) // 设置当前Row容器内子元素在交叉轴(垂直方向)上的对齐方式为底部对齐 + .layoutWeight(1) // 设置当前Row在父容器Column中的布局权重为1 } } } \ No newline at end of file diff --git a/code/DocsSample/graphic/ArkGraphics2D/ThemeFont/entry/src/main/ets/pages/Index.ets b/code/DocsSample/graphic/ArkGraphics2D/ThemeFont/entry/src/main/ets/pages/Index.ets index 757a3deb899af877f3640971ea6c1b309af38c73..cd50ae62bf2d0bf7f5992e0639162edbeded4e1a 100644 --- a/code/DocsSample/graphic/ArkGraphics2D/ThemeFont/entry/src/main/ets/pages/Index.ets +++ b/code/DocsSample/graphic/ArkGraphics2D/ThemeFont/entry/src/main/ets/pages/Index.ets @@ -135,10 +135,10 @@ struct RenderTest { .shadow(ShadowStyle.OUTER_DEFAULT_LG) } .width('100%') - .justifyContent(FlexAlign.Center) - .shadow(ShadowStyle.OUTER_DEFAULT_SM) - .alignItems(VerticalAlign.Bottom) - .layoutWeight(1) + .justifyContent(FlexAlign.Center) // 设置当前Row容器内子元素在主轴上居中对齐 + .shadow(ShadowStyle.OUTER_DEFAULT_SM) // 设置Row容器外阴影效果 + .alignItems(VerticalAlign.Bottom) // 设置当前Row容器内子元素在交叉轴(垂直方向)上的对齐方式为底部对齐 + .layoutWeight(1) // 设置当前Row在父容器Column中的布局权重为1 } } } diff --git a/code/DocsSample/graphic/NDKGraphics2D/NDKComplextext/entry/src/main/cpp/samples/sample_bitmap.cpp b/code/DocsSample/graphic/NDKGraphics2D/NDKComplextext/entry/src/main/cpp/samples/sample_bitmap.cpp index 9bb784bcac76696e2807c764c94071568d8ddd0e..89980f8f4dc46056214c64bc7357612a1e8c3943 100644 --- a/code/DocsSample/graphic/NDKGraphics2D/NDKComplextext/entry/src/main/cpp/samples/sample_bitmap.cpp +++ b/code/DocsSample/graphic/NDKGraphics2D/NDKComplextext/entry/src/main/cpp/samples/sample_bitmap.cpp @@ -187,9 +187,9 @@ void SampleBitMap::AddFontVariation() { OH_Drawing_SetTextStyleFontWeight(txtStyleNoVar, FONT_WEIGHT_400); // 创建 FontCollection,FontCollection 用于管理字体匹配逻辑 - OH_Drawing_FontCollection *fc = OH_Drawing_CreateSharedFontCollection(); + OH_Drawing_FontCollection *fontCollection = OH_Drawing_CreateSharedFontCollection(); // 使用 FontCollection 和 之前创建的 TypographyStyle 创建 TypographyCreate。TypographyCreate 用于创建 Typography - OH_Drawing_TypographyCreate *handler = OH_Drawing_CreateTypographyHandler(typoStyle, fc); + OH_Drawing_TypographyCreate *handler = OH_Drawing_CreateTypographyHandler(typoStyle, fontCollection); // 加入带有可变字体的文本样式 OH_Drawing_TypographyHandlerPushTextStyle(handler, txtStyleWithVar); @@ -218,7 +218,7 @@ void SampleBitMap::AddFontVariation() { OH_Drawing_DestroyTypographyStyle(typoStyle); OH_Drawing_DestroyTextStyle(txtStyleWithVar); OH_Drawing_DestroyTextStyle(txtStyleNoVar); - OH_Drawing_DestroyFontCollection(fc); + OH_Drawing_DestroyFontCollection(fontCollection); OH_Drawing_DestroyTypographyHandler(handler); OH_Drawing_DestroyTypography(typography); } @@ -238,7 +238,7 @@ void SampleBitMap::SetTextShadow() OH_Drawing_SetTextStyleFontSize(txtStyleWithShadow, 100); OH_Drawing_SetTextStyleFontWeight(txtStyleWithShadow, FONT_WEIGHT_400); // 设置阴影偏移量 - OH_Drawing_Point *offset = OH_Drawing_PointCreate(1, 1); + OH_Drawing_Point *offset = OH_Drawing_PointCreate(10, 10); OH_Drawing_TextShadow *shadow = OH_Drawing_CreateTextShadow(); // 为 TextShadow 设置样式 OH_Drawing_SetTextShadow(shadow, OH_Drawing_ColorSetArgb(0xFF, 0x00, 0x00, 0x00), offset, 10); @@ -253,9 +253,9 @@ void SampleBitMap::SetTextShadow() OH_Drawing_SetTextStyleFontWeight(txtStyleNoShadow, FONT_WEIGHT_400); // 创建 FontCollection,FontCollection 用于管理字体匹配逻辑 - OH_Drawing_FontCollection *fc = OH_Drawing_CreateSharedFontCollection(); + OH_Drawing_FontCollection *fontCollection = OH_Drawing_CreateSharedFontCollection(); // 使用 FontCollection 和 之前创建的 TypographyStyle 创建 TypographyCreate。TypographyCreate 用于创建 Typography - OH_Drawing_TypographyCreate *handler = OH_Drawing_CreateTypographyHandler(typoStyle, fc); + OH_Drawing_TypographyCreate *handler = OH_Drawing_CreateTypographyHandler(typoStyle, fontCollection); // 加入带有阴影的文本样式 OH_Drawing_TypographyHandlerPushTextStyle(handler, txtStyleWithShadow); @@ -281,7 +281,7 @@ void SampleBitMap::SetTextShadow() OH_Drawing_DestroyTextStyle(txtStyleWithShadow); OH_Drawing_DestroyTextShadow(shadow); OH_Drawing_DestroyTextStyle(txtStyleNoShadow); - OH_Drawing_DestroyFontCollection(fc); + OH_Drawing_DestroyFontCollection(fontCollection); OH_Drawing_DestroyTypographyHandler(handler); OH_Drawing_DestroyTypography(typography); } @@ -315,25 +315,26 @@ void SampleBitMap::SetTextBrush() OH_Drawing_SetTextStyleLocale(txtStyleWithBackgroundBrush, "zh-Hans"); // 设置文本的单词间距。 OH_Drawing_SetTextStyleWordSpacing(txtStyleWithBackgroundBrush, 5.0); - + // 设置文本大小。 OH_Drawing_SetTextStyleFontSize(txtStyleWithBackgroundBrush, 60); OH_Drawing_SetTextStyleFontWeight(txtStyleWithBackgroundBrush, FONT_WEIGHT_400); - //创建文本样式设置其前景色 + // 创建文本样式设置其前景色。 OH_Drawing_TextStyle *txtStyleWithForegrounddBrush = OH_Drawing_CreateTextStyle(); + // 设置文本大小。 OH_Drawing_SetTextStyleFontSize(txtStyleWithForegrounddBrush, 60); OH_Drawing_Brush* foregrounddBrush = OH_Drawing_BrushCreate(); - //设置字体前景色为绿色 + // 设置字体前景色为绿色。 OH_Drawing_BrushSetColor(foregrounddBrush, OH_Drawing_ColorSetArgb(255, 0, 255, 0)); // 设置指定文本样式中的前景色画刷。 OH_Drawing_SetTextStyleForegroundBrush(txtStyleWithForegrounddBrush, foregrounddBrush); - // 设置文本颜色为蓝色 + // 设置文本颜色为蓝色。 OH_Drawing_SetTextStyleColor(txtStyleWithForegrounddBrush, OH_Drawing_ColorSetArgb(0xFF, 0x00, 0x00, 0xFF)); // 创建 FontCollection,FontCollection 用于管理字体匹配逻辑 - OH_Drawing_FontCollection *fc = OH_Drawing_CreateSharedFontCollection(); - // 使用 FontCollection 和 之前创建的 TypographyStyle 创建 TypographyCreate。TypographyCreate 用于创建 Typography - OH_Drawing_TypographyCreate *handler = OH_Drawing_CreateTypographyHandler(typoStyle, fc); + OH_Drawing_FontCollection *fontCollection = OH_Drawing_CreateSharedFontCollection(); + // 使用 FontCollection 和 之前创建的 TypographyStyle 创建 TypographyCreate。TypographyCreate 用于创建 Typography。 + OH_Drawing_TypographyCreate *handler = OH_Drawing_CreateTypographyHandler(typoStyle, fontCollection); // 创建一个 placeholder,并且初始化其成员变量 OH_Drawing_PlaceholderSpan placeholder; @@ -376,7 +377,7 @@ void SampleBitMap::SetTextBrush() OH_Drawing_DestroyTypographyStyle(typoStyle); OH_Drawing_DestroyTextStyle(txtStyleWithBackgroundBrush); OH_Drawing_DestroyTextStyle(txtStyleWithForegrounddBrush); - OH_Drawing_DestroyFontCollection(fc); + OH_Drawing_DestroyFontCollection(fontCollection); OH_Drawing_DestroyTypographyHandler(handler); OH_Drawing_DestroyTypography(typography); } @@ -414,9 +415,9 @@ void SampleBitMap::SetTextEllipsis() OH_Drawing_SetTypographyTextMaxLines(typoStyle, 1); // 创建 FontCollection,FontCollection 用于管理字体匹配逻辑 - OH_Drawing_FontCollection *fc = OH_Drawing_CreateSharedFontCollection(); + OH_Drawing_FontCollection *fontCollection = OH_Drawing_CreateSharedFontCollection(); // 使用 FontCollection 和 之前创建的 TypographyStyle 创建 TypographyCreate。TypographyCreate 用于创建 Typography - OH_Drawing_TypographyCreate *handler = OH_Drawing_CreateTypographyHandler(typoStyle, fc); + OH_Drawing_TypographyCreate *handler = OH_Drawing_CreateTypographyHandler(typoStyle, fontCollection); // 将之前创建的 TextStyle 加入 handler 中 OH_Drawing_TypographyHandlerPushTextStyle(handler, txtStyle); @@ -455,7 +456,7 @@ void SampleBitMap::SetTextEllipsis() // 释放内存 OH_Drawing_DestroyTypographyStyle(typoStyle); OH_Drawing_DestroyTextStyle(txtStyle); - OH_Drawing_DestroyFontCollection(fc); + OH_Drawing_DestroyFontCollection(fontCollection); OH_Drawing_DestroyTypographyHandler(handler); OH_Drawing_DestroyTypography(typography); }