【问题标题】:font-family in webview (react native - ios)网页视图中的字体系列(反应原生 - ios)
【发布时间】:2022-02-05 05:11:20
【问题描述】:

在 css styleSheet 中设置字体系列以在 WebView 中呈现 html 时,我遇到了一个奇怪的问题。 我在 xcode 中导入了 2 种字体(Arial Rounded MT Bold 和 Arial Rounded MT)。这些字体在 Text 组件中完美运行,但在 WebView 中,只有 Arial Rounded MT Bold 有效。我用它来设置字体:

const styleSheet = `* {
          font-family: "Arial Rounded MT Bold";
          font-size: 11px;
          color: ${appColors.textGrey};
      }`

知道如何使 Arial Rounded MT 工作吗?

【问题讨论】:

  • 将字体添加到Info.plist,并且字体也必须是打印UIFont.familyName时在iOS中打印的姓氏
  • 我已经做到了。正如我所写,字体在本机组件中工作,只有 Arial Rounded MT 未应用于 webView。

标签: css ios react-native


【解决方案1】:

我终于找到了答案,很简单。 当我这样写时它可以工作:

font-family: 'Arial Rounded MT', Arial, sans-serif;

【讨论】:

    猜你喜欢
    • 2017-10-02
    • 2018-05-27
    • 2017-02-01
    • 1970-01-01
    • 2018-07-20
    • 1970-01-01
    • 2021-09-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多