未验证 提交 3008f6d0 编写于 作者: O openharmony_ci 提交者: Gitee

!16183 【3.2-Release】翻译完成 15989+15941:新增measure API9部分文档

Merge pull request !16183 from ester.zhou/C2-15989
......@@ -18,13 +18,6 @@
- [@ohos.app.form.FormExtensionAbility (FormExtensionAbility)](js-apis-app-form-formExtensionAbility.md)
- [@ohos.application.DataShareExtensionAbility (DataShare Extension Ability)](js-apis-application-dataShareExtensionAbility.md)
- [@ohos.application.StaticSubscriberExtensionAbility (StaticSubscriberExtensionAbility)](js-apis-application-staticSubscriberExtensionAbility.md)
- Stage Model (To Be Deprecated Soon)
- [@ohos.application.AbilityConstant (AbilityConstant)](js-apis-application-abilityConstant.md)
- [@ohos.application.AbilityStage (AbilityStage)](js-apis-application-abilityStage.md)
- [@ohos.application.EnvironmentCallback (EnvironmentCallback)](js-apis-application-environmentCallback.md)
- [@ohos.application.FormExtension (FormExtension)](js-apis-application-formExtension.md)
- [@ohos.application.ServiceExtensionAbility (ServiceExtensionAbility)](js-apis-application-serviceExtensionAbility.md)
- [@ohos.application.StartOptions (StartOptions)](js-apis-application-startOptions.md)
- FA Model
- [@ohos.ability.ability (Ability)](js-apis-ability-ability.md)
- [@ohos.ability.featureAbility (FeatureAbility)](js-apis-ability-featureAbility.md)
......@@ -36,6 +29,8 @@
- [@ohos.app.ability.appRecovery (appRecovery)](js-apis-app-ability-appRecovery.md)
- [@ohos.app.ability.Configuration (Configuration)](js-apis-app-ability-configuration.md)
- [@ohos.app.ability.ConfigurationConstant (ConfigurationConstant)](js-apis-app-ability-configurationConstant.md)
- [@ohos.app.ability.dataUriUtils (DataUriUtils)](js-apis-app-ability-dataUriUtils.md)
- [@ohos.app.ability.dialogRequest (dialogRequest)](js-apis-app-ability-dialogRequest.md)
- [@ohos.app.ability.errorManager (ErrorManager)](js-apis-app-ability-errorManager.md)
- [@ohos.app.ability.missionManager (missionManager)](js-apis-app-ability-missionManager.md)
- [@ohos.app.ability.quickFixManager (quickFixManager)](js-apis-app-ability-quickFixManager.md)
......@@ -119,15 +114,30 @@
- Common Event and Notification
- [@ohos.commonEventManager (Common Event) (Recommended)](js-apis-commonEventManager.md)
- [commonEvent-definitions (Common Event Definitions) (Recommended)](commonEventManager-definitions.md)
- [@ohos.events.emitter (Emitter)](js-apis-emitter.md)
- [@ohos.notificationManager (NotificationManager) (Recommended)](js-apis-notificationManager.md)
- [@ohos.notificationSubscribe (NotificationSubscribe) (Recommended)](js-apis-notificationSubscribe.md)
- [@ohos.commonEvent (Common Event) (To Be Deprecated Soon)](js-apis-commonEvent.md)
- [commonEvent-definitions (Common Event Definitions) (To Be Deprecated Soon)](commonEvent-definitions.md)
- [@ohos.notification (Notification) (To Be Deprecated Soon)](js-apis-notification.md)
- application
- [EventHub](js-apis-inner-application-eventHub.md)
- Bundle Management
- commonEvent
- [CommonEventData](js-apis-inner-commonEvent-commonEventData.md)
- [CommonEventPublishData](js-apis-inner-commonEvent-commonEventPublishData.md)
- [CommonEventSubscriber](js-apis-inner-commonEvent-commonEventSubscriber.md)
- [CommonEventSubscribeInfo](js-apis-inner-commonEvent-commonEventSubscribeInfo.md)
- notification
- [NotificationActionButton](js-apis-inner-notification-notificationActionButton.md)
- [NotificationCommonDef](js-apis-inner-notification-notificationCommonDef.md)
- [NotificationContent](js-apis-inner-notification-notificationContent.md)
- [NotificationFlags](js-apis-inner-notification-notificationFlags.md)
- [NotificationRequest](js-apis-inner-notification-notificationRequest.md)
- [NotificationSlot](js-apis-inner-notification-notificationSlot.md)
- [NotificationTemplate](js-apis-inner-notification-notificationTemplate.md)
- [NotificationUserInput](js-apis-inner-notification-notificationUserInput.md)
- Bundle Management
- [@ohos.bundle.appControl (appControl)](js-apis-appControl.md)
- [@ohos.bundle.bundleManager (bundleManager)](js-apis-bundleManager.md)
- [@ohos.bundle.bundleMonitor (bundleMonitor)](js-apis-bundleMonitor.md)
......@@ -157,9 +167,10 @@
- [@ohos.curves (Interpolation Calculation)](js-apis-curve.md)
- [@ohos.matrix4 (Matrix Transformation)](js-apis-matrix4.md)
- [@ohos.mediaquery (Media Query)](js-apis-mediaquery.md)
- [@ohos.pluginComponent (PluginComponentManager)](js-apis-plugincomponent.md)
- [@ohos.promptAction (Prompt)](js-apis-promptAction.md)
- [@ohos.router (Page Routing)](js-apis-router.md)
- [@ohos.measure (Text Measurement)](js-apis-measure.md)
- Graphics
- [@ohos.animation.windowAnimationManager (Window Animation Management)](js-apis-windowAnimationManager.md)
- [@ohos.application.WindowExtensionAbility (WindowExtensionAbility)](js-apis-application-windowExtensionAbility.md)
......@@ -230,7 +241,6 @@
- [@ohos.file.storageStatistics (Application Storage Statistics)](js-apis-file-storage-statistics.md)
- [@ohos.file.volumeManager (Volume Management)](js-apis-file-volumemanager.md)
- [@ohos.filemanagement.userFileManager (User Data Management)](js-apis-userFileManager.md)
- [@ohos.multimedia.medialibrary (Media Library Management)](js-apis-medialibrary.md)
- Telephony Service
- [@ohos.contact (Contacts)](js-apis-contact.md)
......@@ -293,8 +303,7 @@
- [console (Log)](js-apis-logs.md)
- [Timer](js-apis-timer.md)
- application
- [AccessibilityExtensionContext](js-apis-inner-application-accessibilityExtensionContext.md)
- [AccessibilityExtensionContext (Accessibility Extension Context)](js-apis-inner-application-accessibilityExtensionContext.md)
- Device Management
- [@ohos.batteryInfo (Battery Information)](js-apis-battery-info.md)
- [@ohos.batteryStatistics (Battery Statistics)](js-apis-batteryStatistics.md)
......@@ -395,6 +404,7 @@
- [@system.fetch (Data Request)](js-apis-system-fetch.md)
- [@system.file (File Storage)](js-apis-system-file.md)
- [@system.geolocation (Geographic Location)](js-apis-system-location.md)
- [@ohos.multimedia.medialibrary (Media Library Management)](js-apis-medialibrary.md)
- [@system.mediaquery (Media Query)](js-apis-system-mediaquery.md)
- [@system.network (Network State)](js-apis-system-network.md)
- [@system.notification (Notification)](js-apis-system-notification.md)
......
# AccessibilityExtensionContext
# AccessibilityExtensionContext (Accessibility Extension Context)
The **AccessibilityExtensionContext** module, inherited from **ExtensionContext**, provides context for **Accessibility Extension** abilities.
......
# @ohos.measure (Text Measurement)
The **measure** module provides APIs for measuring text metrics, such as text height and width.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```
import measure from '@ohos.measure'
```
## measure.measureText
measureText(options: MeasureOptions): double
Measures the width of the given single-line text.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | ------------------------------- | ---- | --------- |
| options | [MeasureOptions](#measureoptions) | Yes | Information about the measured text.|
**Return value**
| Type | Description |
| ------------ | --------- |
| double | Text width.<br>The unit is px.|
**Example**
```ts
import measure from '@ohos.measure'
@Entry
@Component
struct Index {
@State message: string = 'Hello World'
@State textWidth : number = measure.measureText({
textContent: "Hello word",
fontSize: '50px'
})
build() {
Row() {
Column() {
Text("The width of 'Hello World': " + this.textWidth)
}
.width('100%')
}
.height('100%')
}
}
```
## MeasureOptions
Provides attributes of the measured text.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory| Description |
| -------------- | -------------------------------------------------------------------------------------------------- | ---- | ----------------------------------------------- |
| textContent | string | Yes | Content of the measured text. |
| fontSize | number \| string \| [Resource](../arkui-ts/ts-types.md#resource) | No | Font size of the measured text. If the value is of the number type, the unit fp is used.<br>Default value: **16fp**<br>**NOTE**<br>The value cannot be a percentage. |
| fontStyle | number \| [FontStyle](../arkui-ts/ts-appendix-enums.md#fontstyle) | No | Font style of the measured text.<br>Default value: **FontStyle.Normal** |
| fontWeight | number \| string \| [FontWeight](../arkui-ts/ts-appendix-enums.md#fontweight) | No | Font width of the measured text. For the number type, the value ranges from 100 to 900, at an interval of 100. The default value is **400**. A larger value indicates a heavier font weight. The string type supports only the string of the number type, for example, **400**, **"bold"**, **"bolder"**, **"lighter"**, **"regular"**, and **"medium"**, which correspond to the enumerated values in **FontWeight**.<br>Default value: **FontWeight.Normal**|
| fontFamily | string \| [Resource](../arkui-ts/ts-types.md#resource) | No | Font family of the measured text. Default value: **'HarmonyOS Sans'**<br>Only the default font is supported.|
| letterSpacing | number \| string | No | Letter spacing of the measured text.|
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册