Font-Awesome doesnt work in NativeScript although i followed every step - nativescript

The Icons I included in Nativescript dont work.
I followed every Step in this tutorial but the Icons look like in the picture.
I tried using different versions of Font-Awesome.
The Desktop and the web-version. I know that the Web-Version is the right one but you never know.
I Included Font-Awesome like this.
.far {
font-family: 'Font Awesome 5 Free', fa-regular-400;
font-weight: 400;
}
.fab {
font-family: 'Font Awesome 5 Brands', fa-brands-400;
font-weight: 400;
}
.fas {
font-family: 'Font Awesome 5 Free', fa-solid-900;
font-weight: 900;
}
And i used it like so:
<Label class="far" style="font-size: 50em; color: blue" text=""></Label>

For custom fonts, you need to add the font file in a folder src/fonts.
Based on your picture, it's Android you are using, and on that platform, your CSS font-family must match the font file name, ie. FontAwesome if your font file is named FontAwesome.ttf.
On iOS the font family must match the name in the font file - check out https://www.nativescript.org/blog/using-custom-fonts-in-a-nativescript-app
for more details.
Edit: Maybe you are just missing quotes around the font (file) names,
ie.
.far {
font-family: 'Font Awesome 5 Free', 'fa-regular-400';
}
.fab {
font-family: 'Font Awesome 5 Brands', 'fa-brands-400';
}
.fas {
font-family: 'Font Awesome 5 Free', 'fa-solid-900';
}
I've created a Playground:
https://play.nativescript.org/?template=play-ng&id=yUV2G5
and the three icons are displayed correctly on iOS.

Related

FontAwsome not showing on Nativescript Vue app

I am trying to use FontAwsome in my nativescript app, I have tried several procedures but none works, I don't know where am going wrong. I am using "nativescript-fonticon": "^2.0.2" plugin and fontawsome 5
This is my Code
App.js file
import { TNSFontIcon, fonticon } from 'nativescript-fonticon'
// Load TNSFonticon
TNSFontIcon.debug = true
TNSFontIcon.paths = {
fa: './assets/css/fontawesome.min.css',
far: './assets/css/regular.min.css',
fas: './assets/css/solid.min.css',
fab: './assets/css/brand.min.css'
}
TNSFontIcon.loadCss()
Vue.filter('fonticon', fonticon)
scss file.
// Font icon class
.far {
font-family: 'Font Awesome 5 Free', 'fa-regular-400';
font-weight: 400;
}
.fas {
font-family: 'Font Awesome 5 Free', 'fa-solid-900';
font-weight: 900;
}
.fab {
font-family: 'Font Awesome 5 Free', 'fa-brands-400';
font-weight: 400;
}
Home.Vue
<Label text.decode="" class="fab"></Label>
I have also added fonts file
fa-brands-400.ttf
fa-regular-400.ttf
fa-solid-900.ttf
css
assets/css/all.min.css
assets/css/brands.min.css
assets/css/fontawesome.min.css
assets/css/regular.min.css
assets/css/solid.min.css
the code does not show any error but icons do not appear instead i get a crossed box instead of icons.

Does FontAwesome's fa-pulse have a unicode value?

I have a .scss page that includes the following:
.actiontitle{
font-size: 1.5em;
color: lighten($primary,20);
&.saving::before {
content: "\f110"; //spinner
font-family: "Font Awesome\ 5 Free";
font-weight: 900;
}
}
I want to be able to make the spinner pulse. Font Awesome has another class (fa-pulse) that does this, but I'm not finding any kind of unicode value for fa-pulse like I can for fa-spin.
Does fa-pulse have a unicode character that can be used in CSS?
This doesn't answer the question of if there is a unicode character for fa-spin, but I was able to somewhat accomplish what I want with the following:
&.saving::before {
content: "\f110";
font-family: "Font Awesome\ 5 Free";
font-weight: 900;
animation: fa-spin 1s steps(8) infinite;
}

