I followed the Nativescript guide to using custom fonts and it's been working well. As it notes, I use the Mac default Font Book and use that exact name in the css, regardless of what the actual filename is. However, I am using some fonts now that are coming up with the same name in Font Book. I have files Avenir-Next-LT-Medium.ttf, Avenir-Next-LT-Demi.ttf and Avenir-Next-LT-Regular.ttf, all of which just show up as Avenir Next Pro in Font Book so I don't know how to use each individually.
Related
I have followed the guidelines in the official documentation to add a custom font to my native script application. https://docs.nativescript.org/ui/styling#custom-fonts
The font name is Ubuntu as shown in the image below.
I added the font Ubuntu.ttf under the folder /fonts of my project, and add the following to my app.css file :
.Ubuntu
{
font-family: Ubuntu;
}
However, once strating the application I cannot see the font applied to my label.
<Label class="Ubuntu" text="This is a test message" ></Label>
Any help will be much more appreciated.
Ah, the wonderful fonts issue on iOS. Fortunately this is something that is easy to fix.
I actually have an entire blog article on how to fonts in NativeScript.
But to simple answer your specific question the font is not actually named "Ubuntu"; that is the file name. If you look at the top-middle of your font picture you will see the name is actually "Ubuntu Gras".
So your CSS should actually look like this.
.Ubuntu
{
font-family:Ubuntu,Ubuntu Gras;
}
What this does is cause iOS and Android to auto-load the "Ubuntu.ttf" file when they can't find a font already loaded called "Ubuntu" in the system loaded fonts. (Note: The physical file name should always be the first definition.)
So after it loads it, it then tries to use "Ubuntu" as the font lookup; but this can fail on iOS on some fonts (but always works on Android). So then because it can't find the "Ubuntu" name, it uses the next available font name which we so conveniently provided for it -- "Ubuntu Gras". Since the font was already loaded (i.e. from the "Ubuntu" name) then the iOS operating system can now find the "Ubuntu Gras" name, and so it uses it properly.
I want to change the font in Squib.
How do I do this.
There is a font folder and also I can see where I set the font in the layout, do I need to set it anywhere else.
I'm wanting to use FiraSans-Regular.otf and FiraSans-Heavy.otf
At this point in time, Squib doesn't support loading fonts locally. You'll have to install the font on your system, and then do something like text font: 'FiraSans'. I generally keep my font files in my git repo just for portability.
Loading local fonts has been discussed by the Pango team (what Squib uses for text), and they are making the process less painful as I understand it. http://mces.blogspot.com/2015/05/how-to-use-custom-application-fonts.html. It will be a while until that translates to Ruby, as well, since cross-platform compatibility is hard when it comes to fonts.
I've created a GitHub issue to track on this if you want to follow it:
https://github.com/andymeneely/squib/issues/105
I am creating a English to Mangolean Dictionary app; So i need to display mangolean word corresponding to my english word; i read from a blog that wp7 only supports limited language set. So how can i over come my issue. Please help me to solve this issue.
There's a tutorial on embedding fonts in Silverlight here: http://paulyanez.com/interactive/index.php/2009/12/embedding-fonts-in-silverlight/ The implementation for Windows Phone is exactly the same. The tutorial uses Expression Blend (which is part of the developer tools download and also free for Windows Phone), which is the simplest, quickest, and easiest way to embed fonts for Silverlight.
Apart from the supported Fonts you can add your on fonts to you project. For example create a folder named Fonts in you project and add you *.TTF files(Font Files). By referring this font files you can resolve your issues.
I've been having a world of trouble getting Khmer fonts (an Indic script of Cambodia) to render reliably on the web across platforms (Mac, Windows, Linux).
Google web fonts recently added Khmer, which seems like the best bet. However, I have not been successful getting Khmer fonts to work on any Mac or Linux system. I can get them to work on Windows by installing the Khmer Unicode installer from http://khmeros.info but not by just including Google's font in an HTML file.
For example, see this screenshot of the Google web fonts page on a fresh Windows installation. You can see that the default Windows Khmer font (uuuuugly!) is being used instead of Danh's pretty fonts.
I have another test file here: http://dl.dropbox.com/u/634/khmer_test.html. For the first test, you should see something like this for both the web font and the default system font (assuming you have Hanuman installed). I have yet to find a system where both examples work reliably.
Any help would be greatly appreciated. My primary goal is to get this working on a website; a secondary goal is to get Khmer (and other Indic fonts) working in a PDF generator like iText (although I am aware iText itself does not support Indic fonts -- I'm hoping something similar does).
Every Cambodian Windows users are always delete the font name called: KhmerMool and Khmer Kampot. Then they change the default Khmer font in regedit too. You can check at http://thelifeandwork.blogspot.com/2010/01/changing-default-khmer-font-in-windows.html . I'm not sure about Khmer font and other Indic font in PDF. I always have problem when i copy Khmer unicode from PDF to put in OpenOffice or Office Word or LibreOffice.
Khmer Unicode displays on the web, it will always solve now by Google Webfont, please refer to that.
And if you want to have Khmer display in PDF by converting using iText, you can see following post:
Khmer Unicode in iText
http://ask.osify.com/qa/287
They are currently not yet support the display yet.
But, just today I can get it works by modifying the source code of iText (5.5.4-SNAPSHOT) as I just stated in my post: http://ask.osify.com/qa/613, not yet be able to publish since it's just start in testing around.
Updated 13/01/2016
I have added the source code sample for the rendering: http://ask.osify.com/qa/613
The rendering customization with iText for Khmer Unicode added in github: https://github.com/Seuksa/iTextKhmer
I'm trying out FTGLES to dynamically display text in arbitrary fonts on OpenGL-ES on iOS (cf. my SO question here). That library seems to require direct access to the TTF file to use the font. Using kosher methods, can one directly access -- by path -- the system font files on iOS? I've RTFM'd and couldn't find anything.
Barring that, does anyone know if it is Apple-approved to copy the system fonts into your app (before submission).
My solution was inspired by skia.
Though cannot access system built-in font files directly, we still have an indirect way:
Create a CGFont with your wanted font name, all contents of SFNT table of this CGFont can be accessed by simply calling CGFontCopyTableTags() and CGFontCopyTableForTag().
A ttf/otf font data can then be constructed by using these tables, save the new created font to disk, you can use it in FTGL ES later.
No, you can't access the system installed TTF files on iOS devices. So you'll have to embed the typefaces you'd like to use.
Disclaimer: I'm not a lawyer, and the acceptability of using Apple supplied system fonts in an iOS app is a legal question about interpreting software licenses, so you may want to seek professional advice.
You wish to embed an Apple supplied font in your app. The definition of "embed" is a bit nebulous, so adding the font to an iOS app may or may not fit within the copyright holder's definition of "embed". Some type houses define "embed" to mean just viewing predetermined content in the included font; other mean viewing and editing content in that font. Displaying content that changes during the running of your app is somewhere between these two cases.
According to the Mac OS X Lion 10.7.2 ELUA:
F. Fonts. Subject to the terms and conditions of this License, you may
use the fonts included with the Apple Software to display and print
content while running the Apple Software; however, you may only embed
fonts in content if that is permitted by the embedding restrictions
accompanying the font in question. These embedding restrictions can be
found in the Font Book/Preview/Show Font Info panel.
If using the fonts in an iOS app is indeed "embedding", you just need to check the particular fonts you wish to use in Font Book.
In this situation I would find a font or set of fonts where I had explicit permission to include the fonts in the iOS app. I would start by shopping around the various type houses for a licensing scheme that explicitly allowed this use. This may get expensive, so another tack would be to seek out open source typefaces with a license that would allow this use. Or, for a very limited set of characters (e.g. only numbers) I would even consider drawing my own typeface.
No. Your app cannot access files outside the sandbox of your app. Period (well, unless it's jailbroken ;). But you can indeed bundle the font file. Now, I see no reason why Apple would reject your app, as it's using a file already available on the device, and you're just including your local file to it. In terms of copyright, Apple already has that permission to use it on their device, so your inclusion of it should be no problem.
I say should because I haven't needed this capability and haven't tested it with a submission of my own, but based on legal instinct and font copyright issues I've seen in the past, I'd expect that it wouldn't be a problem.