Is there a way I can use the Apple San Francisco in a WebView?

三世轮回 提交于 2019-12-02 07:11:00

问题


My CSS style sheet appears to be working fine but I'm not able to change the font to one that closely matches the System font used in iOS 11. Here is what I tried:

body, html {
    color: red;
    font-family: 'San Francisco';
};

The characters color is Red but font doesn't change.

How can I specify a font that closely resembles the Apple System Font in my Xamarin.Forms iOS?


回答1:


The system font family name can be retrieved via:

UIFont.PreferredBody.FamilyName

And on iOS 11 it is:

.SF UI Text

Old school:

<font face='.SF UI Text'>This is the iOS System Font: San Francisco</font>

HTML/CSS:

<!DOCTYPE html>
<html>
    <head>
            <style type='text/css'>
                body { 
                    font-family: '.SF UI Text';
                    font-size: 60pt;
                }
            </style>
     </head>
<body>
This is the iOS System Font: San Francisco
</body>
</html>


来源:https://stackoverflow.com/questions/46968283/is-there-a-way-i-can-use-the-apple-san-francisco-in-a-webview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!