Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
BBornot2B
Posts: 19
Registered: ‎11-11-2012
My Device: Z10, DevAlphaC, Torch 9810, PlayBook

Re: Custom Fonts

But is Arial supposed to be custom? Isn't it preloaded on BB10?
Super Contributor
JeffLemon
Posts: 440
Registered: ‎01-13-2011
My Device: Playbook

Re: Custom Fonts

It's a standard font so I assume its available on any BB10 device. Im more looking to load in things from dafont.com

--------------------------------------------------------------------------------------------------
BlackBerry Apps: Instruments | ARTPAD | Piano | Drums | Xylophone
Contributor
Legoless
Posts: 15
Registered: ‎11-16-2012
My Device: None

Re: Custom Fonts

In Cascades it is currently not possible. I am not sure about other platforms, I hope it could be done with Qt, but I did not see an example yet.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: Custom Fonts

In Qt you can load any .otf or .ttf font file and use it.

Super Contributor
JeffLemon
Posts: 440
Registered: ‎01-13-2011
My Device: Playbook

Re: Custom Fonts

Thanks, got an example code or can you point me to the correct place in the docs?

--------------------------------------------------------------------------------------------------
BlackBerry Apps: Instruments | ARTPAD | Piano | Drums | Xylophone
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: Custom Fonts

I've submitted an example to different fonts in Qt to github but it is not approved yet, for now you can see it here https://github.com/BGmot/Cascades-Community-Samples/tree/master/QtFonts (works on both DevAlpha and PlayBook)

I am pretty sure if you drop your custom font files into /usr/fonts/font_repository/ or whatever your fonts folder on your device is Qt will pick it up as available font (sorry did not actually test).

Contributor
Legoless
Posts: 15
Registered: ‎11-16-2012
My Device: None

Re: Custom Fonts

[ Edited ]

Thank you for your help BGmot. But how exactly would this embed the font into my application? As far as I see, this only loads fonts installed on the device. I would like the font to be embedded in the application, transparent to user. Besides, you created Native C++ application and I would need to use this with cascades. Could you create example for that please? Including the usage of this font with QML if possible. What I mean is changing the font family of a QML generated label in C++ for example..

 

Thank you very much!

Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: Custom Fonts

Embedded? Simple - Font is a file, package you custom font (file) with your app and deploy to the device. Then within your Qt app change default font location to your app's folder and use your font(s),
Cascades? Sorry... I tried to touch Cascades but found too many inconsistensies with documentation and decided to try it again later when it'll become more mature.
Contributor
Legoless
Posts: 15
Registered: ‎11-16-2012
My Device: None

Re: Custom Fonts

This is what I am noticing, the more I work with them. Quite disappointing, the ideas are good, but even the examples in the documentation are not working sometimes..
Super Contributor
JeffLemon
Posts: 440
Registered: ‎01-13-2011
My Device: Playbook

Re: Custom Fonts

@BGmot I've downloaded your example from kit but am having trouble getting it to work:

 

I'm having problems with step 10, I add the following in to -l but still no luck, any ideas?

 

cpp, QtCore, QtGui
--------------------------------------------------------------------------------------------------
BlackBerry Apps: Instruments | ARTPAD | Piano | Drums | Xylophone