HarmonyOS CAPI计算带首行缩进的文本的宽高怎么设置缩进?

OH\_Drawing\_TypographySetIndents 使用这个api设置首行缩进,计算出的文本宽高不对,缩进没生效

我的用法:

const float indents[] = { 100.0f };
OH_Drawing_TypographySetIndents(m_typography.get(), 1, indents);
阅读 649
1 个回答

目前的代码会导致第一行缩进100,第二行和后继行默认按照第一行都缩进100.

可以改成以下代码:

const float indents[] = { 100.0f, 0.0f };
OH_Drawing_TypographySetIndents(m_typography.get(), 2, indents);

保证了第一行缩进100,第二行不缩进,后继行和第二行一致,都不缩进。