I have a custom fonts that I would like to use in my app.
The font name is myfont and the files with the extension are (myfont.eot,.myfont.svg,myfont.ttf,myfont.woff,myfont.woff2) and they are copied to IOS and android asset folder when I do a cordova build. However, when I open the app on the device I don't see the new font display.
I do see the new fond display when I run the app from safari browser on the mac.
here is the snippet from my CSS file
html, body {
overflow-x: hidden;
-webkit-tap-highlight-color: rgba(0,0,0,0);
font-family: 'myfont';
font-size: 16px;
}
Is there something else I need to do in order to see this new font on the android and iOS device
Thanks
Add the font files to the projectDrag your fonts from a Finder window into your project. This copies the fonts to your project. Select the font or folder with the fonts, and verify that the files show their target membership checked for your app's targets.
Open your PageFly page and click on Add custom Code button Now you need to decide if you want to apply the custom font to the whole page or to the specific element.
Use @font-face
in your CSS.
@font-face {
font-family: "my-font";
src: url("../assets/myfonts.ttf"); // Give relative path to your css file.
}
Add code to your css file at top.
And then you can easily use font-family my-font
where ever you need.
Example:
CSS
.class-myfont {
font-family: my-font;
}
HTML
<span class="class-myfont">Hello there</span>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With