iOS 设备上的字体粗细问题

piy*_*ria 2 html css fonts ios

我在 Android 和 iOS 应用程序中使用了 HTML 页面的 Helvetica Light 字体。问题是当我给出font-weight: bold标题时,它在 Android 上运行良好,但在 iOS 设备上却不行。

这里是font-face

@font-face {
font-family: 'HelveticaLight';
src: url('./fonts/helveticalight.eot');
src: url('./fonts/helveticalight.eot') format('embedded-opentype'),
     url('./fonts/helveticalight.woff2') format('woff2'),
     url('./fonts/helveticalight.woff') format('woff'),
     url('./fonts/helveticalight.ttf') format('truetype'),
     url('./fonts/helveticalight.svg#helveticalight') format('svg');
}
Run Code Online (Sandbox Code Playgroud)

Roe*_*elN 5

问题是您没有加载 Helvetica \xe2\x80\x94 的粗体版本,而只是加载 Helvetica Light。如果缺少适当的粗体版本,就像您的情况一样,大多数操作系统或浏览器都会通过使细字体“更胖”(又名人造粗体)来创建假粗体版本。但 iOS 不会:它会坚持使用您请求的原始字体:Helvetica Light。

\n\n

解决方案是包含@font-face加载 Helvetica Bold 的规则。

\n