From 3eb5490e6f8d8217be96db0bf782e060342d2e29 Mon Sep 17 00:00:00 2001 From: liuwei Date: Wed, 27 Mar 2024 17:46:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Endk=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuwei Change-Id: Id88236e212f89c437c18a1774b69c2557b31c1c5 --- .../native_drawing/drawing_text_typography.h | 227 +++++++++++++++++- .../native_drawing/libnative_drawing.ndk.json | 88 +++++++ 2 files changed, 314 insertions(+), 1 deletion(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index e911f8512ce..d197242090d 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -1684,6 +1684,231 @@ float OH_Drawing_TypographyGetIndentsWithIndex(OH_Drawing_Typography*, int); */ void OH_Drawing_DestroyTextShadows(OH_Drawing_TextShadow*); +/** + * @brief Mark the Typography as dirty, and initially state the Typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to the text OH_Drawing_Typography object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TypographyMarkDirty(OH_Drawing_Typography*); + +/** + * @brief Get the unresolved Glyphs count of lines in a text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to the text OH_Drawing_Typography object. + * @return Returns unresolved Glyphs count. + * @since 12 + * @version 1.0 + */ +int32_t OH_Drawing_TypographyGetUnresolvedGlyphsCount(OH_Drawing_Typography*); + +/** + * @brief Update the font size of lines in a text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to the text OH_Drawing_Typography object. + * @param from Indicates the source of the original font size. + * @param to Indicates the destination of the updated font size. + * @param fontSize Indicates the size of the font. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TypographyUpdateFontSize(OH_Drawing_Typography*, size_t from, size_t to, float fontSize); + +/** + * @brief Get whether the text layout enables line styles. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to the text OH_Drawing_TypographyStyle object. + * @return Whether or not to enable line styles in text layout only, true means enable, false means disable. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TypographyTextGetLineStyle(OH_Drawing_TypographyStyle*); + +/** + * @brief Get the font weight of line style for text typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @return Return the font weight of line style for text typography. + * For details, see the enum OH_Drawing_FontWeight. + * @since 12 + * @version 1.0 + */ +OH_Drawing_FontWeight OH_Drawing_TypographyTextlineStyleGetFontWeight(OH_Drawing_TypographyStyle*); + +/** + * @brief Get the font style of line style for text typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @return Return the font style of line style for text typography. + * For details, see the enum OH_Drawing_FontStyle. + * @since 12 + * @version 1.0 + */ +OH_Drawing_FontStyle OH_Drawing_TypographyTextlineStyleGetFontStyle(OH_Drawing_TypographyStyle*); + +/** + * @brief Get the font families of line style for text typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @param num The number of obtained font names. + * @return Return the font families of line style for text typography. + * @since 12 + * @version 1.0 + */ +char** OH_Drawing_TypographyTextlineStyleGetFontFamilies(OH_Drawing_TypographyStyle*, size_t* num); + +/** + * @brief Releases the memory occupied by a list of font families names. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param fontFamilies Indicates the pointer to a list of font families names. + * @param fontFamiliesNum Indicates the number of obtained font names. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TypographyTextlineStyleDestroyFontFamilies(char** fontFamilies, size_t fontFamiliesNum); + +/** + * @brief Get the font size of font size for text typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @return Return the font size of font size for text typography. + * @since 12 + * @version 1.0 + */ +double OH_Drawing_TypographyTextlineStyleGetFontSize(OH_Drawing_TypographyStyle*); + +/** + * @brief Get the font height scale in text layout. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @return Retrun the font height scale in text layout. + * @since 12 + * @version 1.0 + */ +double OH_Drawing_TypographyTextlineStyleGetHeightScale(OH_Drawing_TypographyStyle*); + +/** + * @brief Get whether to enable font height for line styles in text layout only. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @return Whether or not to enable the font height for line styles in text layout only, + * true means enable, false means disable. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TypographyTextlineStyleGetHeightOnly(OH_Drawing_TypographyStyle*); + +/** + * @brief Get the half leading of line style for text typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @return Whether to enable the text line half leading style, true means enable, false means disable. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TypographyTextlineStyleGetHalfLeading(OH_Drawing_TypographyStyle*); + +/** + * @brief Get the spacing scale of line style for text typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @return Return the spacing scale of line style for text typography. + * @since 12 + * @version 1.0 + */ +double OH_Drawing_TypographyTextlineStyleGetSpacingScale(OH_Drawing_TypographyStyle*); + +/** + * @brief Get whether only line style is enabled for text typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @return Returns whether only line style is enabled for text layout, true means it is enabled, false means it is not. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TypographyTextlineGetStyleOnly(OH_Drawing_TypographyStyle*); + +/** + * @brief Get the text alignment mode. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @return Return the text alignment mode. For details, see the enum OH_Drawing_TextAlign. + * @since 12 + * @version 1.0 + */ +OH_Drawing_TextAlign OH_Drawing_TypographyGetTextAlign(OH_Drawing_TypographyStyle*); + +/** + * @brief Get the text direction. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @return Return the text direction. For details, see the enum OH_Drawing_TextDirection. + * @since 12 + * @version 1.0 + */ +OH_Drawing_TextDirection OH_Drawing_TypographyGetTextDirection(OH_Drawing_TypographyStyle*); + +/** + * @brief Sets the maximum number of lines in a text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @return Return the maximum number of lines in a text. + * @since 12 + * @version 1.0 + */ +size_t OH_Drawing_TypographyGetTextMaxLines(OH_Drawing_TypographyStyle*); + +/** + * @brief Get the ellipsis of lines in a text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @return Return the ellipsis of lines in a text. + * @since 12 + * @version 1.0 + */ +char* OH_Drawing_TypographyGetTextEllipsis(OH_Drawing_TypographyStyle*); + +/** + * @brief Releases the memory occupied by a list of Ellipsis names. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param ellipsis Indicates the pointer to a list of Ellipsis names. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TypographyDestroyEllipsis(char* ellipsis); + +/** + * @brief Overriding the class ParagraphStyle equals operator. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param from Indicates source of comparison object. + * @param to Indicates comparison object. + * @return Compare result. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TypographyStyleEquals(OH_Drawing_TypographyStyle* from, OH_Drawing_TypographyStyle* to); + /** * @brief Gets the text color. * diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 79a1b8b3984..208e3248375 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -810,6 +810,94 @@ "first_introduced": "12", "name": "OH_Drawing_CreateSharedFontCollection" }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographyMarkDirty" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographyGetUnresolvedGlyphsCount" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographyUpdateFontSize" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_RegisterThemeFontBuffer" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_RegisterThemeFont" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographyTextGetLineStyle" + }, + { + "first_introduced": "12", + "name":"OH_Drawing_TypographyTextlineStyleGetFontStyle" + }, + { + "first_introduced": "12", + "name":"OH_Drawing_TypographyTextlineStyleGetFontWeight" + }, + { + "first_introduced": "12", + "name":"OH_Drawing_TypographyTextlineStyleGetFontFamilies" + }, + { + "first_introduced": "12", + "name":"OH_Drawing_TypographyTextlineStyleDestroyFontFamilies" + }, + { + "first_introduced": "12", + "name":"OH_Drawing_TypographyTextlineStyleGetFontSize" + }, + { + "first_introduced": "12", + "name":"OH_Drawing_TypographyTextlineStyleGetHeightOnly" + }, + { + "first_introduced": "12", + "name":"OH_Drawing_TypographyTextlineStyleGetHeightScale" + }, + { + "first_introduced": "12", + "name":"OH_Drawing_TypographyTextlineStyleGetHalfLeading" + }, + { + "first_introduced": "12", + "name":"OH_Drawing_TypographyTextlineStyleGetSpacingScale" + }, + { + "first_introduced": "12", + "name":"OH_Drawing_TypographyTextlineGetStyleOnly" + }, + { + "first_introduced": "12", + "name":"OH_Drawing_TypographyGetTextAlign" + }, + { + "first_introduced": "12", + "name":"OH_Drawing_TypographyGetTextDirection" + }, + { + "first_introduced": "12", + "name":"OH_Drawing_TypographyGetTextMaxLines" + }, + { + "first_introduced": "12", + "name":"OH_Drawing_TypographyGetTextEllipsis" + }, + { + "first_introduced": "12", + "name":"OH_Drawing_TypographyDestroyEllipsis" + }, + { + "first_introduced": "12", + "name":"OH_Drawing_TypographyStyleEquals" + }, { "first_introduced": "12", "name": "OH_Drawing_TextStyleGetColor" -- Gitee