Signed-off-by: liufei <liufei225@h-partners.com>
This commit is contained in:
liufei 2024-11-19 11:05:26 +08:00
parent 3c2aeb223f
commit 9360e40985
7 changed files with 546 additions and 518 deletions

View File

@ -13,9 +13,6 @@
* limitations under the License.
*/
#ifndef C_INCLUDE_DRAWING_FONT_COLLECTION_H
#define C_INCLUDE_DRAWING_FONT_COLLECTION_H
/**
* @addtogroup Drawing
* @{
@ -40,6 +37,9 @@
* @version 1.0
*/
#ifndef C_INCLUDE_DRAWING_FONT_COLLECTION_H
#define C_INCLUDE_DRAWING_FONT_COLLECTION_H
#include "drawing_text_declaration.h"
#ifdef __cplusplus
@ -59,31 +59,31 @@ OH_Drawing_FontCollection* OH_Drawing_CreateFontCollection(void);
* @brief Releases the memory occupied by an <b>OH_Drawing_FontCollection</b> object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_FontCollection Indicates the pointer to an <b>OH_Drawing_FontCollection</b> object.
* @param fontCollection Indicates the pointer to an <b>OH_Drawing_FontCollection</b> object.
* @since 8
* @version 1.0
*/
void OH_Drawing_DestroyFontCollection(OH_Drawing_FontCollection*);
void OH_Drawing_DestroyFontCollection(OH_Drawing_FontCollection* fontCollection);
/**
* @brief Disable the font collection fallback.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_FontCollection Indicates the pointer to an <b>OH_Drawing_FontCollection</b> object.
* @param fontCollection Indicates the pointer to an <b>OH_Drawing_FontCollection</b> object.
* @since 12
* @version 1.0
*/
void OH_Drawing_DisableFontCollectionFallback(OH_Drawing_FontCollection*);
void OH_Drawing_DisableFontCollectionFallback(OH_Drawing_FontCollection* fontCollection);
/**
* @brief Disable the font collection systemfont.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_FontCollection Indicates the pointer to an <b>OH_Drawing_FontCollection</b> object.
* @param fontCollection Indicates the pointer to an <b>OH_Drawing_FontCollection</b> object.
* @since 12
* @version 1.0
*/
void OH_Drawing_DisableFontCollectionSystemFont(OH_Drawing_FontCollection*);
void OH_Drawing_DisableFontCollectionSystemFont(OH_Drawing_FontCollection* fontCollection);
/**
* @brief Creates an <b>OH_Drawing_FontCollection</b> object with shared usage between
@ -100,11 +100,11 @@ OH_Drawing_FontCollection* OH_Drawing_CreateSharedFontCollection(void);
* @brief Clear font caches.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_FontCollection Indicates the pointer to an <b>OH_Drawing_FontCollection</b> object.
* @param fontCollection Indicates the pointer to an <b>OH_Drawing_FontCollection</b> object.
* @since 12
* @version 1.0
*/
void OH_Drawing_ClearFontCaches(OH_Drawing_FontCollection*);
void OH_Drawing_ClearFontCaches(OH_Drawing_FontCollection* fontCollection);
#ifdef __cplusplus
}
#endif

View File

