update @ohos.graphics.drawing.d.ts

Signed-off-by: changleipeng <changleipeng4@huawei.com>
This commit is contained in:
changleipeng 2024-05-23 06:17:00 +00:00
parent 0616e1cab9
commit af1fde1c25
2 changed files with 132 additions and 181 deletions

View File

@ -858,6 +858,50 @@ declare namespace drawing {
measureText(text: string, encoding: TextEncoding): number;
}
/**
* Indicate when certain metrics are valid; the underline or strikeout metrics may be valid and zero.
* Fonts with embedded bitmaps may not have valid underline or strikeout metrics.
* @enum { number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
enum FontMetricsFlags {
/**
* Set if underlineThickness of FontMetrics is valid.
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
UNDERLINE_THICKNESS_IS_VALID = 1 << 0,
/**
* Set if underlinePosition of FontMetrics is valid.
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
UNDERLINE_POSITION_IS_VALID = 1 << 1,
/**
* Set if strikeoutThickness of FontMetrics is valid.
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
STRIKEOUT_THICKNESS_IS_VALID = 1 << 2,
/**
* Set if strikeoutPosition of FontMetrics is valid.
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
STRIKEOUT_POSITION_IS_VALID = 1 << 3,
/**
* set if top, bottom, xMin, xMax of FontMetrics invalid.
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
BOUNDS_INVALID = 1 << 4,
}
/**
* The metrics of an Font.
* @typedef FontMetrics
@ -865,6 +909,14 @@ declare namespace drawing {
* @since 11
*/
interface FontMetrics {
/**
* Indicating which metrics are valid.
* @type { FontMetricsFlags }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
flags: FontMetricsFlags;
/**
* Maximum range above the glyph bounding box.
* @type { number }
@ -900,6 +952,85 @@ declare namespace drawing {
* @since 11
*/
leading: number;
/**
* Average character width, zero if unknown.
* @type { number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
avgCharWidth: number;
/**
* Maximum character width, zero if unknown.
* @type { number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
maxCharWidth: number;
/**
* Greatest extent to left of origin of any glyph bounding box, typically negative; deprecated with variable fonts.
* @type { number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
xMin: number;
/**
* Greatest extent to right of origin of any glyph bounding box, typically positive; deprecated with variable fonts.
* @type { number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
xMax: number;
/**
* Height of lower-case 'x', zero if unknown, typically negative.
* @type { number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
xHeight: number;
/**
* Height of an upper-case letter, zero if unknown, typically negative.
* @type { number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
capHeight: number;
/**
* Underline thickness.
* @type { number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
underlineThickness: number;
/**
* Distance from baseline to top of stroke, typically positive.
* @type { number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
underlinePosition: number;
/**
* Strikeout thickness.
* @type { number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
strikeoutThickness: number;
/**
* Distance from baseline to bottom of stroke, typically negative.
* @type { number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
strikeoutPosition: number;
}
/**

View File

@ -1246,186 +1246,6 @@ declare namespace text {
paint(canvas: drawing.Canvas, x: number, y: number): void;
}
/**
* The metrics of an Font.
* @typedef FontMetrics
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
interface FontMetrics {
/**
* Indicating which metrics are valid.
* @type { ?FontMetricsFlags }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
flags?: FontMetricsFlags;
/**
* Greatest extent above origin of any glyph bounding box, typically negative; deprecated with variable fonts.
* @type { ?number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
top?: number;
/**
* Distance to reserve above baseline, typically negative.
* @type { ?number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
ascent?: number;
/**
* Distance to reserve below baseline, typically positive.
* @type { ?number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
descent?: number;
/**
* Greatest extent below origin of any glyph bounding box, typically positive; deprecated with variable fonts.
* @type { ?number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
bottom?: number;
/**
* Distance to add between lines, typically positive or zero.
* @type { ?number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
leading?: number;
/**
* Average character width, zero if unknown.
* @type { ?number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
avgCharWidth?: number;
/**
* Maximum character width, zero if unknown.
* @type { ?number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
maxCharWidth?: number;
/**
* Greatest extent to left of origin of any glyph bounding box, typically negative; deprecated with variable fonts.
* @type { ?number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
xMin?: number;
/**
* Greatest extent to right of origin of any glyph bounding box, typically positive; deprecated with variable fonts.
* @type { ?number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
xMax?: number;
/**
* Height of lower-case 'x', zero if unknown, typically negative.
* @type { ?number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
xHeight?: number;
/**
* Height of an upper-case letter, zero if unknown, typically negative.
* @type { ?number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
capHeight?: number;
/**
* Underline thickness.
* @type { ?number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
underlineThickness?: number;
/**
* Distance from baseline to top of stroke, typically positive.
* @type { ?number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
underlinePosition?: number;
/**
* Strikeout thickness.
* @type { ?number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
strikeoutThickness?: number;
/**
* Distance from baseline to bottom of stroke, typically negative.
* @type { ?number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
strikeoutPosition?: number;
}
/**
* Indicate when certain metrics are valid; the underline or strikeout metrics may be valid and zero.
* Fonts with embedded bitmaps may not have valid underline or strikeout metrics.
* @enum { number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
enum FontMetricsFlags {
/**
* Set if underlineThickness of FontMetrics is valid.
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
UNDERLINE_THICKNESS_IS_VALID = 1 << 0,
/**
* Set if underlinePosition of FontMetrics is valid.
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
UNDERLINE_POSITION_IS_VALID = 1 << 1,
/**
* Set if strikeoutThickness of FontMetrics is valid.
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
STRIKEOUT_THICKNESS_IS_VALID = 1 << 2,
/**
* Set if strikeoutPosition of FontMetrics is valid.
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
STRIKEOUT_POSITION_IS_VALID = 1 << 3,
/**
* set if top, bottom, xMin, xMax of FontMetrics invalid.
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
BOUNDS_INVALID = 1 << 4,
}
/**
* Describes the layout information and metrics for a continuous piece of text (a run) in a line of text.
* @typedef RunMetrics
@ -1447,7 +1267,7 @@ declare namespace text {
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
fontMetrics?: FontMetrics;
fontMetrics?: drawing.FontMetrics;
}
/**