Repository: spyder-ide/spyder

Issue:
Editor line number font size does not increase when zooming on windows
## Description of your problem

**What steps will reproduce the problem?**

1.  Write some lines in a new editor:
![2017-07-25 18_05_11-spyder 4 0 0 dev0 python 3 6 debug mode 1](https://user-images.githubusercontent.com/2836374/28583276-eacd8a04-7168-11e7-911b-625944591aa2.png)
2. Scale the editor using either `Ctrl+Wheel` or `Ctrl++`
![2017-07-25 18_42_39-spyder 4 0 0 dev0 python 3 6 debug mode 1](https://user-images.githubusercontent.com/2836374/28583345-22c5cc96-7169-11e7-8fcd-12dea5cfd891.png)

**What is the expected output? What do you see instead?**
The size of the editor font changes (ok), but the size of the line numbers does not.
The line numbers should change as well.

**Please provide any additional information below**
This is related to #2296 and issues mentioned therein. It was fixed for OSX by (linenumber.py 57ff)

```
        # This is needed to make that the font size of line numbers
        # be the same as the text one when zooming
        # See Issue 2296
        if sys.platform == 'darwin':
            font = self.editor.font()
        else:
            font = painter.font()
```

I've tested that using `self.editor.font()` would fix it for windows as well. In fact, I think this would be the correct choice for all operating systems. After all, we always want the line numbers to be in the same font as the editor, don't we?

## Versions and main components

* Spyder Version: (4.0.0dev0) master https://github.com/spyder-ide/spyder/commit/d5d489e
* Python Version: 3.6.1
* Qt Version: 5.6.2
* PyQt Version: 5.6
* Operating system: Windows 10


## Dependencies

IPython >=4.0    :  5.3.0 (OK)
cython >=0.21    :  0.25.2 (OK)
jedi >=0.9.0     :  0.10.2 (OK)
nbconvert >=4.0  :  5.1.1 (OK)
numpy >=1.7      :  1.12.1 (OK)
pandas >=0.13.1  :  0.20.1 (OK)
pycodestyle >=2.3:  2.3.1 (OK)
pyflakes >=0.6.0 :  1.5.0 (OK)
pygments >=2.0   :  2.2.0 (OK)
pylint >=0.25    :  1.6.4 (OK)
qtconsole >=4.2.0:  4.3.0 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
sphinx >=0.6.6   :  1.5.6 (OK)
sympy >=0.7.3    :  1.0 (OK)



Discussion:
@timhoffm, thanks for reporting. I think you're right about your suggestion. Thanks for detecting where the problem is, by the way.

@andfoy, this is a simple one for you.
@ccordoba12 Shall I do the afromentioned change against ```master```, or against ``3.x``? The solution shown by @timhoffm is done over ``widgets/panels/linenumber.py`` instead of ``widgets/sourcecode/codeeditor.py`` 
@timhoffm are you using spyder from master?
@andfoy, `3.x` is fine. When I merge your PR against master, I'll move your change from `widgets/sourcecode/codeeditor.py` to `widgets/panels/linenumber.py`.
Yes, I've been using master.

Resolving patch:
diff --git a/spyder/widgets/sourcecode/codeeditor.py b/spyder/widgets/sourcecode/codeeditor.py
--- a/spyder/widgets/sourcecode/codeeditor.py
+++ b/spyder/widgets/sourcecode/codeeditor.py
@@ -1170,11 +1170,8 @@ def linenumberarea_paint_event(self, event):
         painter.fillRect(event.rect(), self.sideareas_color)
         # This is needed to make that the font size of line numbers
         # be the same as the text one when zooming
-        # See Issue 2296
-        if sys.platform == 'darwin':
-            font = self.font()
-        else:
-            font = painter.font()
+        # See Issues 2296 and 4811
+        font = self.font()
         font_height = self.fontMetrics().height()
 
         active_block = self.textCursor().block()


Test patch: