NativeScript not showing custom fonts - nativescript-angular

Custom fonts are not showing up on my app.
I did some googling, pretty sure I named everything correctly, font files are in the correct folder. Not too sure what's going on.
This is how I'm using it in app.css:
.pontanosans-regular {
font-family: "PontanoSans", "PontanoSans-Regular";
font-weight: 400;
}
I am then using this class in the other folder/files like so:
class="pontanosans-regular"
This is what the folders look like:

As per {NS}
Note: In iOS your font file should be named exactly as the font name.
If you have any doubt about the original font name, use the Font Book
app to get the original font name.
and Pontano Sans name in mac is having a space between 2 words. So your family name should be like this.
font-family: "Pontano Sans", "PontanoSans-Regular";

I ended up running into this issue and the problem I found was that my .ttf file was buggy. I tried downloading a common webfont and it worked just fine, so some fonts are just buggy.
To fix my issue, I found the original font on a different site.

Related

Monogame "Could not find font file" when running

I'm trying to learn the basics of Monogame, and I've successfully figured out how to use the Monogame Content Pipeline to load and display images on the screen. When I try to do the same with fonts, by loading a font called galleryFont.spritefont into the Monogame Content Pipeline everything is fine.
Please note: even before I import the font into my code, I get an error.
However, the problem occurs when I run the project. I get an error that looks like this:
It states:
error : Processor 'FontDescriptionProcessor' had unexpected failure!
System.IO.FileNotFoundException: Could not find "Arial" font file
I also get an error in my build tasks, stating this:
As you can see as well, the file is loaded, but what I noticed what was strange was that the monogame content pipeline did not save the file as an .xnb file in the Content/bin folder.
Or since the error said, "Could not find Arial font file," does this mean I need to somehow download the Arial font.ttf and link it somehow in my .spritefont file? Here is the .spritefont file if anyone is interested.
<?xml version="1.0" encoding="utf-8"?>
<!--
This file contains an xml description of a font, and will be read by the XNA
Framework Content Pipeline. Follow the comments to customize the appearance
of the font in your game, and to change the characters which are available to draw
with.
-->
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
<Asset Type="Graphics:FontDescription">
<!--
Modify this string to change the font that will be imported.
-->
<FontName>Arial</FontName>
<Size>24</Size>
<Spacing>0</Spacing>
<UseKerning>true</UseKerning>
<Style>Regular</Style>
<!--
If you uncomment this line, the default character will be substituted if you draw
or measure text that contains characters which were not included in the font.
-->
<!-- <DefaultCharacter>*</DefaultCharacter> -->
<CharacterRegions>
<CharacterRegion>
<Start> </Start>
<End>~</End>
</CharacterRegion>
</CharacterRegions>
</Asset>
</XnaContent>
Thanks for any help.
After doing a ton of research, I found out that the font is not naturally loaded onto my computer. The tutorial I was using somehow had the Arial font already loaded, so they could just use <FontName>Arial</FontName> to load the font. However, I had to download a font, put it into my Content directory, then edit the .spritefont file to <FontName>font.ttf</FontName>. Finally, after doing this, the project would run.
It looks like you're trying to load the "Arial" font when you named your font "galleryFont". Try changing it to that in the code and see what happens. For example, here's how I load a font in one of my games:
protected override void LoadContent()
{
SpriteFont _font;
_font = Content.Load<SpriteFont>("SuperArial");
}
"SuperArial" is what I named an Arial font I packed into my mgcb file.
The Arial is specific to Windows.
A version of these fonts are available to Linux users through the following:
Ubuntu(same package as deb for debian)
sudo apt install ttf-mscorefonts-installer`
Arch:
sudo yay -S ttf-ms-fonts ttf-vista-fonts ttf-office-2007-fonts ttf-win7-fonts ttf-ms-win8 ttf-ms-win10 ttf-ms-win11`
Redhat:
sudo rpm -i https://downloads.sourceforge.net/project/mscorefonts2/rpms/msttcore-fonts-installer-2.6-1.noarch.rpm
All of these methods register the fonts, and can be used directly as specified.

Display approval sign/check mark (✓) on Kivy Label

