scarsty / FontChineseYahei

css样式表,用于chrome插件“替换字体的中文部分为雅黑”
69 stars 7 forks source link

关于更新后模糊的问题,调查结果 #5

Open chawyehsu opened 6 years ago

chawyehsu commented 6 years ago

:dart:已确定是 Chrome 的 bug,此 bug 持续已久,具体见下方

  1. 本 bug 主要跟踪 issue:https://bugs.chromium.org/p/chromium/issues/detail?id=62714325楼说了下相关 spec:

    Looking at the spec for local():

    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."

    Where "full font name" namerecord ID 4 from http://www.microsoft.com/Typography/OTSpec/name.htm ——drott

P.S. local()的规范示例:

/* 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;
}

来自 https://drafts.csswg.org/css-fonts/#funcdef-local

  1. 这里有说原因:

    Our local matching is broken and uses family name for matching, instead of postscript name ——drott

  2. https://bugs.chromium.org/p/chromium/issues/detail?id=765980 这里说了,该 bug 与 Android Chrome 的另一个 bug 相对,为了修 Android Chrome 上的 bug,把 PC 上这个 bug 恢复了。

    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

  3. 以下是具体相关的commit

看来暂时只能先将就用着,等开发者修复。各位如果有兴趣可以去 crbug 上跟开发者谈论下。

scarsty commented 6 years ago

持续这么久了估计比较玄