diff --git a/graphic/graphic_2d/native_drawing/drawing_font.h b/graphic/graphic_2d/native_drawing/drawing_font.h index 06aa4323bd7e9e20543bc18bf5605a9bacc2a282..cbbec950c9737b44aeb3cac1d7b5e8b87151a8e6 100644 --- a/graphic/graphic_2d/native_drawing/drawing_font.h +++ b/graphic/graphic_2d/native_drawing/drawing_font.h @@ -149,7 +149,9 @@ void OH_Drawing_FontDestroy(OH_Drawing_Font*); * @since 12 * @version 1.0 */ -typedef struct { +typedef struct OH_Drawing_Font_Metrics { + /** Indicating which metrics are valid */ + uint32_t flags; /** storage for top in font metrics */ float top; /** storage for ascent in font metrics */ @@ -160,6 +162,26 @@ typedef struct { float bottom; /** storage for leading in font metrics */ float leading; + /** Average character width, zero if unknown */ + float avgCharWidth; + /** Maximum character width, zero if unknown */ + float maxCharWidth; + /** Greatest extent to left of origin of any glyph bounding box, typically negative; deprecated with variable fonts */ + float xMin; + /** Greatest extent to right of origin of any glyph bounding box, typically positive; deprecated with variable fonts */ + float xMax; + /** Height of lower-case letter, zero if unknown, typically negative */ + float xHeight; + /** Height of an upper-case letter, zero if unknown, typically negative */ + float capHeight; + /** @brief Underline thickness */ + float underlineThickness; + /** Distance from baseline to top of stroke, typically positive */ + float underlinePosition; + /** Strikeout thickness */ + float strikeoutThickness; + /** Distance from baseline to bottom of stroke, typically negative */ + float strikeoutPosition; } OH_Drawing_Font_Metrics; /** diff --git a/graphic/graphic_2d/native_drawing/drawing_font_collection.h b/graphic/graphic_2d/native_drawing/drawing_font_collection.h index b517e5af152dba3aafbd9ae50743419625eb3350..425842da6335eb5b8b5f6bfcfeaa16fdfb762b1f 100644 --- a/graphic/graphic_2d/native_drawing/drawing_font_collection.h +++ b/graphic/graphic_2d/native_drawing/drawing_font_collection.h @@ -62,6 +62,26 @@ OH_Drawing_FontCollection* OH_Drawing_CreateFontCollection(void); */ void OH_Drawing_DestroyFontCollection(OH_Drawing_FontCollection*); +/** + * @brief Disable the font collection fallback. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontCollection Indicates the pointer to an OH_Drawing_FontCollection object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DisableFontCollectionFallback(OH_Drawing_FontCollection*); + +/** + * @brief Disable the font collection systemfont. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontCollection Indicates the pointer to an OH_Drawing_FontCollection object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DisableFontCollectionSystemFont(OH_Drawing_FontCollection*); + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_text_declaration.h b/graphic/graphic_2d/native_drawing/drawing_text_declaration.h index 14cfaa33bd1caa54cb35fecf25463df93bb2627b..542012e2af96ab4602bfab5555598f97724a156b 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_declaration.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_declaration.h @@ -106,6 +106,22 @@ typedef struct OH_Drawing_PositionAndAffinity OH_Drawing_PositionAndAffinity; */ typedef struct OH_Drawing_Range OH_Drawing_Range; +/** + * @brief Defines an OH_Drawing_FontParser, which is used to parse system font files. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_FontParser OH_Drawing_FontParser; + +/** + * @brief Defines an OH_Drawing_TextShadow, which is used to manage text shadow. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_TextShadow OH_Drawing_TextShadow; + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index ce73be523ba252f81d1b3094dc9a4c36ea3ebe6b..f2b08fc8dbd859e48f31c1aa9e1dec62ac6c6ec2 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -40,6 +40,7 @@ #include "cstddef" #include "drawing_canvas.h" #include "drawing_color.h" +#include "drawing_font.h" #include "drawing_text_declaration.h" #include "drawing_types.h" @@ -286,6 +287,72 @@ typedef enum { RECT_WIDTH_STYLE_MAX, } OH_Drawing_RectWidthStyle; +/** + * @brief Describes the font information. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_FontDescriptor { + /** The file path of System font */ + char* path; + /** A name that uniquely identifies the font */ + char* postScriptName; + /** The name of System font */ + char* fullName; + /** The family of System font */ + char* fontFamily; + /** The subfont family of the system font */ + char* fontSubfamily; + /** The weight of System font */ + int weight; + /** The width of System font */ + int width; + /** Whether the system font is tilted */ + int italic; + /** Whether the system font is compact */ + bool monoSpace; + /** whether symbolic fonts are supported */ + bool symbolic; +} OH_Drawing_FontDescriptor; + +/** + * @brief The metrics of line. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_LineMetrics { + /** Text ascender height */ + double ascender; + /** Tex descender height */ + double descender; + /** The height of a capital letter */ + double capHeight; + /** The height of a lowercase letter */ + double xHeight; + /** Text width */ + double width; + /** Line height */ + double height; + /** + * The distance from the left end of the text to the left end of the container, + * aligned to 0, is the width of the container minus the width of the line of text + */ + double x; + /** + * The height from the top of the text to the top of the container, the first line is 0, + * and the second line is the height of the first line + */ + double y; + /** Start Index */ + size_t startIndex; + /** End Index */ + size_t endIndex; + /** The metrics information of the first character */ + OH_Drawing_Font_Metrics firstCharMetrics; +} OH_Drawing_LineMetrics; + /** * @brief Creates an OH_Drawing_TypographyStyle object. * @@ -471,6 +538,94 @@ void OH_Drawing_SetTextStyleFontStyle(OH_Drawing_TextStyle*, int /* OH_Drawing_F */ void OH_Drawing_SetTextStyleLocale(OH_Drawing_TextStyle*, const char*); +/** + * @brief Sets the foreground brush style. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param OH_Drawing_Brush Indicates the pointer to a brush object OH_Drawing_Brush. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleForegroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*); + +/** + * @brief Gets the foreground brush style. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param OH_Drawing_Brush Indicates the pointer to a brush object OH_Drawing_Brush. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleGetForegroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*); + +/** + * @brief Sets the foreground pen style. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param OH_Drawing_Pen Indicates the pointer to a pen object OH_Drawing_Pen. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleForegroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*); + +/** + * @brief Gets the foreground pen style. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param OH_Drawing_Pen Indicates the pointer to a pen object OH_Drawing_Pen. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleGetForegroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*); + +/** + * @brief Sets the background brush style. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param OH_Drawing_Brush Indicates the pointer to a brush object OH_Drawing_Brush. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleBackgroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*); + +/** + * @brief Gets the background brush style. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param OH_Drawing_Brush Indicates the pointer to a brush object OH_Drawing_Brush. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleGetBackgroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*); + +/** + * @brief Sets the background pen style. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param OH_Drawing_Pen Indicates the pointer to a pen object OH_Drawing_Pen. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleBackgroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*); + +/** + * @brief Gets the background pen style. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param OH_Drawing_Pen Indicates the pointer to a pen object OH_Drawing_Pen. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleGetBackgroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*); + /** * @brief Creates a pointer to an OH_Drawing_TypographyCreate object. * @@ -1014,6 +1169,518 @@ double OH_Drawing_TypographyGetLineWidth(OH_Drawing_Typography*, int); */ OH_Drawing_Range* OH_Drawing_TypographyGetLineTextRange(OH_Drawing_Typography*, int, bool); +/** + * @brief Creates an OH_Drawing_FontDescriptor object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the font descriptor object OH_Drawing_FontDescriptor created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_FontDescriptor* OH_Drawing_CreateFontDescriptor(void); + +/** + * @brief Releases the memory occupied by an OH_Drawing_FontDescriptor object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontDescriptor the pointer to the font descriptor object OH_Drawing_FontDescriptor. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroyFontDescriptor(OH_Drawing_FontDescriptor*); + +/** + * @brief Creates an OH_Drawing_FontParser object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the font parser object OH_Drawing_FontParser. + * @since 12 + * @version 1.0 + */ +OH_Drawing_FontParser* OH_Drawing_CreateFontParser(void); + +/** + * @brief Releases the memory occupied by an OH_Drawing_FontParser object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontParser Indicates the pointer to the font parser object OH_Drawing_FontParser. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroyFontParser(OH_Drawing_FontParser*); + +/** + * @brief Gets a list of system font names. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontParser Indicates the pointer to the font parser object OH_Drawing_FontParser. + * @param size_t Returns the number of obtained system font names. + * @return Returns a list of obtained system fonts. + * @since 12 + * @version 1.0 + */ +char** OH_Drawing_FontParserGetSystemFontList(OH_Drawing_FontParser*, size_t*); + +/** + * @brief Releases the memory occupied by a list of system font names. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param char** Indicates the pointer to a list of system font names. + * @param size_t The number of obtained system font names. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroySystemFontList(char**, size_t); + +/** + * @brief Gets information about the system font by font name. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontParser Indicates the pointer to the font parser object OH_Drawing_FontParser. + * @param char** font name. + * @return Returns system fonts information. + * @since 12 + * @version 1.0 + */ +OH_Drawing_FontDescriptor* OH_Drawing_FontParserGetFontByName(OH_Drawing_FontParser*, const char*); + +/** + * @brief Get line metrics information. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to a typography object OH_Drawing_Typography. + * @return Indicates the pointer to a lime metrics object OH_Drawing_LineMetrics. + * @since 12 + * @version 1.0 + */ +OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetrics(OH_Drawing_Typography*); + +/** + * @brief Get the number of lines. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_LineMetrics Indicates the pointer to a lime metrics object OH_Drawing_LineMetrics. + * @return Returns the number of lines. + * @since 12 + * @version 1.0 + */ +size_t OH_Drawing_LineMetricsGetSize(OH_Drawing_LineMetrics*); + +/** + * @brief Releases the memory occupied by line metrics. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_LineMetrics Indicates the pointer to a lime metrics object OH_Drawing_LineMetrics. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroyLineMetrics(OH_Drawing_LineMetrics*); + +/** + * @brief Gets the specified line by line number. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to a typography object OH_Drawing_Typography. + * @param int Line number. + * @param OH_Drawing_LineMetrics Indicates the pointer to a lime metrics object OH_Drawing_LineMetrics. + * @return Whether the line metrics was obtained. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TypographyGetLineMetricsAt(OH_Drawing_Typography*, int, OH_Drawing_LineMetrics*); + +/** + * @brief Sets the ellipsis of lines in a text file. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to a typography object OH_Drawing_Typography. + * @param char Indicates the line textellipsis. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextEllipsis(OH_Drawing_TypographyStyle*, const char*); + +/** + * @brief Sets the locale of lines in a text file. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @param char Indicates the pointer to the locale to set. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLocale(OH_Drawing_TypographyStyle*, const char*); + +/** + * @brief Sets the textSplitRatio of lines in a text file. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @param float Indicates the textSplitRatio of lines to set. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextSplitRatio(OH_Drawing_TypographyStyle*, float); + +/** + * @brief Gets the TextStyle of lines in a text file. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @return Returns line text textstyle. + * @since 12 + * @version 1.0 + */ +OH_Drawing_TextStyle* OH_Drawing_TypographyGetTextStyle(OH_Drawing_TypographyStyle*); + +/** + * @brief Gets the EffectiveAlign of lines in a text file. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @return Returns line text align. + * @since 12 + * @version 1.0 + */ +int OH_Drawing_TypographyGetEffectiveAlignment(OH_Drawing_TypographyStyle*); + +/** + * @brief Gets the UnlimitedLines of lines in a text file. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @return Returns whether the text has a maximum line limit, with true indicating a maximum line limit and false indicating no maximum line limit. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TypographyIsLineUnlimited(OH_Drawing_TypographyStyle*); + +/** + * @brief Gets the IsEllipsized of lines in a text file. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @return Returns whether the text has ellipsis, true meaning there is an ellipsis and false meaning there is no ellipsis. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TypographyIsEllipsized(OH_Drawing_TypographyStyle*); + +/** + * @brief set line textstyle. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextStyle(OH_Drawing_TypographyStyle*, OH_Drawing_TextStyle*); + +/** + * @brief get line fontmetrics. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to a typography object OH_Drawing_Typography. + * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param OH_Drawing_Font_Metrics Indicates the pointer to a font metrics object OH_Drawing_Font_Metrics. + * @return Whether the font metrics was obtained. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TextStyleGetFontMetrics(OH_Drawing_Typography*, OH_Drawing_TextStyle*, OH_Drawing_Font_Metrics*); + +/** + * @brief Gets the position of the specified line or the first text of the specified line. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to a typography object OH_Drawing_Typography. + * @param int Line number. + * @param bool True is the information for the whole line, and false is the information to get the first character + * @param bool Whether the text width contains whitespace. + * @param OH_Drawing_LineMetrics Indicates the pointer to a lime metrics object OH_Drawing_LineMetrics. + * @return return whether the information was successfully fetched. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TypographyGetLineInfo(OH_Drawing_Typography*, int, bool, bool, OH_Drawing_LineMetrics*); + +/** + * @brief Sets the font weight of text typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @param int Indicates the font weight of text typography to set. For details, see the enum OH_Drawing_FontWeight. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextFontWeight(OH_Drawing_TypographyStyle*, int); + +/** + * @brief Sets the font style of text typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @param int Indicates the font style of text typography to set. For details, see the enum OH_Drawing_FontStyle. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextFontStyle(OH_Drawing_TypographyStyle*, int); + +/** + * @brief Sets the font family of text typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @param char Indicates the pointer to the font family of text typography to set. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextFontFamily(OH_Drawing_TypographyStyle*, const char*); + +/** + * @brief Sets the font size of text typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @param double Indicates the font size of text typography to set. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextFontSize(OH_Drawing_TypographyStyle*, double); + +/** + * @brief Sets the font height of text typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @param double Indicates the font height of text typography to set. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextFontHeight(OH_Drawing_TypographyStyle*, double); + +/** + * @brief Sets the half leading of text typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle. + * @param bool Indicates the half leading of text typography to set. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextHalfLeading(OH_Drawing_TypographyStyle*, bool); + +/** + * @brief Sets whether to enable 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 bool Indicates whether the line style for text typography is used. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextUseLineStyle(OH_Drawing_TypographyStyle*, bool); + +/** + * @brief Sets 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. + * @param int Indicates the font weight of line style for text typography to set. For details, see the enum OH_Drawing_FontWeight. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleFontWeight(OH_Drawing_TypographyStyle*, int); + +/** + * @brief Sets 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. + * @param int Indicates the font style of line style for text typography to set. For details, see the enum OH_Drawing_FontStyle. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleFontStyle(OH_Drawing_TypographyStyle*, int); + +/** + * @brief Sets 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 int Indicates the number of font families to set. + * @param char Indicates the pointer to the font families of line style for text typography to set. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleFontFamilies(OH_Drawing_TypographyStyle*, int, const char*); + +/** + * @brief Sets the font size 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 double Indicates the font size of line style for text typography to set. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleFontSize(OH_Drawing_TypographyStyle*, double); + +/** + * @brief Sets the font height 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 double Indicates the font height of line style for text typography to set. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleFontHeight(OH_Drawing_TypographyStyle*, double); + +/** + * @brief Sets 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. + * @param bool Indicates the half leading of line for text typography to set. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleHalfLeading(OH_Drawing_TypographyStyle*, bool); + +/** + * @brief Sets 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. + * @param double Indicates the space scale of line for text typography to set. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleSpacingScale(OH_Drawing_TypographyStyle*, double); + +/** + * @brief Sets 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. + * @param bool Indicates the line style for text typography to set only. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleOnly(OH_Drawing_TypographyStyle*, bool); + +/** + * @brief Creates an OH_Drawing_TextShadow object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the text shadow object created OH_Drawing_TextShadow. + * @since 12 + * @version 1.0 + */ +OH_Drawing_TextShadow* OH_Drawing_CreateTextShadow(void); + +/** + * @brief Releases the memory occupied by the text shadow object OH_Drawing_TextShadow. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextShadow Indicates the pointer to the text shadow object OH_Drawing_TextShadow. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroyTextShadow(OH_Drawing_TextShadow*); + +/** + * @brief Gets the vector of TextShadow in TextStyle. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param int Indicates the number in vector to set. + * @param OH_Drawing_TextShadow Indicates the pointer to the text shadow object OH_Drawing_TextShadow. + * @return Returns the vector of TextShadow. + * @since 12 + * @version 1.0 + */ +OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadows(OH_Drawing_TextStyle*); + +/** + * @brief Gets the size of vector of TextShadow in TextStyle. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @return Returns the size of vector. + * @since 12 + * @version 1.0 + */ +int OH_Drawing_TextStyleGetShadowCount(OH_Drawing_TextStyle*); + +/** + * @brief Adds element in vector of TextShadow in TextStyle. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param OH_Drawing_TextShadow Indicates the pointer to the text shadow object OH_Drawing_TextShadow. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleAddShadow(OH_Drawing_TextStyle*, const OH_Drawing_TextShadow*); + +/** + * @brief clear elements in vector of TextShadow in TextStyle. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleClearShadows(OH_Drawing_TextStyle*); + +/** + * @brief Gets element in vector of TextShadow with index. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param int Indicates the index to set. + * @return Returns the pointer to element with the index in vector of the text style object OH_Drawing_TextStyle. + * @since 12 + * @version 1.0 + */ +OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadowWithIndex(OH_Drawing_TextStyle*, int); + +/** + * @brief Set indents of the typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to a typography object OH_Drawing_Typography. + * @param float Indicates the pointer to the indents to set. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TypographySetIndents(OH_Drawing_Typography*, int, const float); + +/** + * @brief Gets element with index in vector of Indents. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to a typography object OH_Drawing_Typography. + * @param int Indicates the index to set. + * @return float Indicates the element with the index in vector of Indents. + * @since 12 + * @version 1.0 + */ +float OH_Drawing_TypographyGetIndentsWithIndex(OH_Drawing_Typography*, int); + +/** + * @brief Releases the memory occupied by vector with the text shadow object OH_Drawing_TextShadow. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param Indicates the pointer to the text shadow object OH_Drawing_TextShadow. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroyTextShadows(OH_Drawing_TextShadow*); + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index e916a8a3fe59e3b9ff8f3a1adf56ffaae4afd58c..f218e1b8af8f28fe78e13d5c086a680dfbaae9b2 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -200,6 +200,42 @@ { "name": "OH_Drawing_ImageBuildFromBitmap" }, { "name": "OH_Drawing_ImageGetWidth" }, { "name": "OH_Drawing_ImageGetHeight" }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleGetShadowWithIndex" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographyGetIndentsWithIndex" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleClearShadows" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleAddShadow" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleGetShadowCount" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleGetShadows" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_DestroyTextShadow" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_CreateTextShadow" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographySetIndents" + }, { "first_introduced": "12", "name": "OH_Drawing_ImageGetImageInfo" @@ -337,5 +373,190 @@ { "first_introduced": "12", "name": "OH_Drawing_TypographyGetLineTextRange" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_CreateFontDescriptor" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_DestroyFontDescriptor" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_CreateFontParser" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_DestroyFontParser" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_FontParserGetSystemFontList" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_DestroySystemFontList" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_FontParserGetFontByName" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographyGetLineMetrics" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_LineMetricsGetSize" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_DestroyLineMetrics" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographyGetLineMetricsAt" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographyGetLineInfo" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTypographyTextEllipsis" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTypographyTextLocale" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTypographyTextSplitRatio" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographyGetTextStyle" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographyGetEffectiveAlignment" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographyIsLineUnlimited" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographyIsEllipsized" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTypographyTextStyle" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleGetFontMetrics" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographyGetMetrics" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTextStyleForegroundBrush" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleGetForegroundBrush" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTextStyleForegroundPen" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleGetForegroundPen" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTextStyleBackgroundBrush" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleGetBackgroundBrush" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTextStyleBackgroundPen" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleGetBackgroundPen" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_DisableFontCollectionFallback" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_DisableFontCollectionSystemFont" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTypographyTextFontWeight" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTypographyTextFontStyle" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTypographyTextFontSize" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTypographyTextHalfLeading" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTypographyTextUseLineStyle" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTypographyTextLineStyleFontWeight" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTypographyTextLineStyleFontStyle" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTypographyTextLineStyleFontFamilies" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTypographyTextLineStyleFontSize" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTypographyTextLineStyleFontHeight" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTypographyTextLineStyleHalfLeading" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTypographyTextLineStyleSpacingScale" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTypographyTextLineStyleOnly" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_DestroyTextShadows" } + ] \ No newline at end of file