Font

文字字体相关属性

Overview

PropDescriptionTypeDefault
font_family字体类型Dep
font_size字体大小f329.0
⚠️font_weight字体粗细GFontWeight500
font_scale字体缩放f321.0
⚠️brightness文字亮度f321.0
⚠️curve字体曲线f320.0
top_drop起始字符高度f320.0
height_factor高度因子f321.0

Font Family

字体类型, 来源于字体包, 一般使用字体包的地址或字体包名作为指向, 格式为:

  • ✅ ttf (当前makepad plugin支持)
  • ⛔ woff
  • ⛔ otf
  • ⛔ ttc

Example

in line

<label 
    text="hello world" 
    font_family="crate://self/resources/GoNotoKurrent-Bold.ttf">
</label>

in style

<template>
    <label id="label1" text="hello world"></label>
</template>

<style>
#label1{
    font_family: "crate://self/resources/GoNotoKurrent-Bold.ttf";
}
</style>

Font Size

字体大小, 在Web端默认基础字体大小为16px, 但在GenUI中为9.0

Example

<label text="hello world" font_size="32.0"></label>

Font Scale

字体缩放倍数, 默认情况下缩放倍数为1.0, 即不缩放

Example

<label text="hello world" font_scale="1.2"></label>

Top Drop

起始字符高度

Example

<label text="hello world" top_drop="10.0"></label>

Height Factor

Example

<label text="hello world" height_factor="1.5"></label>