1214 CGraphicsContext::TDrawTextParam params; |
1214 CGraphicsContext::TDrawTextParam params; |
1215 params.iCharJustExcess=aSpacing; |
1215 params.iCharJustExcess=aSpacing; |
1216 InitializeGraphicsContext(); |
1216 InitializeGraphicsContext(); |
1217 gc->UseFont(epocFont); |
1217 gc->UseFont(epocFont); |
1218 |
1218 |
|
1219 //Calculate Baseline offset |
|
1220 //Baseline is calculated as (Height + ascent in pixels - descent in pixels) /2 |
|
1221 //iDisplayBounds and iOrigin are kept as it is to make sure drawing is respective to |
|
1222 //display bound |
|
1223 TInt heightInPixels = epocFont->HeightInPixels(); |
1219 TInt descentInPixels = epocFont->DescentInPixels(); |
1224 TInt descentInPixels = epocFont->DescentInPixels(); |
1220 |
1225 TInt acsentInPixels = epocFont->FontMaxAscent(); |
|
1226 TInt baseLineOffset = (iDisplayBounds.point.y) + (heightInPixels + acsentInPixels - descentInPixels ) / (2) - iOrigin.y; |
|
1227 |
1221 TPtrC ptrC(string); |
1228 TPtrC ptrC(string); |
1222 TPoint point( aLocation->x - iOrigin.x + iDisplayBounds.point.x+1, |
1229 TPoint point( aLocation->x - iOrigin.x + iDisplayBounds.point.x, |
1223 aLocation->y + epocFont->HeightInPixels() |
1230 aLocation->y + baseLineOffset); |
1224 - descentInPixels - iOrigin.y + |
|
1225 iDisplayBounds.point.y +1); |
|
1226 |
1231 |
1227 if (aDecoration & NW_GDI_TextDecoration_Underline) { |
1232 if (aDecoration & NW_GDI_TextDecoration_Underline) { |
1228 gc->SetUnderlineStyle(EUnderlineOn); |
1233 gc->SetUnderlineStyle(EUnderlineOn); |
1229 } |
1234 } |
1230 |
1235 |