Fetch the repository succeeded.
/*
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @kit ArkUI
*/
/*** if arkts 1.2 */
import { FontStyle, FontWeight, TextAlign, TextOverflow, TextCase, WordBreak } from './arkui/component/enums'
import { SizeOptions } from './arkui/component/units';
import { Resource } from './global/resource'
/*** endif */
/**
* Defines the options of MeasureText.
*
* @interface MeasureOptions
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 9
*/
/**
* Defines the options of MeasureText.
*
* @interface MeasureOptions
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
/**
* Defines the options of MeasureText.
*
* @interface MeasureOptions
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12','1.2':'20'}
* @arkts 1.1&1.2
*/
export interface MeasureOptions {
/**
* Text to display.
*
* @type { string | Resource }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 9
*/
/**
* Text to display.
*
* @type { string | Resource }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Text to display.
*
* @type { string | Resource }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12','1.2':'20'}
* @arkts 1.1&1.2
*/
textContent: string | Resource;
/**
* Text display area of width.
*
* @type { ?(number | string | Resource) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Text display area of width.
*
* @type { ?(number | string | Resource) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12','1.2':'20'}
* @arkts 1.1&1.2
*/
constraintWidth?: number | string | Resource;
/**
* Font Size.
*
* @type { ?(number | string | Resource) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 9
*/
/**
* Font Size.
*
* @type { ?(number | string | Resource) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12','1.2':'20'}
* @arkts 1.1&1.2
*/
fontSize?: number | string | Resource;
/**
* Font style.
*
* @type { ?(number | FontStyle) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 9
*/
/**
* Font style.
*
* @type { ?(number | FontStyle) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12','1.2':'20'}
* @arkts 1.1&1.2
*/
fontStyle?: number | FontStyle;
/**
* Font weight.
*
* @type { ?(number | string | FontWeight) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 9
*/
/**
* Font weight.
*
* @type { ?(number | string | FontWeight) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12','1.2':'20'}
* @arkts 1.1&1.2
*/
fontWeight?: number | string | FontWeight;
/**
* Font list of text.
*
* @type { ?(string | Resource) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 9
*/
/**
* Font list of text.
*
* @type { ?(string | Resource) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12','1.2':'20'}
* @arkts 1.1&1.2
*/
fontFamily?: string | Resource;
/**
* Distance between text fonts.
*
* @type { ?(number | string) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 9
*/
/**
* Distance between text fonts.
*
* @type { ?(number | string) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12','1.2':'20'}
* @arkts 1.1&1.2
*/
letterSpacing?: number | string;
/**
* Alignment of text.
*
* @type { ?(number | TextAlign) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Alignment of text.
*
* @type { ?(number | TextAlign) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12','1.2':'20'}
* @arkts 1.1&1.2
*/
textAlign?: number | TextAlign;
/**
* Overflow mode of the font.
*
* @type { ?(number | TextOverflow) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Overflow mode of the font.
*
* @type { ?(number | TextOverflow) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12','1.2':'20'}
* @arkts 1.1&1.2
*/
overflow?: number | TextOverflow;
/**
* Maximum number of lines of text.
*
* @type { ?number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Maximum number of lines of text.
*
* @type { ?number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12','1.2':'20'}
* @arkts 1.1&1.2
*/
maxLines?: number;
/**
* Vertical center mode of the font.
*
* @type { ?(number | string | Resource) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Vertical center mode of the font.
*
* @type { ?(number | string | Resource) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12','1.2':'20'}
* @arkts 1.1&1.2
*/
lineHeight?: number | string | Resource;
/**
* Baseline offset.
*
* @type { ?(number | string) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Baseline offset.
*
* @type { ?(number | string) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12','1.2':'20'}
* @arkts 1.1&1.2
*/
baselineOffset?: number | string;
/**
* Type of letter in the text font
*
* @type { ?(number | TextCase) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Type of letter in the text font
*
* @type { ?(number | TextCase) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12','1.2':'20'}
* @arkts 1.1&1.2
*/
textCase?: number | TextCase;
/**
* Specify the indentation of the first line in a text-block.
*
* @type { ?(number | string) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
/**
* Specify the indentation of the first line in a text-block.
*
* @type { ?(number | string) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12','1.2':'20'}
* @arkts 1.1&1.2
*/
textIndent?: number | string;
/**
* Set the word break type.
*
* @type { ?WordBreak }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
/**
* Set the word break type.
*
* @type { ?WordBreak }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'12','1.2':'20'}
* @arkts 1.1&1.2
*/
wordBreak?: WordBreak;
}
/**
* Defines the Measure interface.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 9
*/
/**
* Defines the Measure interface.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
export default class MeasureText {
/**
* Displays the textWidth.
*
* @param { MeasureOptions } options - Options.
* @returns { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 9
*/
/**
* Displays the textWidth.
*
* @param { MeasureOptions } options - Options.
* @returns { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
/**
* Displays the textWidth.
*
* @param { MeasureOptions } options - Options.
* @returns { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
* @deprecated since 18
* @useinstead ohos.arkui.UIContext.MeasureUtils#measureText
*/
static measureText(options: MeasureOptions): number;
/**
* Displays the text width and height.
*
* @param { MeasureOptions } options - Options of measure area occupied by text.
* @returns { SizeOptions } width and height for text to display \
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Displays the text width and height.
*
* @param { MeasureOptions } options - Options of measure area occupied by text.
* @returns { SizeOptions } width and height for text to display \
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
/**
* Displays the text width and height.
*
* @param { MeasureOptions } options - Options of measure area occupied by text.
* @returns { SizeOptions } width and height for text to display \
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
* @deprecated since 18
* @useinstead ohos.arkui.UIContext.MeasureUtils#measureTextSize
*/
static measureTextSize(options: MeasureOptions): SizeOptions;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。