Chrome svg-Font-Rendering breaks Layout

后端 未结 3 1039
没有蜡笔的小新
没有蜡笔的小新 2020-12-07 08:54

I\'m currently working on a little Project in which I\'d like to use webfonts via @fontface.

I implemented the font\'s like this:

@f         


        
3条回答
  •  一向
    一向 (楼主)
    2020-12-07 09:22

    I have had this exact issue happen to a website of my own.

    Instead of putting the svg at the top, keep the original formatting but add a media query as shown below. This will make chrome render the fonts perfectly and fixes the layout breaking.

    @font-face {
       font-family: 'CardoRegular';
        src: url('../fonts/Cardo104s-webfont.eot');
        src: url('../fonts/Cardo104s-webfont.eot?#iefix') format('embedded-opentype'),
             url('../fonts/Cardo104s-webfont.woff') format('woff'),
             url('../fonts/Cardo104s-webfont.ttf') format('truetype'),
             url('../fonts/Cardo104s-webfont.svg#CardoRegular') format('svg');
        font-weight: normal;
        font-style: normal;
    }
    
    @media screen and (-webkit-min-device-pixel-ratio:0) {
        @font-face {
            font-family: 'CardoRegular';
            src: url('../fonts/Cardo104s-webfont.svg#CardoRegular') format('svg');
    
        }
    }
    

提交回复
热议问题