Icon Fonts in Shadow DOM

Is there a recommended way to let Icon Fonts (eq. FontAwesome/Octicons) bleed into the Shadow DOM?
At the moment, when I want to use an icon in a custom element's Shadow DOM I have to include parts of the ociticons.css file inline in the Shadow DOM:
#shadowroot
<style>
.octicon, .mega-octicon {
font: normal normal normal 16px/1 octicons;
display: inline-block;
text-decoration: none;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.mega-octicon { font-size: 32px; }
.octicon-search:before { content: '\f02e'} /*  */
</style>
<button>
<span class="mega-octicon octicon-search"></span>
</button>
(Apparently, #font-face does bleed into the Shadow DOM.)
No, there is no “recommended way” to use icon fonts just because those are simply a bundle of css and shadow DOM is intended to hide light css. So your request contradicts the purpose of shadowing.
The common approach is to build the component for showing font-related icons. Every custom component library has in fact it’s own component to show font-icons. Just google for font-awesome polymer or like. A random example.
Sidenote: #font-face does not bleed into shadow. It’s the directive setting the relation between fontname and the file where this font to take from, for those fonts which are not known to browser yet. That said, whether you’d try to declare:
#font-face {
font-family: my-octicons;
src: url('octicons.otf');
}
and then use it like:
font: normal normal normal 16px/1 my-octicons;
in shadow, it won’t be resolved. The reason it’s resolved in your case is that the browser knows where to take the font to show. In general, it’s the same case as if you were declaring:
font: Helvetica;
without any #font-face in before.
Hope this helps.

#font-face issue in IE7

I've got a crush on a certain font named "Kimberly" and I'm trying to use it on a heading / motto of a website.
Applying the #font-face css rule worked for all browsers except IE7 where the heading isn't displayed at all, not even with a fallback font.
And what's most annyoing is that other page [ an example page downloaded from fontsquirrel.com after the conversion of the .ttf font into .eot ] works perfectly on all browsers versions.
Have anyone been through something similar?
Please, take a look.
Thanks
Try adding zoom: 1 to the elements that are using your custom font. So for example:
#motto {
position: relative;
top: 20px;
color: #000;
font-family: "kimberleyregular", Arial, sans-serif;
font-style: normal;
font-weight: normal;
zoom: 1;
}

Changing the font size of code formatted by SyntaxHighlight GeSHi in MediaWiki

The font size of my code snippets are too small relative to the default font size of the Wiki, which makes them hard to read (see below for an example). Is there anything I can do to change it?
Example:
The code that generates the above is:
==== Histograms ====
This is the code to compute the histogram:
<source lang="matlab">
nEls = numel(unique_vals);
edges = zeros(nEls+2,1);
</source>
Edit the MediaWiki:Geshi.css.
Example:
div.mw-geshi div,pre {
font-family: monospace, "Courier New" !important;
font-size:13px;
}
edit your SyntaxHighlight_GeSHi.class.php
add font-size to following line
$css[] = ".source-$lang {line-height: normal; font-size: 12px;}";
Turns out this is a bug in the MediaWiki extension. It is referenced in the bug tracker at https://bugzilla.wikimedia.org/show_bug.cgi?id=26204
We can get a permanent fix in it, will poke some other peoples to get it properly fixed.
MediaWiki v1.19.23/24 with geshi 1.0.8.11/12:
Edit the Mediawiki:Geshi.css file to be:
/* CSS placed here will be applied to GeSHi syntax highlighting */
div.mw-geshi div,pre {
font-family: monospace, "Courier New" !important;
font-size:13px;
border: 1px dashed blue;
}
span.mw-geshi {
font-family: monospace, "Courier New" !important;
font-size:13px;
This will work for both the inline (<source lang="XXX" console="none">CODE</source>) and for the normal divs (<source lang="XXX">CODE</source>). The source is now preferred to be replaced with syntaxhighlight.

Resources