diff --git a/api/@ohos.graphics.drawing.d.ts b/api/@ohos.graphics.drawing.d.ts index 5469a281cfed2285e83b527c7720acad07278b61..089e1fabd95942ce88f16870d026024d18f2f4bd 100644 --- a/api/@ohos.graphics.drawing.d.ts +++ b/api/@ohos.graphics.drawing.d.ts @@ -1213,6 +1213,32 @@ declare namespace drawing { constructor(filterMode: FilterMode); } + /** + * Describes font feature for drawing and measuring single character. + * @typedef FontFeature + * @syscap SystemCapability.Graphics.Drawing + * @crossplatform + * @since 20 + */ + interface FontFeature { + /** + * The name of font feature. + * @type { string } feature name + * @syscap SystemCapability.Graphics.Drawing + * @crossplatform + * @since 20 + */ + name: string; + /** + * The value of font feature. + * @type { number } feature value + * @syscap SystemCapability.Graphics.Drawing + * @crossplatform + * @since 20 + */ + value: number; + } + /** * A carrier that carries the drawn content and drawing status. * @syscap SystemCapability.Graphics.Drawing @@ -1567,6 +1593,19 @@ declare namespace drawing { */ drawSingleCharacter(text: string, font: Font, x: number, y: number): void; + /** + * Draws a single character with font feature. + * @param { string } text - A string containing only a single character. + * @param { Font } font - Font object. + * @param { number } x - X coordinate of the single character start point. + * @param { number } y - Y coordinate of the single character start point. + * @param { Array } features - Font Feature Array. + * @syscap SystemCapability.Graphics.Drawing + * @crossplatform + * @since 20 + */ + drawSingleCharacterWithFeatures(text: string, font: Font, x: number, y: number, features: Array): void; + /** * Draws a text blob. If the typeface used to construct blob does not support a character, that character will not be drawn. * @param { TextBlob } blob - TextBlob to draw. @@ -2323,6 +2362,17 @@ declare namespace drawing { */ measureSingleCharacter(text: string): number; + /** + * Measure a single character with font feature. + * @param { string } text - A string containing only a single character. + * @param { Array } features - Font Feature Array. + * @returns { number } The width of the single character. + * @syscap SystemCapability.Graphics.Drawing + * @crossplatform + * @since 20 + */ + measureSingleCharacterWithFeatures(text: string, features: Array): number; + /** * Measures the text width. * @param { string } text - Text Symbol Content.