From 982eca1ecfec48c0dbef8ef089549cbd73b1b6c8 Mon Sep 17 00:00:00 2001 From: FTL1ght Date: Wed, 4 Jun 2025 21:52:48 +0800 Subject: [PATCH] Text Vertical alignment sdk c Signed-off-by: FTL1ght Change-Id: Ie5c5874ebc1e03a95cbb2feb931746b222f261d4 --- .../native_drawing/drawing_text_typography.h | 35 +++++++++++++++++++ .../native_drawing/libnative_drawing.ndk.json | 4 +++ 2 files changed, 39 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index 8a704ced5..e562fcd76 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -196,6 +196,11 @@ typedef enum { ALIGNMENT_BOTTOM_OF_ROW_BOX, /** Center of Row Box */ ALIGNMENT_CENTER_OF_ROW_BOX, + /** + * Follow paragraph setting + * @since 20 + */ + ALIGNMENT_FOLLOW_PARAGRAPH, } OH_Drawing_PlaceholderVerticalAlignment; /** @@ -592,6 +597,23 @@ typedef enum OH_Drawing_TextBadgeType { TEXT_SUBSCRIPT, } OH_Drawing_TextBadgeType; +/** + * @brief Type of vertical alignment. + * + * @since 20 + * @version 1.0 + */ +typedef enum OH_Drawing_TextVerticalAlignment { + /** Baseline of text line */ + TEXT_VERTICAL_ALIGNMENT_BASELINE, + /** Bottom of text line */ + TEXT_VERTICAL_ALIGNMENT_BOTTOM, + /** Center of text line */ + TEXT_VERTICAL_ALIGNMENT_CENTER, + /** Top of text line */ + TEXT_VERTICAL_ALIGNMENT_TOP +} OH_Drawing_TextVerticalAlignment; + /** * @brief Defines the font style struct. * @@ -2360,6 +2382,19 @@ double OH_Drawing_TextStyleGetFontHeight(OH_Drawing_TextStyle* style); */ bool OH_Drawing_TextStyleGetHalfLeading(OH_Drawing_TextStyle* style); +/** + * @brief Sets the typography vertical alignment mode. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param style Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param align Indicates the typography vertical alignment mode. For details, + * see the enum OH_Drawing_TextVerticalAlignment. + * @since 20 + * @version 1.0 + */ +void OH_Drawing_SetTypographyVerticalAlignment(OH_Drawing_TypographyStyle* style, + OH_Drawing_TextVerticalAlignment align); + /** * @brief Gets the locale. * diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 5479d9f0f..1275bbab1 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -1917,5 +1917,9 @@ { "first_introduced": "20", "name": "OH_Drawing_SetTextUndefinedGlyphDisplay" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_SetTypographyVerticalAlignment" } ] \ No newline at end of file -- Gitee