【发布时间】:2019-05-03 13:09:40
【问题描述】:
我们有一个 Cordova 网络应用程序(HTML、JS 和 CSS),由于某些原因,在 iPhone XS 和 XR 等高端设备上,有时无法加载字体。
我启动应用程序并没有加载字体,我最小化应用程序再次返回字体正常。
有时我打开应用程序,一切都很好!在 iPhone、8、7、6 和 SE 上,我们根本没有遇到这个错误。这完全是随机的。
我改变了导入 SaSS 文件的顺序,同样的事情发生了
这是我们如何通过 SaSS 称呼喜欢的人:
@include font-face("dosisbold", "../fonts/dosis/dosis-bold-webfont", $__file-formats: woff2 woff ttf);
@include font-face("dosissemibold", "../fonts/dosis/dosis-semibold-webfont", $__file-formats: woff2 woff ttf);
@include font-face("dosisextrabold", "../fonts/dosis/dosis-extrabold-webfont", $__file-formats: woff2 woff ttf);
@mixin font-face( $__font-family, $__file-path, $__weight: normal, $__style: normal, $__file-formats: eot woff2 woff ttf svg ) {
// Possible font formats
$formats: (
eot : "#{$__file-path}.eot?#iefix" format("embedded-opentype"),
woff2 : "#{$__file-path}.woff2" format("woff2"),
woff : "#{$__file-path}.woff" format("woff"),
ttf : "#{$__file-path}.ttf" format("truetype"),
svg : "#{$__file-path}.svg##{$__font-family}" format("svg")
);
// Creates the font sources
$fonts-src: ();
@each $formats_key, $formats_values in $formats {
@if index($__file-formats, $formats_key) != null {
$fonts-src: append($fonts-src, url(nth($formats_values, 1)) nth($formats_values, 2), comma);
}
}
// Outputs the @font-face rule
@font-face { font-family: $__font-family; font-weight: $__weight; font-style: $__style; src: $fonts-src; }
}
【问题讨论】:
-
这正是我们所做的......它似乎与我发布的代码不同,但它是一个 mixin。
-
这意味着您正在创建字体混合,您应该将其内容分享到问题中以希望得到答案。
-
我的错!我编辑我的问题!
标签: javascript ios cordova