!9827 ellipsis 增加默认值

Merge pull request !9827 from luhan/add_default_value
This commit is contained in:
openharmony_ci 2024-04-08 15:42:49 +00:00 committed by Gitee
commit 8c7127a92f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 12 additions and 0 deletions

View File

@ -105,6 +105,7 @@ struct TypographyStyle {
bool customTextStyle = false;
TextHeightBehavior textHeightBehavior = TextHeightBehavior::ALL;
bool hintingIsOn = false;
bool ellipsizedForNDK = false;
};
} // namespace Rosen
} // namespace OHOS

View File

@ -1061,6 +1061,14 @@ void OH_Drawing_SetTypographyTextEllipsisModal(OH_Drawing_TypographyStyle* style
#else
ConvertToOriginalText<TypographyStyle>(style)->ellipsisModal = rosenEllipsisModal;
#endif
if (!ConvertToOriginalText<TypographyStyle>(style)->ellipsizedForNDK) {
#ifndef USE_GRAPHIC_TEXT_GINE
ConvertToOriginalText<TypographyStyle>(style)->ellipsis_ = TypographyStyle::ELLIPSIS;
#else
ConvertToOriginalText<TypographyStyle>(style)->ellipsis = TypographyStyle::ELLIPSIS;
#endif
ConvertToOriginalText<TypographyStyle>(style)->ellipsizedForNDK = true;
}
}
double OH_Drawing_TypographyGetLineHeight(OH_Drawing_Typography* typography, int lineNumber)
@ -1813,6 +1821,7 @@ void OH_Drawing_SetTypographyTextEllipsis(OH_Drawing_TypographyStyle* style, con
#else
ConvertToOriginalText<TypographyStyle>(style)->ellipsis = u16Ellipsis;
#endif
ConvertToOriginalText<TypographyStyle>(style)->ellipsizedForNDK = true;
}
void OH_Drawing_TextStyleSetBackgroundRect(OH_Drawing_TextStyle* style, const OH_Drawing_RectStyle_Info* rectStyleInfo,

View File

@ -33,6 +33,7 @@ namespace TextEngine {
* including parameters for default TextStyle, multi-text, and line style.
*/
struct TypographyStyle {
const static inline std::u16string ELLIPSIS = u"\u2026";
// default TextStyle
FontWeight fontWeight = FontWeight::W400;
FontStyle fontStyle = FontStyle::NORMAL;
@ -77,6 +78,7 @@ struct TypographyStyle {
* @brief Returns the default TextStyle.
*/
TextStyle ConvertToTextStyle() const;
bool ellipsizedForNDK = false;
};
} // namespace TextEngine
} // namespace Rosen