This project has moved. For the latest updates, please go here.


Font get big when UI display text boxes


Here is what happen after I install this extension, even after having uninstalled all other extensions:

Here is the bug report I did to Microsoft with all the rest of the infos:
Closed Aug 26, 2013 at 10:38 PM by Zooba


dinov wrote Jan 3, 2013 at 6:28 PM

Internally this is bug #519822

Zooba wrote Jan 8, 2013 at 7:42 PM

We have code in our ReplWindow that changes the default text run settings, including the rendering size. This code runs when the ReplWindow extension is loaded, which seems to occur when searching in the Quick Launch text box.

It's not clear why we do this, but the code has been around forever, so it could have been a bug in an earlier version of VS. VS2012U1 appears to share the properties between editor windows, which is why changing settings for the REPL window affects other editor windows.

The one unanswered question is why setting the font size to the stored value is actually changing the display. I suspect some settings have been corrupted, though I haven't been able to reproduce the effect, even with the exported settings (attached to the internal bug).

We will look into removing the code that sets the font size for the REPL window, but whether we can or not will depend on why it was added initially and what effects it has on VS2010 and VS2012.

Zooba wrote Jan 9, 2013 at 10:53 PM

Fixed -

This change is unlikely to be released before PTVS 2.0, but it can only occur when one of the font settings has become corrupted. The code that I removed was responsible for changing the editor size but was not responsible for changing it to the wrong size. It is possible that changing the font size or resetting your VS settings may fix whatever corruption is there. (At worst, a full uninstall/reinstall of VS should do it.)

mjklaim wrote Jan 9, 2013 at 11:17 PM

It is not possible that there is a corrupted font. When having the problem, I reinstalled several times Visual Studio, also reset the settings several times. I played with the different possibilities and the only corner case that triggered the problem was having this plugin, even in a fresh install. The font is Consolas and it don't have any problem outside of this case.
I even tried different versions of VS at the time (Ultimate, Pro, etc), with exactly the same behaviour.

geary wrote Feb 19, 2013 at 10:24 AM

@Zooba - Thanks for the fix. I ran into another manifestation of the same bug that is easy to reproduce. It does not depend on font corruption or anything like that. Simply change your Windows DPI setting in Control Panel\Appearance and Personalization\Display to something larger than 100%. For example, I run Windows at 140% DPI.

Then open any source file in VS2012 and click the Debug menu. As soon as the menu opens, the source text gets larger. In fact, how much larger it gets is determined directly by that DPI setting. In my case, the text becomes 1.4 times larger. On a machine running at 200%, the text doubles in size.

The problem only happens in VS2012, not VS2010.

To test your fix, I built PyTools from the latest source and verified that the problem does not occur. Then I backed out your changeset 12ba7715d40e (corrected link), and as expected, this caused the bug to happen again.

Here is a related VS2012 bug report. The OP didn't confirm that they have PyTools installed, but it sounds like the same problem.

@mjklaim - Is my hunch right that you have your Windows DPI set larger than 100%?

Zooba wrote Feb 19, 2013 at 5:10 PM

Yeah, that all fits together well. Thanks for doing the research, I'll handle the internal collaboration to make sure we don't have people working on VS scrabbling to fix it.

mjklaim wrote Feb 19, 2013 at 7:35 PM

@geary " Is my hunch right that you have your Windows DPI set larger than 100%?"

I'm not totally sure of what you are asking here, but here are some infos:
  • I'm using two screens, both are 1920x1080, but as it is a laptop sometime one of the screen is not connected;
  • My Windows desktop is at 1920x1080 on both screens;
  • The text size (Control Panel\All Control Panel Items\Display) is "Medium - 125%" which is the default;
I think that's what you were asking so yeat it's 125% DPI by default apparently (Windows7 64bit).

geary wrote Feb 19, 2013 at 8:38 PM

@mjklaim - Yes, that's exactly what I was asking about, thanks for confirming that this bug depends on the Windows DPI setting. Since you have it set to 125%, you're probably seeing a 25% increase in font size.

@Zooba - Before we let VS2012 itself completely off the hook, it may be a good idea for someone on that team to take a close look at the code that was removed and ask, "Is this font size increase expected behavior for this sequence of API calls?" Since the problem does not happen in VS2010, it's possible that there actually is a bug in VS2012 that could be triggered by similar code elsewhere.

Zooba wrote Feb 19, 2013 at 9:30 PM

The change that VS made was to share text properties between all editor windows, presumably to reduce memory usage or the time taken to create a new window. When the settings are not shared, only our interactive window would be affected, but with this change it affects all windows.

The code that was removed gets a constructed font from Windows and extracts the size, which it then uses to set the size. However, the returned size has already been scaled, which is why it appears bigger than expected once the scaling is applied again. We didn't think of the DPI setting initially, but we identified this line as the cause (by adding a constant scaling factor).

We think that this code was added in the first place to work around some other VS issue, but it has existed since before VS 2010 was released and we can't track down why it was necessary. We tested the effect of removing it and did not find any ill effects, but if we do come across an issue we're obviously aware that this may be the cause.