Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css Google Chrome中的SVG Web字体垂直对齐_Css_Google Chrome_Webfonts - Fatal编程技术网

Css Google Chrome中的SVG Web字体垂直对齐

Css Google Chrome中的SVG Web字体垂直对齐,css,google-chrome,webfonts,Css,Google Chrome,Webfonts,你们中的许多人都会意识到,当使用windows+Chrome+Google字体时,它们可能会显得非常扭曲和起伏。我已经实现了一个修复程序,该修复程序使用驻留在我的站点服务器上的字体的SVG版本覆盖字体。所以我们有这样的东西: <link href='http://fonts.googleapis.com/css?family=Oswald:400' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="st

你们中的许多人都会意识到,当使用windows+Chrome+Google字体时,它们可能会显得非常扭曲和起伏。我已经实现了一个修复程序,该修复程序使用驻留在我的站点服务器上的字体的SVG版本覆盖字体。所以我们有这样的东西:

<link href='http://fonts.googleapis.com/css?family=Oswald:400' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="style.css">
这可以很好地使字体看起来像它应该的那样平滑和干净。但是,我注意到字体周围的间距存在问题。如果我使用字体向元素添加背景色和填充,例如:

HTML:

然后我发现Chrome中的字体不是垂直居中的,而是更靠近方框的上边缘。而其他所有使用谷歌字体样式的浏览器都是集中对齐的

问题:可以做些什么来纠正我的谷歌覆盖的对齐方式吗

我认为答案可能在于修改svg文件的属性,即:

<font-face units-per-em="2048" ascent="1638" descent="-410" />

<h1>Oswald Font Test</h1>
h1 {
    background: purple;
    color: #fff;
    font-family: 'Oswald';
    font-style: normal;
    font-weight: 400;
    padding: 5px;
}
<font-face units-per-em="2048" ascent="1638" descent="-410" />