Setting a custom font on a Label Blackberry 10 - blackberry

Right now i have tried the documentation, the tutorials, but looks like there's no implementation for this, even i have been trying to use the QFontDataBase to add it to the App, but it just crashes trying to instantiate it.
I had luck with the Webviews, but it is not what i need on my app.
The last thing i have made is trying to write the html content inside the Label, but yet not luck:
Label *label = new Label();
label->setText("<html> <head> <style>#font-face { font-family: 'AmaticSCRegular'; src: url('local:///assets/fonts/amaticsc-regular.eot'); src: url('local:///assets/fonts/amaticsc-regular.eot') format('embedded-opentype'), url('local:///assets/fonts/amaticsc-regular.woff') format('woff'), url('local:///assets/fonts/amaticsc-regular.ttf') format('truetype'), url('local:///assets/fonts/amaticsc-regular.svg#AmaticSCRegular') format('svg'); font-weight: normal; font-style: normal; } body {font-family: 'AmaticSCRegular'; font-size: 3em; color:#777777; text-align: center;}</style></head><body>Center + Crop</body></html>");
The whole thing works, except the font-family.
The fonts files, are in the assets/fonts folder of the project.
The QML code is the same as the TextStyle of the Blackberry 10 Cascade Documentation. (http://developer.blackberry.com/native/documentation/cascades/ui/text/styles.html)
Any idea?

Custom fonts in Cascades are only supported on SDK 10.2.
With deployment of that version in Q4 2013 or Q1 2014, you should not rely too much on that feature.
Don't forget that the presentation layer (ie. Cascades) is proprietary, and you can't usually mix Qt and Cascades classes. (edit: that's why problems with QFontDataBase, I think)
See that post from BlackBerry DevBlog

Related

Custom web font special character not working in WebKit (iOS/Safari) but works on Chrome

I am using a custom web font from a type foundry, called herbier, that is made up of characters.
How can i view this font on all browsers?
Chrome works fine, but Safari and iOS turn the type into numerals.
this is an example of the font working on safari from the original website
I am using amazon aws to host this site.
I have looked up many explanations.
changing the display: swap, text to italic, redownloading the text files, urls i use link to the fonts uploaded to my domain, i tried using text-rendering: optimizeLegibility and downloaded the web kit so i would have all svg, woff, woff versions of this font etc etc.
The specimen file has said ' The most common problem here is that you are serving the fonts from an IIS server. IIS refuses to serve files that have unknown MIME types. If that is the case, you must set the MIME type for SVG to "image/svg+xml" in the server settings.'
Is there any simple way to solve this?
Example code for a different font that works :
#font-face {
font-family: Director-light;
src: url('https://s3.console.aws.amazon.com/s3/object/www.MYWEBSITE.net?region=eu-west-1&prefix=Director-Light.otf'); src: url('https://s3.console.aws.amazon.com/s3/object/www.MYWEBSITE.net?region=eu-west-1&prefix=FT88-School.ttf'); }
#font-face { font-family: Director-light; font-weight: bold; src: url('Director-Light.otf');}
h3 {
font-size: 15px;
color: navy;
font-family: Director-light;
}
The font i am using at the moment :
#font-face {
font-family: 'hershey-noaillnoaillesherbier';
src: url('hershey-noailles-herbier-webfont.woff2') format('woff2'),
url('hershey-noailles-herbier-webfont.woff') format('woff');
etcc etc
}

Emoji font in Ruby on Rails 6 app don't work when loaded locally from assets

In my Ruby on Rails 6 Apple Color Emojis don't work on Firefox(macOS&windows10).
I had imported the font:
#import url(//db.onlinewebfonts.com/c/5ab304ade0d4f62d027d12464ca69443?family=Apple+Color+Emoji);
and they started to work!
Now I want to have them locally in my app.
I found on google that it is a common issue and there is even a nice solution to fix that solution by Nick Galbreath.
// define a new font face that just deals with emoji
#font-face {
font-family: "color-emoji";
src: local("Apple Color Emoji"),
local("Segoe UI Emoji"),
local("Segoe UI Symbol"),
local("Noto Color Emoji"); }
// add it *after* the serif, sans-serif or monospace
// ending default.
body {
font-family: your-font, sans-serif, color-emoji;
}
So I prepared #font-face for first font "Apple Color Emojis" like this:
#font-face {
font-family: 'AppleColorEmoji';
src: asset-url('color-emoji/AppleColorEmoji/AppleColorEmoji.eot');
src: asset-url('color-emoji/AppleColorEmoji/AppleColorEmoji.eot?#iefix') format('embedded-opentype'),
asset-url('color-emoji/AppleColorEmoji/AppleColorEmoji.woff') format('woff'),
asset-url('color-emoji/AppleColorEmoji/AppleColorEmoji.woff2') format('woff2'),
asset-url('color-emoji/AppleColorEmoji/AppleColorEmoji.ttf') format('truetype'),
asset-url('color-emoji/AppleColorEmoji/AppleColorEmoji.svg#Apple Color Emoji') format('svg');
}
Files are in app/assets/fonts/color-emoji/AppleColorEmoji and when I try to use my brand new #font-face like font-family: 'AppleColorEmoji'; guess what happen?
Yes, they don't work.
Any idea what I am doing wrong?
I got such error in a console:
downloadable font: rejected by sanitizer (font-family:
"AppleColorEmoji" style:normal weight:400 stretch:100 src index:0)
source: http://localhost:3000/assets/color-
emoji/AppleColorEmoji/AppleColorEmoji-
3ec445c87ae85d4ae8c4fdc2e7f5dfbe85e755b057c254af9e0f36a7cc6924e2.eot

