grimd34th / mintty

Automatically exported from code.google.com/p/mintty
GNU General Public License v3.0
0 stars 0 forks source link

Windows 7 DPI setting distorts pixel fonts #352

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Set a non-standard DPI setting in Windows 7 (eg. 125%)
2. Set a pixel font in mintty.

What is the expected output? What do you see instead?
Crisp, clear, perfectly aligned pixels. Instead the font is distorted due to 
the DPI scaling.

What versions of mintty, Cygwin/MSYS, and Windows are you using?
mintty 1.1.1

Please provide any additional information below.
I realise that this is not so much an issue with mintty, but perhaps there is 
some way to reverse the scaling? I need the scaling system-wide, but it would 
be nice if I could disable it in mintty. Setting "Disable display scaling on 
high DPI settings" under shortcut -> Properties -> Compatibility doesn't seem 
to have any effect. I also tried compensating for the adjustment by setting the 
font size to 9.6, but point sizes aren't allowed (is that a Windows thing?).

Original issue reported on code.google.com by kelseyjudson on 17 Sep 2012 at 3:11

GoogleCodeExporter commented 9 years ago
The CreateFont() function and its relatives take an integer as the font height 
argument, so yep, that is a Windows thing.

You could try setting a negative FontHeight in ~/.minttyrc, which CreateFont 
handles differently, although to be honest I don't really understand how from 
the description on MSDN (at 
http://msdn.microsoft.com/en-us/library/windows/desktop/dd183499.aspx).

That page also has the following formula for setting a particular point size:

  nHeight = -MulDiv(PointSize, GetDeviceCaps(hDC, LOGPIXELSY), 72);

MulDiv multiplies its first two arguments and divides by the third. 125% is 
120dpi, so the magic value for getting a 12 point font on a 125% display might 
be -12 * 120 / 72 = -20.

Original comment by andy.koppe on 1 Oct 2012 at 11:38

GoogleCodeExporter commented 9 years ago
Sorry for the delay, I just haven't had a chance to boot up Windows these last 
few days.

Thanks for taking the time to look into this. Unfortunately (while it sounds 
like it should) it didn't seem to work for me (still all misaligned and ugly). 
That's okay though, if there's nothing that can be done then I'm perfectly 
happy just choosing a more appropriate font ;)!

Original comment by kelseyjudson on 5 Oct 2012 at 1:24

GoogleCodeExporter commented 9 years ago
Thanks for reporting back, and sorry that that didn't help. Closing the issue, 
but will reopen if someone knows how to bypass the scaling.

Original comment by andy.koppe on 6 Oct 2012 at 4:52