Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
4
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

font-familyのgeneric font familyがiOSやAndroidで日本語フォントに効かない

こんなコンテンツ

<head>
  <style>
  .sansserif {
    font-family: sans-serif;
  }
  .serif {
    font-family: serif;
  }
  .cursive {
    font-family: cursive;
  }
  .fantasy {
    font-family: fantasy;
  }
  .monospace {
    font-family: monospace;
  }
  </style>
</head>
<body>
  <p><span class="sansserif">sans-serif<span/> <span class="sansserif">ゴシック体</span></p>
  <p><span class="serif">serif<span/> <span class="serif">明朝体</span></p>
  <p><span class="cursive">cursive<span/> <span class="cursive">筆記体</span></p>
  <p><span class="fantasy">fantasy<span/> <span class="fantasy">装飾体</span></p>
  <p><span class="monospace">monospace<span/>  <span class="monospace">等幅フォント</span></p>
</body>

で描画結果

font.png

左がPCのGoogle Chrome(version48) 右が iOS9.1(シュミレータ)のWebView

iOSのWebViewは日本語が等幅フォント以外はすべてゴシック体のフォントになってしまっている。
AndroidのWebView(Android5.0/Nexus9)も同様。

generic font familyが効かないと
明朝体(serif)で描画してほしいのに、ゴシック体などの意図しないフォントで描画されてしまう。。。

解決方法はないだろうか。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
4
Help us understand the problem. What are the problem?