ZoltnHegeds-7054 avatar image
0 Votes"
ZoltnHegeds-7054 asked ZoltnHegeds-7054 commented

C++ MFC TextOut/DrawText: some characters are wider in other programs in Consolas 9

My English is not perfect. I am using a high dpi monitor, so at the settings of Windows, there is 3 multipled by 96 dpi = 288 dpi. (0,16 mm multipled by 3 = 0,48 mm, I have some short sight = myopia). (This website eats asterix characters).

I am using the font Consolas 9, so, really Consolas 27.
At my own program (Visual C++ with MFC, with TextOutW and DrawText), some characters, for example ∃ ∄ ∀, about as wide as other characters. In other programs, for example Visual Studio, LibreOffice Writer, these are wider than others: for example the numbers. How can I write the wider version to the display? And how can I get the width without displaying them? Thank you.

· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Consolas is monospaced : consolas
Then all characters have same width

0 Votes 0 ·

In Visual Studio, and in LibreOffice Writer, Consolas does not monoshaped. Try the 3 example characters:

0 Votes 0 ·


It is drawing monospaced. It's just that the width of each character isn't an integral number of pixels

I suggest you could try to use Graphics::GetTextRenderingHint method instead of DrawText.

0 Votes 0 ·

No, some characters are not monospaced, for example ∃∄∀.

0 Votes 0 ·

0 Answers