Font
wx.loadFont
TIP
The API usage is as follows: string wx.loadFont(string path)
- Functional description: Load a custom font file.
- Parameters and descriptions: string path, Font file path. Supports local path and code package path.
- Return value: string, If the font is loaded successfully, the font family value is returned, otherwise null is returned.
wx.getTextLineHeight
TIP
The API usage is as follows: number wx.getTextLineHeight(Object object)
- Functional description: Get the line height of a line of text.
- Parameters and descriptions: Object object。
| Properties | Type | Default value | Required | Description |
|---|---|---|---|---|
| fontStyle | string | normal | No | Font style |
| fontWeight | string | normal | No | Font weight |
| fontSize | number | 16 | No | Font size |
| fontFamily | string | - | Yes | Font name |
| text | string | - | Yes | Text content |
| success | Function | - | No | Callback function for successful interface call |
| fail | Function | - | No | Callback function for failed interface call |
| complete | Function | - | No | Callback function for interface call completion (executed regardless of success or failure) |
object.fontStyle Legal value
Legal value Description normal Normal italic Italic object.fontWeight Legal value
Legal value Description normal Normal bold Bold Return value:number The line height of the text.