2

GDI+'s DrawString can't seem to render Unicode superscripts and/or subscripts. It shows them as squares and doesn't stack.

Drawn using DrawString

drawn by GDI

private void Form1_Paint(object sender, PaintEventArgs e)
{
    String text = "ă̡͈̘̠͕̺̯̖̤̺͇̫̗͓̗̤̩̜̩̯̝ͥͪ̍ͯͥ͒ͫ͛ͮ̿ͥ͛́́̈͒ͯ͊̇̿ͪ̓́̋ͨ̌͗̀̾̃ͧ̋͗ͣͦ̑̈̆̚҉̶̸̶̶̷̷̶̸̨̧̧̨̛̛̕͘͘̕͘͜͟͜͜͡͞͠͠͠͏̴̷̴̡̢̀͟͝͠s̸̢̨̥͚̲̝̝̗̤͇͓̫̝͍̥͓̳͕̰̰̙͖̅̾ͨ͗̈́͌̽̋̇ͦ̃͌͌͌̎̃̒̂̆̌ͤ͗̌͂̿̃̋̈́ͦ͂͋͂̽ͪͣ͂ͩ̓̈͆̀͢͜͟͡͠͠͝҉̶̶̧̨̡̧̧̛́́́́̀͘͘̕͢͜͢͢͠͞͠҉́̕͢͝d̵̴̡̡̢̛͙̞̭̲̺̖̯̳̙̞͇͓̖͙̩̩̗̝̮̉̿ͦ͒̓̑̉ͫ̇͒̓̎ͨ̎ͪ̂ͨͨ̿͛͊͛͛͂͐ͭ̄͑̔̄̋̆ͪ̀ͫ͌̉̍́̚̚͘͘͘͟͢͢͞͠͠ͅ҉̴̷̶̶̸̧̢̧̡̢̧̨̛̕͘͘͘͘͘͢͟͡҉f̸̶̵̤̮͚͔̟̮̗̺͖͉̪͔̫͎͓̱̟̰̹̩̈̊ͮͦͯ̅̊ͨ́͊̔ͪ̐ͤ͌̑͋̈́̐͆ͦ̿͌̐̓͐̌͂̅ͩ̄͊͐ͨ̄̄̈́̆̚̚͜͏͏̵̸̧̧̛̛͞͡͡͏̡͘͟͠͏̸̶͏͟͡͞͏̸̡͝͏͠͞͏̴͡͏̢͝";
    e.Graphics.DrawString(text, new Font("Arial Unicode MS", 12), Brushes.Black, 30, 30);
}

Drawn using TextRenderer

Drawn by TextRendere.DrawText

TextRenderer.DrawText(e.Graphics, text, new Font("Arial Unicode MS", 12), new Point(30, 30), Color.Black);

Drawn by firefox

enter image description here

How did FireFox manage to draw this properly?

The data I'm using - http://pastebin.com/p5Cp3qUM

1
  • Did you try other fonts? Commented May 21, 2013 at 22:03

1 Answer 1

3

Try calling TextRenderer.DrawText instead.

Sign up to request clarification or add additional context in comments.

2 Comments

Times New Roman and Tahoma both show as squares for anything that isnt ascii. I'm on Windows XP.
It was a font problem. Using "Segoe UI" with font render works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.