From blackberry 10.2 I can use FontFaceRule like below to use custom fonts. But I need it to support from 10.0. Is there any way to do this? If not, is it atleast possible that I can check the sdk version in qml so that if the sdk version is > 10.2 it should import bb.cascades 1.2 and include fontface rule. My project is currently set to base sdk 10.0 so importing anything greater than 1.0 throws error.
TextStyleDefinition {
id: myLabel
base: SystemDefaults.TextStyles.BodyText
fontWeight: FontWeight.Bold
textAlign: TextAlign.Center
fontSize: FontSize.PointValue
color: Color.create("#FFFFFF")
fontSizeValue: 12
rules: [
FontFaceRule {
id: styleFontRule
source: "asset:///fonts/Montserrat-Bold.ttf"
fontFamily: "Montserrat-Bold"
}
]
}
EDIT
attachedObjects: [
FontLoader {
id: fixedFont; source: "asset:///fonts/Montserrat-Bold.ttf"
},
TextStyleDefinition {
id: myLabel
base: SystemDefaults.TextStyles.BodyText
fontWeight: FontWeight.Bold
textAlign: TextAlign.Center
fontSize: FontSize.PointValue
color: Color.create("#FFFFFF")
fontSizeValue: 12
fontFamily: fixedFont.source
}
}]