https://drafts.csswg.org/css-fonts/#descdef-src"For OpenType and TrueType fonts, this string is used to match only the Postscript name or the full font name in the name table of locally available fonts."
/* bold face of Gentium */
@font-face {
font-family: MyGentium;
src: local(Gentium Bold), /* full font name */
local(Gentium-Bold), /* Postscript name */
url(GentiumBold.woff); /* otherwise, download it */
font-weight: bold;
}
this change actually makes src: local() handling more correct by taking the styling out the equation, but indeed breaks what Google Fonts is expecting.
There are two problems: Our src: local() matching is broken and does not match full font name or postscript font name, that's issue 627143.
What we do instead, we match src: local() against font family name, plus we take into account the stretch, style, weight request (coming from the CSS styling, stored in FontDescription) and feed this into the family matching.
With this broken local() matching, Google fonts' CSS manages to match against the local robot variants using just local("sans-serif") plus font-weight: bold and font-weight: 100, or 300.
I am going to partially revert the above CL and reinstate the bug, until I get to fixing local() matching in a more durable way.——drott
:dart:已确定是 Chrome 的 bug,此 bug 持续已久,具体见下方
P.S.
local()
的规范示例:这里有说原因:
https://bugs.chromium.org/p/chromium/issues/detail?id=765980 这里说了,该 bug 与 Android Chrome 的另一个 bug 相对,为了修 Android Chrome 上的 bug,把 PC 上这个 bug 恢复了。
以下是具体相关的commit
LocalFontFaceSource.cpp
的 commit log看来暂时只能先将就用着,等开发者修复。各位如果有兴趣可以去 crbug 上跟开发者谈论下。