@ -13,9 +13,6 @@
* limitations under the License.
*/
#ifndef C_INCLUDE_DRAWING_FONT_MGR_H
#define C_INCLUDE_DRAWING_FONT_MGR_H
/**
* @addtogroup Drawing
* @{
@ -40,6 +37,9 @@
* @version 1.0
*/
#ifndef C_INCLUDE_DRAWING_FONT_MGR_H
#define C_INCLUDE_DRAWING_FONT_MGR_H
#include "drawing_types.h"
#include "drawing_text_typography.h"
#include <stdint.h>
@ -62,34 +62,34 @@ OH_Drawing_FontMgr* OH_Drawing_FontMgrCreate(void);
* @brief Releases the memory occupied by an <b>OH_Drawing_FontMgr</b> object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_FontMgr Indicates the pointer to an <b>OH_Drawing_FontMgr</b> object.
* @param drawingFontMgr Indicates the pointer to an <b>OH_Drawing_FontMgr</b> object.
* @since 12
* @version 1.0
*/
void OH_Drawing_FontMgrDestroy(OH_Drawing_FontMgr*);
void OH_Drawing_FontMgrDestroy(OH_Drawing_FontMgr* drawingFontMgr);
/**
* @brief Gets the count of font families.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_FontMgr Indicates the pointer to an <b>OH_Drawing_FontMgr</b> object.
* @param drawingFontMgr Indicates the pointer to an <b>OH_Drawing_FontMgr</b> object.
* @return Returns the count of font families.
* @since 12
* @version 1.0
*/
int OH_Drawing_FontMgrGetFamilyCount(OH_Drawing_FontMgr*);
int OH_Drawing_FontMgrGetFamilyCount(OH_Drawing_FontMgr* drawingFontMgr);
/**
* @brief Gets the font family name by the index.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_FontMgr Indicates the pointer to an <b>OH_Drawing_FontMgr</b> object.
* @param drawingFontMgr Indicates the pointer to an <b>OH_Drawing_FontMgr</b> object.
* @param index Indicates the index to get the font family name.
* @return Returns the font family name corresponding to the index value.
* @since 12
* @version 1.0
*/
char* OH_Drawing_FontMgrGetFamilyName(OH_Drawing_FontMgr*, int index);
char* OH_Drawing_FontMgrGetFamilyName(OH_Drawing_FontMgr* drawingFontMgr, int index);
/**
* @brief Releases the memory occupied by font family name.
@ -105,57 +105,57 @@ void OH_Drawing_FontMgrDestroyFamilyName(char* familyName);
* @brief Creates an <b>OH_Drawing_FontStyleSet</b> object by <b>OH_Drawing_FontMgr</b> object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_FontMgr Indicates the pointer to an <b>OH_Drawing_FontMgr</b> object.
* @param drawingFontMgr Indicates the pointer to an <b>OH_Drawing_FontMgr</b> object.
* @param index Indicates the index used to get the font style set object from the font manager object.
* @return Returns the pointer to the <b>OH_Drawing_FontStyleSet</b> object created.
* @since 12
* @version 1.0
*/
OH_Drawing_FontStyleSet* OH_Drawing_FontMgrCreateFontStyleSet(OH_Drawing_FontMgr*, int index);
OH_Drawing_FontStyleSet* OH_Drawing_FontMgrCreateFontStyleSet(OH_Drawing_FontMgr* drawingFontMgr, int index);
/**
* @brief Releases the memory occupied by an <b>OH_Drawing_FontStyleSet</b> object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_FontStyleSet Indicates the pointer to an <b>OH_Drawing_FontStyleSet</b> object.
* @param drawingFontStyleSet Indicates the pointer to an <b>OH_Drawing_FontStyleSet</b> object.
* @since 12
* @version 1.0
*/
void OH_Drawing_FontMgrDestroyFontStyleSet(OH_Drawing_FontStyleSet*);
void OH_Drawing_FontMgrDestroyFontStyleSet(OH_Drawing_FontStyleSet* drawingFontStyleSet);
/**
* @brief Get the pointer to an <b>OH_Drawing_FontStyleSet</b> object for the given font style set family name.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_FontMgr Indicates the pointer to an <b>OH_Drawing_FontMgr</b> object.
* @param drawingFontMgr Indicates the pointer to an <b>OH_Drawing_FontMgr</b> object.
* @param familyName Indicates the family name of a font style set to be matched.
* @return Returns the pointer to the <b>OH_Drawing_FontStyleSet</b> object matched.
* @since 12
* @version 1.0
*/
OH_Drawing_FontStyleSet* OH_Drawing_FontMgrMatchFamily(OH_Drawing_FontMgr*, const char* familyName);
OH_Drawing_FontStyleSet* OH_Drawing_FontMgrMatchFamily(OH_Drawing_FontMgr* drawingFontMgr, const char* familyName);
/**
* @brief Get the pointer to an <b>OH_Drawing_Typeface</b> object based on the given font style and family name.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_FontMgr Indicates the pointer to an <b>OH_Drawing_FontMgr</b> object.
* @param drawingFontMgr Indicates the pointer to an <b>OH_Drawing_FontMgr</b> object.
* @param familyName Indicates the family name of a font style set to be matched.
* @param OH_Drawing_FontStyleStruct Indicates an <b>OH_Drawing_FontStyleStruct</b> object.
* @param fontStyle Indicates an <b>OH_Drawing_FontStyleStruct</b> object.
* @return Returns the pointer to the <b>OH_Drawing_Typeface</b> object matched.
* @since 12
* @version 1.0
*/
OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*,
OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr* drawingFontMgr,
const char* familyName, OH_Drawing_FontStyleStruct fontStyle);
/**
* @brief Get the pointer to an <b>OH_Drawing_Typeface</b> object for the given character.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_FontMgr Indicates the pointer to an <b>OH_Drawing_FontMgr</b> object.
* @param drawingFontMgr Indicates the pointer to an <b>OH_Drawing_FontMgr</b> object.
* @param familyName Indicates the family name of a font style set to be matched.
* @param OH_Drawing_FontStyleStruct Indicates an <b>OH_Drawing_FontStyleStruct</b> object.
* @param fontStyle Indicates an <b>OH_Drawing_FontStyleStruct</b> object.
* @param bcp47 Indicates an array of languages which indicate the language of character.
* @param bcp47Count Indicates the array size of bcp47.
* @param character Indicates a UTF8 value to be matched.
@ -163,33 +163,34 @@ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*,
* @since 12
* @version 1.0
*/
OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter(OH_Drawing_FontMgr*, const char* familyName,
OH_Drawing_FontStyleStruct fontStyle, const char* bcp47[], int bcp47Count, int32_t character);
OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter(OH_Drawing_FontMgr* drawingFontMgr,
const char* familyName, OH_Drawing_FontStyleStruct fontStyle,
const char* bcp47[], int bcp47Count, int32_t character);
/**
* @brief Create a typeface for the given index.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_FontStyleSet Indicates the pointer to an <b>OH_Drawing_FontStyleSet</b> object.
* @param fontStyleSet Indicates the pointer to an <b>OH_Drawing_FontStyleSet</b> object.
* @param index Indicates the index of the typeface in this fontStyleSet.
* @return If successful, return a pointer to <b>OH_Drawing_Typeface</b> object; if failed, return nullptr.
* @since 12
* @version 1.0
*/
OH_Drawing_Typeface* OH_Drawing_FontStyleSetCreateTypeface(OH_Drawing_FontStyleSet*, int index);
OH_Drawing_Typeface* OH_Drawing_FontStyleSetCreateTypeface(OH_Drawing_FontStyleSet* fontStyleSet, int index);
/**
* @brief Get font style for the specified typeface.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_FontStyleSet Indicates the pointer to an <b>OH_Drawing_FontStyleSet</b> object.
* @param fontStyleSet Indicates the pointer to an <b>OH_Drawing_FontStyleSet</b> object.
* @param index Indicates the index of the typeface in this fontStyleSet.
* @param styleName Indicates the style name returned.
* @return Return the <b>OH_Drawing_FontStyleStruct<b> structure.
* @since 12
* @version 1.0
*/
OH_Drawing_FontStyleStruct OH_Drawing_FontStyleSetGetStyle(OH_Drawing_FontStyleSet*, int32_t index,
OH_Drawing_FontStyleStruct OH_Drawing_FontStyleSetGetStyle(OH_Drawing_FontStyleSet* fontStyleSet, int32_t index,
char** styleName);
/**
@ -206,25 +207,25 @@ void OH_Drawing_FontStyleSetFreeStyleName(char** styleName);
* @brief Get the closest matching typeface.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_FontStyleSet Indicates the pointer to an <b>OH_Drawing_FontStyleSet</b> object.
* @param fontStyleSet Indicates the pointer to an <b>OH_Drawing_FontStyleSet</b> object.
* @param fontStyleStruct Indicates the <b>OH_Drawing_FontStyleStruct</b> structure.
* @return A pointer to matched <b>OH_Drawing_Typeface</b>.
* @since 12
* @version 1.0
*/
OH_Drawing_Typeface* OH_Drawing_FontStyleSetMatchStyle(OH_Drawing_FontStyleSet*,
OH_Drawing_Typeface* OH_Drawing_FontStyleSetMatchStyle(OH_Drawing_FontStyleSet* fontStyleSet,
OH_Drawing_FontStyleStruct fontStyleStruct);
/**
* @brief Get the count of typeface.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_FontStyleSet Indicates the pointer to an <b>OH_Drawing_FontStyleSet</b> object.
* @param fontStyleSet Indicates the pointer to an <b>OH_Drawing_FontStyleSet</b> object.
* @return The count of typeface in this font style set.
* @since 12
* @version 1.0
*/
int OH_Drawing_FontStyleSetCount(OH_Drawing_FontStyleSet*);
int OH_Drawing_FontStyleSetCount(OH_Drawing_FontStyleSet* fontStyleSet);
#ifdef __cplusplus
}

View File

@ -13,9 +13,6 @@
* limitations under the License.
*/
#ifndef C_INCLUDE_DRAWING_REGISTER_FONT_H
#define C_INCLUDE_DRAWING_REGISTER_FONT_H
/**
* @addtogroup Drawing
* @{
@ -40,6 +37,9 @@
* @version 1.0
*/
#ifndef C_INCLUDE_DRAWING_REGISTER_FONT_H
#define C_INCLUDE_DRAWING_REGISTER_FONT_H
#include "drawing_text_declaration.h"
#include "drawing_types.h"

View File

@ -13,9 +13,6 @@
* limitations under the License.
*/
#ifndef C_INCLUDE_DRAWING_TEXT_DECLARATION_H
#define C_INCLUDE_DRAWING_TEXT_DECLARATION_H
/**
* @addtogroup Drawing
* @{
@ -40,6 +37,9 @@
* @version 1.0
*/
#ifndef C_INCLUDE_DRAWING_TEXT_DECLARATION_H
#define C_INCLUDE_DRAWING_TEXT_DECLARATION_H
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -69,69 +69,70 @@ typedef enum {
* font descriptors. If the match fails, return nullptr.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_FontDescriptor The pointer to the <b>OH_Drawing_FontDescriptor</b> object. It is recommended to
* @param desc The pointer to the <b>OH_Drawing_FontDescriptor</b> object. It is recommended to
* use <b>OH_Drawing_CreateFontDescriptor</b> to obtain a valid <b>OH_Drawing_FontDescriptor</b> instance.
* If you create your own <b>OH_Drawing_FontDescriptor</b> object, ensure that fields not intended for matching are
* set to their default values.
* @param size_t Indicates the count of obtained <b>OH_Drawing_FontDescriptor</b>.
* @param num Indicates the count of obtained <b>OH_Drawing_FontDescriptor</b>.
* @return Returns an array of <b>OH_Drawing_FontDescriptor</b>. Released through the
* <b>OH_Drawing_DestroyFontDescriptors</b> interface after use.
* @since 14
*/
OH_Drawing_FontDescriptor* OH_Drawing_MatchFontDescriptors(OH_Drawing_FontDescriptor*, size_t*);
OH_Drawing_FontDescriptor* OH_Drawing_MatchFontDescriptors(OH_Drawing_FontDescriptor* desc, size_t* num);
/**
* @brief Releases the <b>OH_Drawing_FontDescriptor</b> array.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_FontDescriptor <b>OH_Drawing_FontDescriptor</b> object array.
* @param size_t Represents the number of members of the <b>OH_Drawing_FontDescriptor</b> array.
* @param descriptors <b>OH_Drawing_FontDescriptor</b> object array.
* @param num Represents the number of members of the <b>OH_Drawing_FontDescriptor</b> array.
* @since 14
*/
void OH_Drawing_DestroyFontDescriptors(OH_Drawing_FontDescriptor*, size_t);
void OH_Drawing_DestroyFontDescriptors(OH_Drawing_FontDescriptor* descriptors, size_t num);
/**
* @brief Get the <b>OH_Drawing_FontDescriptor</b> object by the font full name and the font type, supporting generic
* fonts, stylish fonts, and installed fonts.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_String Indicates the full name object <b>OH_Drawing_String</b>.
* @param OH_Drawing_SystemFontType Indicates enumerates of system font type object <b>OH_Drawing_SystemFontType</b>.
* @param fullName Indicates the full name object <b>OH_Drawing_String</b>.
* @param fontType Indicates enumerates of system font type object <b>OH_Drawing_SystemFontType</b>.
* @return Returns the pointer to a font descriptor object <b>OH_Drawing_FontDescriptor</b>.
* @since 14
*/
OH_Drawing_FontDescriptor* OH_Drawing_GetFontDescriptorByFullName(const OH_Drawing_String*, OH_Drawing_SystemFontType);
OH_Drawing_FontDescriptor* OH_Drawing_GetFontDescriptorByFullName(const OH_Drawing_String* fullName,
OH_Drawing_SystemFontType fontType);
/**
* @brief Obtain the corresponding font full name array by the font type.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_SystemFontType Indicates enumerates of system font type object <b>OH_Drawing_SystemFontType</b>.
* @param fontType Indicates enumerates of system font type object <b>OH_Drawing_SystemFontType</b>.
* @return Returns the pointer to full name array object <b>OH_Drawing_Array</b>.
* @since 14
*/
OH_Drawing_Array* OH_Drawing_GetSystemFontFullNamesByType(OH_Drawing_SystemFontType);
OH_Drawing_Array* OH_Drawing_GetSystemFontFullNamesByType(OH_Drawing_SystemFontType fontType);
/**
* @brief Get the specified full name object <b>OH_Drawing_String</b> by index from the
* <b>OH_Drawing_Array</b> object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Array Indicates an array of full name object <b>OH_Drawing_Array</b>.
* @param size_t The index of full name.
* @param fullNameArray Indicates an array of full name object <b>OH_Drawing_Array</b>.
* @param index The index of full name.
* @return Returns a full name object <b>OH_Drawing_String</b>.
* @since 14
*/
const OH_Drawing_String* OH_Drawing_GetSystemFontFullNameByIndex(OH_Drawing_Array*, size_t);
const OH_Drawing_String* OH_Drawing_GetSystemFontFullNameByIndex(OH_Drawing_Array* fullNameArray, size_t index);
/**
* @brief Releases the memory occupied by an array of font full names.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_Array Indicates an array of full name object <b>OH_Drawing_Array</b>.
* @param fullNameArray Indicates an array of full name object <b>OH_Drawing_Array</b>.
* @since 14
*/
void OH_Drawing_DestroySystemFontFullNames(OH_Drawing_Array*);
void OH_Drawing_DestroySystemFontFullNames(OH_Drawing_Array* fullNameArray);
#ifdef __cplusplus
}

View File

@ -50,7 +50,7 @@ extern "C" {
* @brief Creates an <b>OH_Drawing_LineTypography</b> object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_TypographyCreate Indicates the pointer to an <b>OH_Drawing_TypographyCreate</b> object.
* @param handler Indicates the pointer to an <b>OH_Drawing_TypographyCreate</b> object.
* @return Returns the pointer to the <b>OH_Drawing_LineTypography</b> object created.
* @since 14
*/
@ -60,7 +60,7 @@ OH_Drawing_LineTypography* OH_Drawing_CreateLineTypography(OH_Drawing_Typography
* @brief Releases the memory occupied by an <b>OH_Drawing_LineTypography</b> object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_LineTypography Indicates the pointer to an <b>OH_Drawing_LineTypography</b> object.
* @param lineTypography Indicates the pointer to an <b>OH_Drawing_LineTypography</b> object.
* @since 14
*/
void OH_Drawing_DestroyLineTypography(OH_Drawing_LineTypography* lineTypography);
@ -69,7 +69,7 @@ void OH_Drawing_DestroyLineTypography(OH_Drawing_LineTypography* lineTypography)
* @brief Calculate the line breakpoint based on the width provided.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_TypographyCreate Indicates the pointer to an <b>OH_Drawing_TypographyCreate</b> object.
* @param lineTypography Indicates the pointer to an <b>OH_Drawing_TypographyCreate</b> object.
* @param startIndex Indicates the starting point for the line-break calculations.
* @param width Indicates the requested line-break width.
* @return Returns the count of the characters from startIndex that would cause the line break.
@ -82,7 +82,7 @@ size_t OH_Drawing_LineTypographyGetLineBreak(OH_Drawing_LineTypography* lineTypo
* @brief Creates a text line object based on the text range provided.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param OH_Drawing_LineTypography Indicates the pointer to an <b>OH_Drawing_TypographyCreate</b> object.
* @param lineTypography Indicates the pointer to an <b>OH_Drawing_TypographyCreate</b> object.
* @param startIndex Indicates the starting index of the text range.
* @param count Indicates the characters count of the text range.
* @return Returns the pointer to the <b>OH_Drawing_TextLine</b> object created.

File diff suppressed because it is too large Load Diff