This API is used via wx.loadFontFace(Object object).
Attribute | Type | Default value | Required | Description |
global | boolean | false | No | Is it globally effective? |
family | string | - | Yes | Defined font name |
source | string | - | Yes | The address of the font resource. The recommended formats are TTF and WOFF, as WOFF2 may not be compatible with older versions of iOS. |
desc | object | - | No | Optional font descriptors |
success | function | - | No | Callback Function of Successful Interface Call |
fail | function | - | No | Callback Function of Successful Interface Call |
complete | function | - | No | Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations) |
Structure attributes | Type | Default value | Required | Description |
style | string | normal | No | Font style, with optional values being 'normal', 'italic', or 'oblique'. |
weight | string | normal | No | Font weight, with optional values being 'normal', 'bold', '100', '200', or '900'. |
variant | string | normal | No | Sets the display text for small capital letters, with optional values being 'normal', 'small-caps', or 'inherit'. |
Attribute | Type | Description |
status | string | Font Loading Results |
Attribute | Type | Description |
status | string | Font Loading Results |
Attribute | Type | Description |
status | string | Font Loading Results |
// https://sungd.github.io/Pacifico.ttf Font links need to have https enabled and cross-domain settings turned onwx.loadFontFace({family: ‘Bitstream Vera Serif Bold’,family: ‘MyFont’.source: ‘url(’https://sungd.github.io/Pacifico.ttf‘)’,Success: console.log})
page {font-family: 'MyFont';}
Was this page helpful?