在Label Blackberry 10上设置自定义字体

时间:2013-09-04 21:29:10

标签: blackberry label blackberry-10 custom-font

现在我已经尝试了文档,教程,但看起来没有实现,即使我一直在尝试使用QFontDataBase将其添加到应用程序,但它只是崩溃尝试实例化它。

我对Webview感到满意,但这不是我在我的应用上所需要的。

我做的最后一件事是尝试在Label中写入html内容,但却没有运气:

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>");

除了font-family之外,整个过程都有效。

字体文件位于项目的assets / fonts文件夹中。

QML代码与Blackberry 10 Cascade文档的TextStyle相同。 (http://developer.blackberry.com/native/documentation/cascades/ui/text/styles.html

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

Cascades中的自定义字体仅支持SDK 10.2。

在2013年第四季度或2014年第一季度部署该版本时,您不应过分依赖该功能。

不要忘记表示层(即Cascades)是专有的,你通常不能混合Qt和Cascades类。 (编辑:这就是QFontDataBase出现问题的原因,我认为

BlackBerry DevBlog

查看该帖子
相关问题