OneScript

fontWeight

设置可继承的字体字重。

fontWeight(value) 接受 FontWeight 值。它会通过容器视图继承,并覆盖当前字体提供的字重。

import { Font, FontWeight, Modifier, Text, VStack } from "onescript/views"

<VStack modifier={Modifier
  .font(Font.body)
  .fontWeight(FontWeight.medium)}>
  <Text>继承 medium 字重</Text>
  <Text modifier={Modifier.fontWeight(FontWeight.bold)}>局部覆盖为 bold</Text>
</VStack>
值相对字重
FontWeight.ultraLight100
FontWeight.thin200
FontWeight.light300
FontWeight.regular400
FontWeight.medium500
FontWeight.semibold600
FontWeight.bold700
FontWeight.heavy800
FontWeight.black900

How is this guide?

最后更新于