DrawText, Scale and world transformation
Hi
I want to scale a text using GDI DrawTextEx Function, so I do the folowing;
Code:
UINT uFormat = DT_WORDBREAK;
pDC->SetGraphicsMode(GM_ADVANCED);
pDC->SetMapMode(MM_TEXT);
pDC->DrawTextEx(sText,rcDest,uFormat,NULL); //Draw the text at its initial size
XFORM xForm;
xForm.eM11 = 2.0; //scale by 2.0
xForm.eM12 = 0.0;
xForm.eM21 = 0.0;
xForm.eM22 = 2.0; //scale by 2.0
xForm.eDx = 0.0;
xForm.eDy = 0.0;
pDC->ModifyWorldTransform(&xForm,MWT_LEFTMULTIPLY);
pDC->DrawTextEx(sText,rcDest,uFormat,NULL); //Draw the scaled text
the text is well scaled, but has a little difference with the original text, sometimes the scaled text does not fit in the rectangle, and some times when the original text is on 2 lines the scaled one is on one line?
what am I doing wrong?
thank you
Re: DrawText, Scale and world transformation
Quote:
Originally Posted by khaldoun KASSEM
the text is well scaled, but has a little difference with the original text, sometimes the scaled text does not fit in the rectangle, and some times when the original text is on 2 lines the scaled one is on one line?
what am I doing wrong?
Hm... In your code sample, I can't see at all how the text would be scaled. Where does your xForm come in? I don't see that it's being used at all.
Re: DrawText, Scale and world transformation
Sorry I forgot :
Code:
pDC->ModifyWorldTransform(&xForm,MWT_LEFTMULTIPLY);
I modified the post...