I am really struggling with this and not sure how to solve this issue.
Here is the code.
I am running this on symbian ^3 (belle)
I have 2 custom fonts that i need to use.
In the example below i have created 3 buttons.
1. Display gurbaniwebthick.ttf
2. Display GurHindi.ttf.
3. Quit.
This works on N9
I click on the first button and then click on text filed it displays the first line in Pubjabi.
Click on the second button and then click on the text filed it displays the first line in Hindi.
When i quit the app and then run the app again the fonts are not applied. Its like it can’t get a lock on the file.
Please advise how to solve this issue.
import QtQuick 1.1
import com.nokia.symbian 1.1
Rectangle {
width: 360
height: 640
property string displaystr
property string displaystr1
FontLoader { id: localGurFont; source: "qrc:/gurbaniwebthick.ttf"}
FontLoader { id: localHinFont; source: "qrc:/Gurhindi.ttf"}
Column {
ButtonColumn {
checkedButton: b1
spacing: 5
Button{
id:b1
text:"<> siq nwmu krqw purKu"
font.family: localGurFont.name
//font.family: "Gurmukhi";
onClicked: {
displaystr1 = '<font face= "'+localGurFont.name+'" size="6" color="black">kYsI AwrqI hoie Bv KMfnw qyrI AwrqI ]</font><br><br><font face= "Ariel" size="5" color="red">What A Beautiful Lamp-Lit Worship Service This Is! O Destroyer Of Fear, This Is Your Aartee, You r Worship Service.</font><br><br><font face= "Ariel" size="5" color="blue">Kehsi Aarti Hoee Bhv Khandna Teyri Aarti |</font>';
console.log(displaystr);
}
}
Button{
id:b6
text:"< siq nwmu krqw purKu"
font.family: localHinFont.name
onClicked: {
displaystr1 = '<font face= "'+localHinFont.name+'" size="6" color="black">kYsI AwrqI hoie Bv KMfnw qyrI AwrqI ]</font><br><br><font face= "Ariel" size="5" color="red">What A Beautiful Lamp-Lit Worship Service This Is! O Destroyer Of Fear, This Is Your Aartee, You r Worship Service.</font><br><br><font face= "Ariel" size="5" color="blue">Kehsi Aarti Hoee Bhv Khandna Teyri Aarti |</font>';
console.log(displaystr);
}
}
Button{
id:b7
text:"Quit"
onClicked: {
Qt.quit();
}
}
}
TextArea {
id: t1
width: 360
height: 360
text: displaystr
wrapMode:Text.WordWrap
MouseArea {
anchors.fill: parent
onClicked: {
displaystr = displaystr1;
console.log(displaystr1);
}
}
}
}
}
Same problem with the List View as well // import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 import QtQuick 1.1 import com.nokia.symbian 1.1
Rectangle {
id: initialRect
height: 640
width: 360
property string fontName
// color: "black"
FontLoader { id: localGurFont; source: "qrc:/gurbaniwebthick.ttf"}
FontLoader { id: localHinFont; source: "qrc:/Gurhindi.ttf"}
ListModel {
id: contactModel
ListElement {
baani: 'kYsI AwrqI hoie Bv KMfnw qyrI AwrqI ]'
displayColor: 'black'
displayfont: 'GurbaniWebThick'
}
ListElement {
baani: 'What A Beautiful Lamp-Lit Worship Service This Is! O Destroyer Of Fear, This Is Your Aartee,ou r Worship Service.'
displayColor: 'red'
displayfont: 'Arial'
}
ListElement {
baani: 'Kehsi Aarti Hoee Bhv Khandna Teyri Aarti |'
displayColor: 'blue'
displayfont: 'Arial'
}
ListElement {
baani: 'kYsI AwrqI hoie Bv KMfnw qyrI AwrqI ]'
displayColor: 'black'
displayfont: 'GurbaniWebThick'
}
ListElement {
baani: 'What A Beautiful Lamp-Lit Worship Service This Is! O Destroyer Of Fear, This Is Your Aartee,ou r Worship Service.'
displayColor: 'red'
displayfont: 'Arial'
}
ListElement {
baani: 'Kehsi Aarti Hoee Bhv Khandna Teyri Aarti |'
displayColor: 'blue'
displayfont: 'Arial'
}
}
Component {
id: baaniDelegate
Item {
width: parent.width ; height:parent.height/contactModel.count
Text {
width: parent.width
text: baani
font.family: displayfont
color: displayColor
wrapMode: Text.WordWrap
}
}
}
ListView{
anchors.fill: parent
model: contactModel
delegate: baaniDelegate
// highlight: Rectangle { color: "lightsteelblue"; radius:5}
// focus: true
}
Button{
id:b7
text:"Quit"
onClicked: {
Qt.quit();
localHinFont.deleteLater;
localGurFont.deleteLater;
localGurFont.Null;
localHinFont.Null;
}
}
}