diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index e911f8512cee85cae37753324ac7ca0a64f9eaec..90c0ebb964acfeefceb261dc2d170995ffbbd781 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -353,6 +353,19 @@ typedef struct OH_Drawing_LineMetrics { OH_Drawing_Font_Metrics firstCharMetrics; } OH_Drawing_LineMetrics; +/** + * @brief Defines the fontfeature. + * + * @since 12 + * @version 1.0 + */ +typedef struct { + /** key of fontfeature */ + char* tag; + /** value of fontfeature */ + int value; +} OH_Drawing_FontFeature; + /** * @brief Creates an OH_Drawing_TypographyStyle object. * @@ -1518,7 +1531,7 @@ void OH_Drawing_SetTypographyTextLineStyleFontStyle(OH_Drawing_TypographyStyle*, * @version 1.0 */ void OH_Drawing_SetTypographyTextLineStyleFontFamilies(OH_Drawing_TypographyStyle*, int, const char* fontFamilies[]); - + /** * @brief Sets the font size of line style for text typography. * @@ -1684,6 +1697,107 @@ float OH_Drawing_TypographyGetIndentsWithIndex(OH_Drawing_Typography*, int); */ void OH_Drawing_DestroyTextShadows(OH_Drawing_TextShadow*); +/** + * @brief Set struct of background rect and styleId of text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param OH_Drawing_RectStyle_Info Indicates the pointer to an OH_Drawing_RectStyle_Info object. + * @param styleId Indicates the styleId of text to set. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleSetBackgroundRect(OH_Drawing_TextStyle*, const OH_Drawing_RectStyle_Info*, int styleId); + +/** + * @brief Add symbols in creating typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyCreate Indicates the pointer to an OH_Drawing_TypographyCreate object. + * @param symbol Indicates the symbol to set. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TypographyHandlerAddSymbol(OH_Drawing_TypographyCreate*, uint32_t symbol); + +/** + * @brief Add font feature. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param tag Indicates the pointer to the tag to set. + * @param value Indicates the value to set. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleAddFontFeature(OH_Drawing_TextStyle*, const char* tag, int value); + +/** + * @brief Get all font features. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @return OH_Drawing_FontFeature Indicates the pointer to an array of structures of OH_Drawing_FontFeature. + * Get size of font feature by OH_Drawing_TextStyleGetFontFeatureSize. + * @since 12 + * @version 1.0 + */ +OH_Drawing_FontFeature* OH_Drawing_TextStyleGetFontFeatures(OH_Drawing_TextStyle*); + +/** + * @brief Release the memory occupied by array of structures of font features. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontFeature Indicates the pointer to an array of structures of OH_Drawing_FontFeature. + * @param fontFeatureSize Indicates the size of array of structures of OH_Drawing_FontFeature. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleDestroyFontFeatures(OH_Drawing_FontFeature*, size_t fontFeatureSize); + +/** + * @brief Get size of font features. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @return Returns the size of fontfeatures map. + * @since 12 + * @version 1.0 + */ +size_t OH_Drawing_TextStyleGetFontFeatureSize(OH_Drawing_TextStyle*); + +/** + * @brief Clear font features. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleClearFontFeature(OH_Drawing_TextStyle*); + +/** + * @brief Set baseline shift of text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param lineShift Indicates the baseline shift to set. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleSetBaselineShift(OH_Drawing_TextStyle*, double lineShift); + +/** + * @brief Get baseline shift of text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @return Returns the baseline shift. + * @since 12 + * @version 1.0 + */ +double OH_Drawing_TextStyleGetBaselineShift(OH_Drawing_TextStyle*); + /** * @brief Gets the text color. * diff --git a/graphic/graphic_2d/native_drawing/drawing_types.h b/graphic/graphic_2d/native_drawing/drawing_types.h index f4f7db452f365161769d6c36c27a57338a0c119c..a07fa55fc98d36bf8b27d1fb802961ca5066cdad 100644 --- a/graphic/graphic_2d/native_drawing/drawing_types.h +++ b/graphic/graphic_2d/native_drawing/drawing_types.h @@ -408,6 +408,25 @@ typedef struct { OH_Drawing_AlphaFormat alphaType; } OH_Drawing_Image_Info; +/** + * @brief Defines rectstyle info struct. + * + * @since 12 + * @version 1.0 + */ +typedef struct { + /** color of rectstyle */ + uint32_t color; + /** radius in left top of rectstyle */ + double leftTopRadius; + /** radius in right top of rectstyle */ + double rightTopRadius; + /** radius in right bottom of rectstyle */ + double rightBottomRadius; + /** radius in left bottom of rectstyle */ + double leftBottomRadius; +} OH_Drawing_RectStyle_Info; + /** * @brief Enumerates text encoding types. * @since 12 diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 79a1b8b3984709c8019240cbb171fab3c7c57e12..b0ed71fce71647195f16c80b7b7b71d7bbb9ffe2 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -721,7 +721,7 @@ { "first_introduced": "12", "name": "OH_Drawing_TextStyleGetBackgroundPen" - }, + }, { "first_introduced": "12", "name": "OH_Drawing_DisableFontCollectionFallback" @@ -806,6 +806,42 @@ "first_introduced": "12", "name": "OH_Drawing_SetTypographyTextFontHeight" }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleSetBackgroundRect" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographyHandlerAddSymbol" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleAddFontFeature" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleGetFontFeatures" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleDestroyFontFeatures" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleGetFontFeatureSize" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleClearFontFeature" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleGetBaselineShift" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleSetBaselineShift" + }, { "first_introduced": "12", "name": "OH_Drawing_CreateSharedFontCollection"