PDA

View Full Version : Font Pixel Size issue



beemaneni
6th April 2016, 16:42
Hi
In the image attached i have two texts in rows. Here i need to place the first row of the text at 45 pixels from top.But it is placing at 54 pixels from top.Font size is 28 px.Where am i doing wrong with this? Please suggest ur answers.


Regards
Bala B

anda_skoa
6th April 2016, 17:37
You forgot to post the QML code for this item.

Cheers,
_

beemaneni
6th April 2016, 17:44
Hi,
Here it is.


Text {
id: _unitName
anchors {
left:parent.left;leftMargin: 30;top: parent.top;topMargin: _screenName.text===""? 45 : 24
}
font.pixelSize: 28
font.family: appStyle.font.familyRegular
}

Text {
id: _unitTime
anchors{ left:parent.left;leftMargin: 30; top: _unitName.bottom }
text: time+"<font color=\"#4F555A\"> | </font>" +date
font.pixelSize: 26
font.family: appStyle.font.familyRegular
}

anda_skoa
6th April 2016, 19:53
Hmm, that looks all ok.

Have you tried if a Rectangle gets positioned correctly if you anchor it that way?

Cheers,
_

beemaneni
7th April 2016, 02:30
Hi,
Rectangle is positioned correctly.I am fine with those. I have problem only with fonts here.Let me brief my understanding here.The text element we took was assigned 28 px as font size.Here we have positioned text element 45px from the top.And now when i measure the font in Photoshop , font occupies only 19 px and remaining space is left on top of the font.it looked like font baseline is aligned to bottom.Something lineheight comes in to the picture i guess. Not sure how these fonts are positioned and aligned.

Regards
Bala B