I am working on a Kivy(Python) Project and I need to display approval(✓) and cross(X) symbol in different scenario. I can display cross symbol but unable to display other one. Is there any way to do this ? Thanks.
Note: I have tried, writing text:'✓' and text:u'2713' under Label in .kv file but it doesn't work.
The font supplied with Kivy doesn't include the tick mark. You need to use fonts that include those symbols. Tick is available in fonts Arial Unicode MS, Wingdings and Wingdings 2. You can download the font ttf file and have it in the same folder with your script.
Link to download the font
https://www.download-free-fonts.com/details/88978/arial-unicode-ms
Then include the font and use it in the label as follow:
Label:
font_name:'arial-unicode-ms.ttf'
text: "This is the tick ✓"
Bro I was also troubling from same problem from morning but now I figured it out actually so I would like to share it with you.I used below code:
def wrong_btn(self):
self.ids.wrong_button.text = u"⌫" self.ids.wrong_button.font_name=r"C:\Users\95532\AppData\Local\Microsoft\Windows\Fonts\Arial-Unicode-MS.ttf"
I used this to specify the folder in which the font is stored so you can also download the font you want and just specify the path and don't forget use a r i.e raw string mark or else it wont work I wasted my whole day searching for that hope this helps you bro

Web page layout different on Windows and Linux due to Fonts

We have a web application. The application runs on both Windows and Linux.
On windows, the application works fine (Layout is proper etc.)
On linux, the complete layout is haywire. I figured there is a font's problem on Linux.
On my JSF page, I have specified Calibri font. I am using JBoss server.
How can I ensure the layout on windows and linux is identical. I need to eliminate the Fonts problem.
I tried installing the Calibri fonts on the server, but this becomes a pre requisite before any installation which surely I would like to avoid.. Infact even after installing I could not notice changes in the layout (this indicates app failed to read the font).
Kindly guide.
Is it possible to bundle fonts in JBoss and ship it along with the application. If yes, how can I instruct my application to use fonts present inside JBoss.
You can use the #font-face CSS, as described here:
Define a new font, named myFirstFont:
#font-face {
font-family: myFirstFont;
src: url(sansation_light.woff);
}
And use it to style an element:
.myFirstFontStyledThing {
font-family: myFirstFont;
}
This means that the font file must be available from the web. So you either host it in your server (besides your images perhaps - BUT BEWARE THE LICENSING OF THE FONT) or use Google fonts: http://www.google.com/fonts/
if you are defining fonts you are using most probably a css line like that:
font-family: Arial, Calibri, sans-serif;
css is 'cascading' so in this case if neither arial nor calibri are found sans-serif evaluates to a default sans-serif font on your machine - on Windows - Arial on Mac - Helvetica, on Linux it might be something else.
A good tip would be to use Google's Fonts this way you make sure everyone gets the same font and you don't need to install anything on your JBoss and save you some traffic couse it uses CDN!

Custom font file type

I want to install a custom font on a website, does anyone know if .ttf format is enough?
Thanks!
If you want to use a custom font on your website, I recommend using one of Google web fonts. You will find more info here.
If the font you want to use is not on the list. I recommend using font-squirrel and create a font-face kit with their generator.
To work on a larger range of browsers, you should use .ttf, .eot, .svg and .woff.
Hope it helps.
TTF will work for most modern browsers. Of course, you may offer several alternative font formats to the user agent - it surely won't hurt )
Here is the compatibility table for TrueType fonts:
http://caniuse.com/ttf
In your CSS, declare the font as follows:
#font-face
{
font-family: my_font;
src: url('my_font.ttf');
}
And then use the font-family property it as usual:
.my_selector
{
font-family: my_font;
}

How do browser get the required font file?

I was searching through the net and couldn't find the exact answer.
How do browsers get the exact .ttf file for a font family specified in the css? Does it already have it in its code or does it pick from the user's system. I guess we can always specify the custom font files using the #font-face but what about the normal general fonts like arial etc?
The process is obviously different between browsers and operating systems, but in short, browsers pick the font from the system, and if it’s not installed, the font will be replaced with another similar font.

Resources