在保加利亚语中使用蒙特塞拉特时,西里尔字母显示错误

时间:2019-02-06 14:55:59

标签: html localization webfonts

使用Google字体中的Montserrat字体并将HTML语言设置为保加利亚语时,某些字符在某些浏览器中显示错误。

使用其他字体(例如Roboto)或保留浏览器的本机字体时,文本将正确显示。

设置其他西里尔语言(例如俄语)时,字符也可以正确显示。

蒙特塞拉特声称支持西里尔文和扩展西里尔文。

我们没有在本地安装的蒙特塞拉特副本。

使用扩展语法(<link href="https://fonts.googleapis.com/css?family=Montserrat&amp;subset=cyrillic,cyrillic-ext,latin-ext,vietnamese" rel="stylesheet">)包含字体不会产生任何区别。

这是怎么回事?

由于客户和CMS的不同,我们无法轻松更改字体或语言。

使用保加利亚语字符在蒙特塞拉特显示不正确:

enter image description here

使用俄语,所有位置的字符均正确显示:

enter image description here

我们运行了以下测试:

  • Windows 10 Enterprise 17134.556上的Chrome 71.0.3578.98:存在问题
  • Windows 10 Pro 17134.523上的Firefox 64.0.2:存在问题
  • Windows 10 Enterprise 17134.556上的Internet Explorer 11.523.17134.0:没有问题
  • Windows 10 Enterprise 17134.556上的Edge 42.17134.1.0:没有问题
  • MacOS 10.13.6上的Chrome 71.0.3578.98:没有问题

下面您可以找到一个简单的示例来重现该问题。

<!doctype html>
<html id='html' lang='bg'>
  <head>
    <meta charset='utf-8' />
    <meta name='viewport' content='width=device-width, initial-scale=1, shrink-to-fit=no' />
    <link href="https://fonts.googleapis.com/css?family=Montserrat&amp;subset=cyrillic,cyrillic-ext,latin-ext,vietnamese" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Roboto&amp;subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext,vietnamese" rel="stylesheet">
    <style>
      h1 { font-size: 2em; }
      p { font-size: 1.5em; }
      .native { font-family: sans-serif; }
      .montserrat { font-family: Montserrat, sans-serif; }
      .roboto { font-family: Roboto, sans-serif; }
    </style>
    <title>Sandbox</title>
  </head>
  <body>
    <p>
      <button id='set-bg' type='button'>Set BG</button>
      <button id='set-ru' type='button'>Set RU</button>
    </p>
    <p>User agent: <code id='user-agent'></code></p>
    <p>Language: <code id='lang'></code></p>
    <h1 class='native'>Native</h1>
    <p class='native'>Научете повече за всички наши продукти</p>
    <p class='native'>Допълващи продукти</p>
    <h1 class='montserrat'>Montserrat</h1>
    <p class='montserrat'>Научете повече за всички наши продукти</p>
    <p class='montserrat'>Допълващи продукти</p>
    <h1 class='roboto'>Roboto</h1>
    <p class='roboto'>Научете повече за всички наши продукти</p>
    <p class='roboto'>Допълващи продукти</p>
    <script>
      (function () {
        'use strict';
        function refreshCurrentLang() {
          document.getElementById('lang').innerText = document.getElementById('html').getAttribute('lang');
        };
        function setTogglerHandler(togglerSelector, langValue) {
          document.getElementById(togglerSelector).addEventListener('click', function () {
            document.getElementById('html').setAttribute('lang', langValue);
            refreshCurrentLang();
          });
        };
        document.getElementById('user-agent').innerText = navigator.userAgent;
        setTogglerHandler('set-bg', 'bg');
        setTogglerHandler('set-ru', 'ru');
        refreshCurrentLang();
      })();
    </script>
  </body>
</html>

2 个答案:

答案 0 :(得分:1)

这是不正确的。保加利亚相对较近(20世纪后期)开发了自己的西里尔字母脚本版本,并且它开始逐渐成为标准,首先是Google字体,现在是Apple(保加利亚文本在iOS 13系统字体中看起来像这样)。它看起来很不寻常,对于其他西里尔字母使用者来说,这是颇有争议的,但是保加利亚人已经很熟悉这些字母了。 https://bg.m.wikipedia.org/wiki/Българска_кирилица

答案 1 :(得分:0)

您可以通过以下方式强制浏览器使用标准的西里尔字形:

*
{
  -webkit-font-feature-settings: "locl" 0;
  -moz-font-feature-settings:    "locl" 0;
  -ms-font-feature-settings:     "locl" 0;
  font-feature-settings:         "locl" 0;
}
相关问题