I'm using wxPdfDocument and tries to create rotated texts. My problem is that I can't understand how the text is rotated. So my question is which Point should i send to this method? The following code creates two texts:
this->_dc->DrawRotatedText(str, p, angle);
this->_dc->DrawText(str, p);
Depending on the angle the text behaves a bit strange.
Regards,
Sven
wxPdfDocument
Re: wxPdfDocument
As far as I understand the wxDC method DrawRotatedText the point passed to this method will be the center of the rotation (and corresponds to the left corner of the text string) and the angle is measured in degrees counterclockwise, where a value of 0 corresponds to unrotated text.PythagorasSvenne wrote:I'm using wxPdfDocument and tries to create rotated texts. My problem is that I can't understand how the text is rotated. So my question is which Point should i send to this method? The following code creates two texts:
this->_dc->DrawRotatedText(str, p, angle);
this->_dc->DrawText(str, p);
Depending on the angle the text behaves a bit strange.
Please explain "behaves a bit strange". What's wrong?
Regards,
Ulrich
-
- In need of some credit
- Posts: 3
- Joined: Fri Nov 15, 2013 1:46 pm
Re: wxPdfDocument
Try this and look at the result. The rotation center is not top left corner of the text:utelle wrote:As far as I understand the wxDC method DrawRotatedText the point passed to this method will be the center of the rotation (and corresponds to the left corner of the text string) and the angle is measured in degrees counterclockwise, where a value of 0 corresponds to unrotated text.PythagorasSvenne wrote:I'm using wxPdfDocument and tries to create rotated texts. My problem is that I can't understand how the text is rotated. So my question is which Point should i send to this method? The following code creates two texts:
this->_dc->DrawRotatedText(str, p, angle);
this->_dc->DrawText(str, p);
Depending on the angle the text behaves a bit strange.
Please explain "behaves a bit strange". What's wrong?
Regards,
Ulrich
_dc->DrawText(txt, p);
for ( double xa = 45.0; xa < 359; xa+= 45.0)
{
_dc->DrawRotatedText(txt, p, xa);
}
The rotation center is rotated in an unlogic way.
Regards,
Sven
Re: wxPdfDocument
This might be related to the map mode style. For wxPDF_MAPMODESTYLE_PDF the rotation center is the left edge of the base line. Try a different map mode style with wxPdfDC method SetMapModeStyle. Maybe this solves the issue.PythagorasSvenne wrote: Try this and look at the result. The rotation center is not top left corner of the text:
_dc->DrawText(txt, p);
for ( double xa = 45.0; xa < 359; xa+= 45.0)
{
_dc->DrawRotatedText(txt, p, xa);
}
The rotation center is rotated in an unlogic way.
Regards,
Ulrich
-
- In need of some credit
- Posts: 3
- Joined: Fri Nov 15, 2013 1:46 pm
Re: wxPdfDocument
Thanks for this! When using drawRotatedText the map mode must be set to wxPDF_MAPMODESTYLE_PDF and lower left corner must be used.utelle wrote:This might be related to the map mode style. For wxPDF_MAPMODESTYLE_PDF the rotation center is the left edge of the base line. Try a different map mode style with wxPdfDC method SetMapModeStyle. Maybe this solves the issue.PythagorasSvenne wrote: Try this and look at the result. The rotation center is not top left corner of the text:
_dc->DrawText(txt, p);
for ( double xa = 45.0; xa < 359; xa+= 45.0)
{
_dc->DrawRotatedText(txt, p, xa);
}
The rotation center is rotated in an unlogic way.
Regards,
Ulrich
Thanks for your help!
Sven