Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I display the string by using the DrawString() method in ICanvas interface. I implemented the DrawString() method like below

void ICanvas.DrawString(
            string str,
            float x,
            float y,
            float width,
            float height,
            HorizontalAlignment horizontalAlignment,
            VerticalAlignment verticalAlignment)
        {
            var ctf = _state._font._ctf;
            ctf.HorizontalAlignment = TMP_ConvAlignH(horizontalAlignment);
            ctf.VerticalAlignment   = TMP_ConvAlignV(verticalAlignment);
            using (var layout = new CanvasTextLayout(_control, str, ctf, width, height))
            {
                layout.SetUnderline(0,str.Length,_state._font.FontUnderline);
                layout.Options = CanvasDrawTextOptions.Clip;
                _session.DrawTextLayout(layout, x, y, _state._fontColor);
            }
        }


I need to rotate the string by particular angle. Please give me a solution?

What I have tried:

I tried to rotate by using
Matrix3x2.CreateRotation((float)-angcur - 1.570796f) * // rotate -ang-Pi/2
                    Matrix3x2.CreateTranslation(
                    (float)this.RotationCenterX + (heights[i] + tradius) * (float)Math.Cos(angcur),
                    (float)this.RotationCenterY - (heights[i] + tradius) * (float)Math.Sin(angcur));
                path.AddText(text.Substring(i, 1), font, 23, 23, m32);
before DrawString() method is invoked.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900