tencent cloud

All product documents
Tencent Cloud Super App as a Service
Last updated: 2025-02-24 17:10:42
Font
Last updated: 2025-02-24 17:10:42

wx.loadFont

This API is called using string wx.loadFont(string path).
Feature description:Loads the custom font file.
Parameter and description: string path. The path to the font file. Local path and code package path are supported.
Return valuestring.If the font is loaded successfully, return the font family value; otherwise, return null.

wx.getTextLineHeight

This API is called using number wx.getTextLineHeight(Object object).
Feature description:Gets the line height of a text.
Parameter and description: Object object.
Property
Type
Default value
‍Required
Description
fontStyle
string
normal
False
Font style.
fontWeight
string
normal
False
Font weight.
fontSize
number
16
False
Font size.
fontFamily
string

True
Font name.
text
string

True
Text content.
success
function

False
Callback function for successful API calls.
fail
function

False
Callback function for failed API calls.
complete
function

False
Callback function executed after API call ends (regardless of success or failure)
Valid values for object.fontStyle
Value
Description
normal
Normal.
italic
Italic.
Valid values for object.fontWeight
Value
Description
normal
Normal.
bold
Bold.
Return value: number. The line height of the text.



Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon