title: Rotate Text by 90 degrees with GDI
body: <p>I want to draw text to a GDI Surface and rotate this text by 90 degrees counter clockwise. I would prefer to use DrawText to draw the text because it supports carriage return. I tried to use a font with lfEscapement (see the code below) but the line is not rotated - one line gets rendered over the other. Is there any possibility to rotate the text? Or to render without rotation and rotate the whole device context?</p>
  
  <hr>
  
  <p>Normal text layout:</p>
  
  <p><img src="https://i.stack.imgur.com/w5LnF.png" alt="alt text"></p>
  
  <hr>
  
  <p>Rotated (desired result):</p>
  
  <p><img src="https://i.stack.imgur.com/n1Nh8.png" alt="alt text"></p>
  
  <pre><code>    case WM_PAINT:
      {
          hdc = BeginPaint(hWnd, &amp;ps);
  
          LOGFONT lf = {0};
          HANDLE hFont;
          ZeroMemory(&amp;lf, sizeof(LOGFONT));
  
          lf.lfWeight = FW_NORMAL;
          lstrcpy(lf.lfFaceName, _T("Tahoma"));
          lf.lfEscapement = 90;
          lf.lfHeight = 30;
          hFont = CreateFontIndirect (&amp;lf);
          hFont = (HFONT)SelectObject (ps.hdc, hFont);
  
          RECT RectBody = {10,lf.lfHeight+10,::GetSystemMetrics(SM_CXSCREEN)-10,::GetSystemMetrics(SM_CYSCREEN)-lf.lfHeight-20};
          {
              ScopedLock lock(me-&gt;m_mutex);
              DrawText (ps.hdc, me-&gt;GetMessageString().c_str(), (int)me-&gt;GetMessageString().length(), &amp;RectBody, 0);
          }
  
          hFont = (HFONT)SelectObject (ps.hdc, hFont);
          DeleteObject (hFont);
  
          EndPaint(hWnd, &amp;ps);
          break;
      }
  </code></pre>