Liton
Liton

Reputation: 1428

Vertical Text with DirectWrite (+270° rotated)

I need to show vertical text in my direct2d application. Following text formatting code rotates the text +90°.

m_textFormat->SetReadingDirection(DWRITE_READING_DIRECTION_BOTTOM_TO_TOP));
m_textFormat->SetFlowDirection(DWRITE_FLOW_DIRECTION_RIGHT_TO_LEFT));

enter image description here

But I want to rotate the text +270° like the following:

enter image description here

There are many other options in SetReadingDirection and SetFlowDirection. But none of them is working. The following sample also rotates only +90°: DirectWrite vertical text sample

If I manually rotate the text, it looks blur:

renderTarget->SetTransform(Matrix3x2F::Rotation(m_rotation, Point2F(left + height / 2.0f, top + (bottom - top) / 2.0f)));

Can anyone please help me with this?

Regards,

Upvotes: 2

Views: 644

Answers (1)

bunglehead
bunglehead

Reputation: 1179

I don't think rotation angle is to user in this context, and it shouldn't be. It's a part of layout process that you don't need to interfere with, it's about displaying horizontal scripts along with vertical ones, see [1].

Regarding visual artifacts of transforms, that sounds normal, look at CreateGlyphRunAnalysis() method that takes transform into account, maybe that will give you better results.

[1] https://www.unicode.org/reports/tr50/

Upvotes: 1

Related Questions