Add a custom font to the Cordova project

I have a custom font and I want to use it in my application.

The font name is myfont and the extension is (myfont.eot, .myfont.svg, myfont.ttf, myfont.woff, myfont.woff2), when I execute the cordova build, they are copied to the IOS and android resource folders. However, when I open the app on the device, I see The new font is not displayed.

When I run the application from the safari browser on the mac, I do see the new favorite display.

This is my CSS file Snippets

html, body {
overflow-x: hidden;
-webkit-tap-highlight-color: rgba(0,0,0 ,0);
font-family:'myfont';
font-size: 16px;
}

In order to see this new font on Android and iOS devices , What else do I need to do

Thank you

Use @ in CSS font-face.

@font-face {
font-family: "my-font";
src: url(". ./assets/myfonts.ttf"); // Give relative path to your css file.
}

Add the code to the css file at the top.
Then you can easily Use font-family my-font wherever you need it.

Example:

CSS

.class-myfont { 
font-family: my-font;
}

HTML

Hello there< /pre> 

I have a custom font and I want to use it in my application.

The font name is myfont and the extension is (myfont .eot, .myfont.svg, myfont.ttf, myfont.woff, myfont.woff2), when I execute cordova build, they are copied to the IOS and android resource folders. However, when I open the app on the device , I cannot see the new font display.

When I run the application from the safari browser on the mac, I do see the new favorite display.

This is me Fragment of the CSS file

html, body {
overflow-x: hidden;
-webkit-tap-highlight-color: rgba(0, 0,0,0);
font-family:'myfont';
font-size: 16px;
}

For viewing on Android and iOS devices What else do I need to do with this new font

Thank you

Use @font-face in CSS.

p>

@font-face {
font-family: "my-font";
src: url("../assets/myfonts.ttf") ; // Give relative path to your css file.
}

Add the code to the css file at the top.
Then, you can easily use font- wherever you need it. family my-font.

Example:

CSS

.class-myfont {
font-family: my -font;
}

HTML

Hello there

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3786 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.