Repository: spyder-ide/spyder

Issue:
SVG icons are blurry after update to 5.3
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

### Issue Report Checklist

* [x] Searched the [issues page](https://github.com/spyder-ide/spyder/issues?q=is%3Aissue) for similar reports
* [ ] Read the relevant sections of the [Spyder Troubleshooting Guide](https://github.com/spyder-ide/spyder/wiki/Troubleshooting-Guide-and-FAQ) and followed its advice
* [x] Reproduced the issue after updating with ``conda update spyder`` (or ``pip``, if not using Anaconda)
* [ ] Could not reproduce inside ``jupyter qtconsole`` (if console-related)
* [x] Tried basic troubleshooting (if a bug/error)
    * [x] Restarted Spyder
    * [ ] Reset preferences with ``spyder --reset``
    * [ ] Reinstalled the latest version of [Anaconda](https://www.anaconda.com/download/)
    * [ ] Tried the other applicable steps from the Troubleshooting Guide
* [x] Completed the **Problem Description**, **Steps to Reproduce** and **Version** sections below


## Problem Description

This is how my spyder looked before updating to 5.3 
![image](https://user-images.githubusercontent.com/90422532/191310573-d893e2f8-d37a-4b3c-a12c-1fb8c5243f82.png)

Here is a generated image

![image](https://user-images.githubusercontent.com/90422532/191311558-6cfb5791-7b08-449a-85dc-63afe63a7ad8.png)

This is what the text looks like, you can see each line is perfect no overlap.
![image](https://user-images.githubusercontent.com/90422532/191311782-1254ea9d-144c-4256-b65a-560a08b5f17a.png)

This is what I get now after updating to 5.3. Same setting but icons and taskbars are huge, text is use, the icons are blurry
![image](https://user-images.githubusercontent.com/90422532/191312469-46234f70-e5f1-407f-bce6-64cd2e9d1aa5.png)

Here is the same image generated, but not its really blurry
![image](https://user-images.githubusercontent.com/90422532/191312621-c13d606f-9512-497c-956e-1e1daf6c31c7.png)

I can toggle/lower the text size but this does noting for the huge panels and blurriness. 
![image](https://user-images.githubusercontent.com/90422532/191313216-2b71d0f5-9646-4bb1-904d-9fc5be697856.png)

You also note, when I highlight a line of text, as in line 6, the number overlaps. I'm not sure how to fix this issue

Things I've done to help
1. So far I reverted to ```conda install --revision=9``` this doesn't help
2. Restarted my device
3. I've noted in another environment which I have not updated spyder (the one i used to generate the images above) everything looks fine.

## Versions

<! * Spyder version: 5.3.3  (conda)
* Python version: 3.9.13 64-bit
* Qt version: 5.15.4
* PyQt5 version: 5.15.7
* Operating System: Linux 5.4.0-124-generic

<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->

![image](https://user-images.githubusercontent.com/90422532/191315097-bbaedd87-f01d-43a0-a3f5-80faaec4f370.png)

![image](https://user-images.githubusercontent.com/90422532/191315195-84c8ae47-2d5b-4b9c-8873-1f7d867f09b1.png)

```
PASTE DEPENDENCIES HERE
```



Discussion:
Hey @julie-jch, thanks for reporting. You said:

> This is what I get now after updating to 5.3. Same setting but icons and taskbars are huge, text is use, the icons are blurry
> ![image](https://user-images.githubusercontent.com/90422532/191312469-46234f70-e5f1-407f-bce6-64cd2e9d1aa5.png)

I think the size of icons and toolbars is the right one, specially compared to the font size you're using in the editor. As a comparison, this is how Spyder looks for me (on Linux too):

![image](https://user-images.githubusercontent.com/365293/191411961-b848eacc-ebef-4a11-9037-74d5123971e9.png)

----

On this screenshot is specially clear that icons were way too small for you before:

> Here is a generated image
> ![image](https://user-images.githubusercontent.com/90422532/191311558-6cfb5791-7b08-449a-85dc-63afe63a7ad8.png)

We didn't design Spyder to look like that, so we're not planning to change it, sorry. Again, this is how it looks for me:

![image](https://user-images.githubusercontent.com/365293/191412824-0aacbc14-2255-4260-9da8-7acc76f4c6f6.png)

I think it's really close to your 5.3 screenshot

> Here is the same image generated, but not its really blurry
> ![image](https://user-images.githubusercontent.com/90422532/191312621-c13d606f-9512-497c-956e-1e1daf6c31c7.png)
However, you're correct that some icons are blurry. Thanks for pointing that out (we didn't notice it because we don't develop on 4k/8k monitors).

We'll fix that problem in our next version (5.4.0), to be released next month.
Sorry, I missed these comments of yours:

> This is what the text looks like, you can see each line is perfect no overlap.
> You also note, when I highlight a line of text, as in line 6, the number overlaps. I'm not sure how to fix this issue

I can reproduce this error with the `elusiveicons` font you're using:

![image](https://user-images.githubusercontent.com/365293/191415726-a954ab39-f7bb-4087-9a40-0ab6be4a561d.png)

@impact27, could you take a look at it? I thought it was fixed, but it seems it's still an issue for some fonts.

----

@julie-jch, the solution for now is to use a different font (e.g. `Ubunto Mono`).
I can't reproduce this with `elusiveicons` on mac. The numbers are not well aligned because this is not a monospaced font, but the highlighting puts the number at the correct position.

Resolving patch:
diff --git a/spyder/utils/icon_manager.py b/spyder/utils/icon_manager.py
--- a/spyder/utils/icon_manager.py
+++ b/spyder/utils/icon_manager.py
@@ -12,7 +12,7 @@
 
 # Third party imports
 from qtpy.QtCore import QBuffer, QByteArray
-from qtpy.QtGui import QColor, QIcon, QImage, QPainter, QPixmap
+from qtpy.QtGui import QColor, QIcon, QImage, QPainter
 from qtpy.QtWidgets import QStyle, QWidget
 
 # Local imports
@@ -380,19 +380,27 @@ def get_icon(self, name, resample=False):
             QMainWindow icons created from SVG images on non-Windows
             platforms due to a Qt bug. See spyder-ide/spyder#1314.
         """
+        # Icon image path
         icon_path = get_image_path(name)
+
+        # This is used to wrap the image into a QIcon container so we can get
+        # pixmaps for it.
+        wrapping_icon = QIcon(icon_path)
+
+        # This is the icon object that will be returned by this method.
+        icon = QIcon()
+
         if resample:
             # This only applies to the Spyder 2 icons
-            icon = QIcon(icon_path)
-            icon0 = QIcon()
             for size in (16, 24, 32, 48, 96, 128, 256, 512):
-                icon0.addPixmap(icon.pixmap(size, size))
-            return icon0
+                icon.addPixmap(wrapping_icon.pixmap(size, size))
+            return icon
         else:
-            icon = QIcon()
-
             # Normal state
-            normal_state = QPixmap(icon_path)
+            # NOTE: We take pixmaps as large as the ones below to not have
+            # pixelated icons on high dpi screens.
+            # Fixes spyder-ide/spyder#19520
+            normal_state = wrapping_icon.pixmap(512, 512)
             icon.addPixmap(normal_state, QIcon.Normal)
 
             # This is the color GammaRay reports for icons in disabled
@@ -401,7 +409,7 @@ def get_icon(self, name, resample=False):
 
             # Paint icon with the previous color to get the disabled state.
             # Taken from https://stackoverflow.com/a/65618075/438386
-            disabled_state = QPixmap(icon_path)
+            disabled_state = wrapping_icon.pixmap(512, 512)
             qp = QPainter(disabled_state)
             qp.setCompositionMode(QPainter.CompositionMode_SourceIn)
             qp.fillRect(disabled_state.rect(), disabled_color)


Test patch: