mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-11-23 15:20:17 +00:00
!11226 Add LineMetrics ArkTs interface .d.ts
Merge pull request !11226 from changleipeng/0513yqf
This commit is contained in:
commit
c015bd3db9
131
api/@ohos.graphics.drawing.d.ts
vendored
131
api/@ohos.graphics.drawing.d.ts
vendored
@ -858,6 +858,50 @@ declare namespace drawing {
|
|||||||
measureText(text: string, encoding: TextEncoding): number;
|
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_VALID = 1 << 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set if underlinePosition of FontMetrics is valid.
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
UNDERLINE_POSITION_VALID = 1 << 1,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set if strikethroughThickness of FontMetrics is valid.
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
STRIKETHROUGH_THICKNESS_VALID = 1 << 2,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set if strikethroughPosition of FontMetrics is valid.
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
STRIKETHROUGH_POSITION_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.
|
* The metrics of an Font.
|
||||||
* @typedef FontMetrics
|
* @typedef FontMetrics
|
||||||
@ -865,6 +909,14 @@ declare namespace drawing {
|
|||||||
* @since 11
|
* @since 11
|
||||||
*/
|
*/
|
||||||
interface FontMetrics {
|
interface FontMetrics {
|
||||||
|
/**
|
||||||
|
* Indicating which metrics are valid.
|
||||||
|
* @type { ?FontMetricsFlags }
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
flags?: FontMetricsFlags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum range above the glyph bounding box.
|
* Maximum range above the glyph bounding box.
|
||||||
* @type { number }
|
* @type { number }
|
||||||
@ -900,6 +952,85 @@ declare namespace drawing {
|
|||||||
* @since 11
|
* @since 11
|
||||||
*/
|
*/
|
||||||
leading: number;
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Strikethrough thickness.
|
||||||
|
* @type { ?number }
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
strikethroughThickness?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Distance from baseline to bottom of stroke, typically negative.
|
||||||
|
* @type { ?number }
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
strikethroughPosition?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
149
api/@ohos.graphics.text.d.ts
vendored
149
api/@ohos.graphics.text.d.ts
vendored
@ -927,6 +927,33 @@ declare namespace text {
|
|||||||
* @since 12
|
* @since 12
|
||||||
*/
|
*/
|
||||||
getTextLines(): Array<TextLine>;
|
getTextLines(): Array<TextLine>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the visible text on the line (excluding a possible ellipsis).
|
||||||
|
* @param { number } lineNumber - a line number
|
||||||
|
* @param { boolean } includeSpaces - indicates if the whitespaces should be included
|
||||||
|
* @returns { Range } The range of text.
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
getActualTextRange(lineNumber: number, includeSpaces: boolean): Range;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the array of line metrics for a line of text.
|
||||||
|
* @returns { Array<LineMetrics> } Array of line metrics.
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
getLineMetrics(): Array<LineMetrics>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns line metrics info for the line.
|
||||||
|
* @param { number } lineNumber - a line number
|
||||||
|
* @returns { LineMetrics | undefined } line metrics.
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
getLineMetrics(lineNumber: number): LineMetrics | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1226,6 +1253,128 @@ declare namespace text {
|
|||||||
*/
|
*/
|
||||||
paint(canvas: drawing.Canvas, x: number, y: number): void;
|
paint(canvas: drawing.Canvas, x: number, y: number): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes the layout information and metrics for a continuous piece of text (a run) in a line of text.
|
||||||
|
* @typedef RunMetrics
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
interface RunMetrics {
|
||||||
|
/**
|
||||||
|
* The metrics of an Font.
|
||||||
|
* @type { TextStyle }
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
textStyle: TextStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes text style.
|
||||||
|
* @type { drawing.FontMetrics }
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
fontMetrics: drawing.FontMetrics;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes the metric information for a line of text in a text layout.
|
||||||
|
* @typedef LineMetrics
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
interface LineMetrics {
|
||||||
|
/**
|
||||||
|
* The indexes in the text buffer the line begins.
|
||||||
|
* @type { number }
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
startIndex: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The indexes in the text buffer the line ends.
|
||||||
|
* @type { number }
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
endIndex: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The height of the text rise, the distance from the baseline to the top of the character.
|
||||||
|
* @type { number }
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
ascent: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The height of the text drop, the distance from the baseline to the bottom of the character.
|
||||||
|
* @type { number }
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
descent: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The height of the current line is `round(ascent + descent)`.
|
||||||
|
* @type { number }
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
height: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Width of the line.
|
||||||
|
* @type { number }
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
width: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The left edge of the line. The right edge can be obtained with `left + width`.
|
||||||
|
* @type { number }
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
left: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The y position of the baseline for this line from the top of the paragraph.
|
||||||
|
* @type { number }
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
baseline: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zero indexed line number.
|
||||||
|
* @type { number }
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
lineNumber: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Height from the top.
|
||||||
|
* @type { number }
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
topHeight: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapping between text index ranges and the FontMetrics associated with
|
||||||
|
* them. The first run will be keyed under start_index. The metrics here.
|
||||||
|
* are before layout and are the base values we calculate from.
|
||||||
|
* @type { Map<number, RunMetrics> }
|
||||||
|
* @syscap SystemCapability.Graphics.Drawing
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
runMetrics: Map<number, RunMetrics>;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default text;
|
export default text;
|
@ -873,6 +873,7 @@ statfs
|
|||||||
stopcd
|
stopcd
|
||||||
storei
|
storei
|
||||||
storge
|
storge
|
||||||
|
strikethrough
|
||||||
strm
|
strm
|
||||||
stroked
|
stroked
|
||||||
stuffit
|
stuffit
|
||||||
|
Loading…
Reference in New Issue
Block a user