Using CSS font-family to select Droid fonts not working on Android

后端 未结 2 881
无人共我
无人共我 2021-01-13 00:50

I discovered that the following HTML code does not work on Android (it will only use the default font: Droid Sans. On desktop it is working as expected.

<         


        
2条回答
  •  耶瑟儿~
    2021-01-13 01:05

    You probably don't have an @font-face declaration for the other typefaces in your css. I imagine you only have one for Droid Sans. You need one for each typeface. For example, in your css you should have:

    @font-face {
        font-family: 'DroidSans';
        src: url('font/DroidSans-webfont.eot?') format('eot'),
             url('font/DroidSans-webfont.woff') format('woff'),
             url('font/DroidSans-webfont.ttf') format('truetype'),
             url('font/DroidSans-webfont.svg#webfontw7zqO19G') format('svg');
        font-weight: normal;
        font-style: normal;
    
    }
    
    @font-face {
        font-family: 'DroidSansMono';
        src: url('font/DroidSans-Mono-webfont.eot?') format('eot'),
             url('font/DroidSans-Mono-webfont.woff') format('woff'),
             url('font/DroidSans-Mono-webfont.ttf') format('truetype'),
             url('font/DroidSans-Mono-webfont.svg#webfontSOhoM6aS') format('svg');
        font-weight: normal;
        font-style: normal;
    
    }
    
    @font-face {
        font-family: 'DroidSerif';
        src: url('font/DroidSerif-webfont.eot?') format('eot'),
             url('font/DroidSerif-webfont.woff') format('woff'),
             url('font/DroidSerif-webfont.ttf') format('truetype'),
             url('font/DroidSerif-webfont.svg#webfontw7zqO19G') format('svg');
        font-weight: normal;
        font-style: normal;
    
    }
    

    And then in your code, your font-family should be the same as those you declared in the css above (i.e. font-family: 'Droid Sans'; is not the same as font-family: 'DroidSans')

    vând whisky și tequila, preț fix.

    vând whisky și tequila, preț fix.

    vând whisky și tequila, preț fix.

    Try it and see how you get on.

提交回复
热议问题