desgraci
desgraci

Reputation: 1188

Setting a custom font on a Label Blackberry 10

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?

Upvotes: 1

Views: 678

Answers (1)

Jean
Jean

Reputation: 329

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

Upvotes: 1

Related Questions