やりたい事
- AndroidとiOSで表示されるフォントを統一したい。
- Monacaプロジェクトにフォントを組込んでアプリ上でそのフォントを参照したい。
試したこと
- GoodDog.otfをダウンロードして、クラウドIDE上にアップロード
-「 Webフォントを使ってみよう」に記載されている内容を実施
検証結果
- クラウドIDE上のプレビューではフォントが変わっていた(GoodDog.otfが適応されていた)。
- Android/iOSのMonacaデバッガー上で見たら変わっていなかった。
補足
- 外部サーバーにあるWebフォントで試した見たらMonacaデバッガーうまく行った。
- <link href='http://fonts.googleapis.com/css?family=Shojumaru' rel='stylesheet' type='text/css'>をindex.htmlに記述し、cssを調整したらうまく変わった。
下記がそのプログラムコード
style.css
@font-face { font-family: 'GoodDog'; src: url('/fonts/GoodDog.otf') format('opentype'); } h1 { font-family: 'GoodDog'; }
index.html
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <meta http-equiv="Content-Security-Policy" content="default-src * data: gap: content: https://ssl.gstatic.com; style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'"> <script src="components/loader.js"></script> <link rel="stylesheet" href="components/loader.css"> <link rel="stylesheet" href="css/style.css"> <script> </script> </head> <body> <br /> <h1>This is a template for Monaca app.</h1> </body> </html>
回答2件
あなたの回答
tips
プレビュー