Font loading slowly in Rails app. Why is this happening?

I have a custom font in my app/assets/fontsfolder but on production, the font is loading slowly leaving buttons blank before the font renders like this:
and then after 3 seconds, this:
What is going on? What can I do?
my css looks like this:
#font-face {
font-family: 'Reckless-Medium';
src: font-url('Reckless-Medium.otf') format('opentype');
font-weight: normal;
font-style: normal;
}
$reckless-medium: 'Reckless-Medium';
and this:
.btn {
display: inline-block;
font-size: 15px;
font-family: $reckless-medium;
Why does rails make a get request to get the font?
Started GET "/assets/Reckless-Medium.otf" for 127.0.0.1 at 2018-10-19 00:53:29 -0400
Is the font located on another server?
Why do rails make a GET request to get the font?
Because you tell it does so. font-url('Reckless-Medium.otf') eventually commands client's browser to download the font from your webserver.
Is the font located on another server?
Not sure. As I see the font you use is custom. I found it on https://befonts.com/reckless-font.html . For fast loading, it could be uploaded on some CDN servers, of Google or CloudFlare for example, and hardlinked to be downloaded from there. But it's too new, so it's doubtful the font is popular enough CDN majors accepted it to their warehouses.
To make fonts (and all static content) to load faster you can move your static files to some CDN service. For example, check https://www.cloudflare.com/ as an option.

SVG fonts not working on iOS

I converted these arabic fonts to work with CSS #font-face, and they do work on desktop but not on iOS. I tried quite a few things as suggested on other threads but no joy.
This is the page: http://bit.ly/WuBnaa <- works great on desktop, not on iOS.
There is no svg font in your #font-face, see here:
#font-face {
font-family: 'AlFatemi52';
src: url('http://i4ideas.net/fatemi52/alfatemi152-webfont.eot');
src: url('http://i4ideas.net/fatemi52/alfatemi152-webfont.eot?#iefix') format('embedded-opentype'),
url('http://i4ideas.net/fatemi52/alfatemi152-webfont.woff') format('woff'),
url('http://i4ideas.net/fatemi52/alfatemi152-webfont.ttf') format('opentype');
font-weight: normal;
font-style: normal;
}
If you do convert the above to an svg font as well, make sure that you get the arabic ranges too (most conversion services online strip everything outside the ascii range).
To sum up: WebKit on iOS doesn't support the SVG format.
You will have to come up with another format, as no one knows (except Apple) when will this be implemented (if it ever is).

#font-face fails to pick up my custom fonts

I'm importing some custom fonts in my rails app using the following lines in CSS:
#font-face
{
font-family: "SquareSlabLite";
src: url("/assets/squareslablite.ttf");
}
#font-face
{
font-family: "SquareSlabBold";
src: url("/assets/squareslabheavy.ttf");
}
#font-face
{
font-family: "SquareSlabMedium";
src: url("/assets/squareslabmed.ttf");
}
When I go to the location(s) localhost:3000/assets/font.ttf, I get the respective fonts showing up for download. However when I try and use the fonts for example:
h2{
font-family: "SquareSlabLite";
}
this line only works when I use SquareSlabBold. When I try use the Lite or Med versions of this text, I get nothing, just a generic font showing up. When I check out firebug, The bold shows up, but not the lite nor medium version. I'm baffled. I've checked spelling, redownloaded files but nothing.
Is it not possible to get this working with squareslab medium and lite? Could there be something wrong with the ttf files, even though I have downloaded them from different sources?
Thanks guys.
TTFs are not supported everywhere. And if you're using IE for viewing this font, it is really hard to prepare TTF for this to work in every IE. Try http://www.fontsquirrel.com/fontface/generator/ to generate proper webfonts from yours TTFs.

Resources