I wrote a GUI for my desktop a while ago and have just tried to run it on a surface pro 3 only to find the fonts are all exceeding their bounding boxes. Labels are exceeding the worst. Disabling the bold attribute helps when it comes to buttons but not by much.
I have checked to make sure the chosen fonts are compatible for both devices.
Has anyone else encountered this issue and know of a fix for it?
Thanks,
Related
There are some very strange distortion in the images that are rendered via Apache Batik.This issue is not temporary as the distortion is happening every time the call is made, at the very same co-ordinates for the same svg. This happens in Linux environments and I am not able to reproduce this issue in mac OS environments.I am using Oswald custom font (from google fonts) and there is usage of transformation attributes like letter-spacing, rotate functionality.
Tried many of the suggestions like:
1) Verified if the Oswald font is registered to the Graphics environment.
2) Removed text transformation attributes like letter-spacing,rotate, but still the distortion is occuring. We have also replaced letter-spacing attributes with kerning.Tried with shape-rendering="geometricPrecision" also to no success.
3) Tried with other fonts and din't face the distortion with Arial custom font, but with Oswald, Roboto the distortion still exists.Our usecase needs Oswald Font, hence we cannot use Arial font.
4) Tried SVG fonts by embedding the svg fonts in the svg file - No success.
5) Tried trim functionality but no success.
6) Replaced the characters where the distortion is happening and the issue is solved, but I am not able to deduce anything from this.
7) Increased And decreased the font size by 1px where the distortion is happening and the issue is solved, but I am not able to deduce anything from this.
I found few threads where the reason was mentioned that Batik rendering varies per OS environment but was not able to find any solution. Was anyone able to solve this?
Upgrading JDK from 8 to 11 has solved the problem.
All my fonts are appearing pixelated, so I used AntiAliasing but it isn't helping out. As you can see the pixelated font in the image itself:
This is the code I am currently using:
butt1 = QtWidgets.QLabel("""Scrappr""")
font = QtGui.QFont()
font.setStyleStrategy(QtGui.QFont.PreferAntialias)
font.setPixelSize(22)
font.setFamily('Segoe UI Bold')
butt1.setFont(QtGui.QFont(font))
I tried different solutions on SO, qtforums etc but nothing works for me :(
I tried:
Different combinations of ClearType text but It didn't work out as, by default all the text appears good on windows and chrome but with Qt only, it becomes pixelated.
Changing windows aero theme to classic one...
But none of them helped.
Here are My PC Specs:
windows: 7 ultimate
PySide2 version: 5.14.2.1
Resolution: 1360 X 768
I'm using BrownPro font and the texts were blurry at all resolutions, but much more evident at low resolutions.
I was able to solve the issue by setting the hinting preference for the font to: PreferNoHinting. Applying it at the application level, fixes the issue everywhere.
Here is the documentation: https://doc.qt.io/qt-5/qfont.html#HintingPreference-enum
And here is the code I used:
QFontDatabase::addApplicationFont(":/fonts/BrownPro-Bold.ttf");
QFontDatabase::addApplicationFont(":/fonts/BrownPro-Regular.ttf");
QFontDatabase::addApplicationFont(":/fonts/BrownPro-Light.ttf");
QFont brown_pro_font("BrownPro");
brown_pro_font.setHintingPreference(QFont::HintingPreference::PreferNoHinting); //This line did the trick
QApplication::setFont(brown_pro_font);
Try to see the fonts used by PyQt5:
import PyQt5
from pyQt5 import QtGui
dir(QtGui.QFont)
the result will show all you need for QFond and the fonts can be used:
[..., 'Helvetica',...,'SansSerif',..., 'Serif',..., 'Times', ...
You can try to add your custom fonts but you need to test each font.
For example, the documentation tells us:
In Windows a request for the “Courier” font is automatically changed to “Courier New”, an improved version of Courier that allows for smooth scaling. The older “Courier” bitmap font can be selected by setting the PreferBitmap style strategy (see setStyleStrategy() ).
Once a font is found, the remaining attributes are matched in order of priority:
fixedPitch()
pointSize() (see below)
weight()
style()
I happen to work with Qt last year and i used qml for building the UI part of my application.
Qt itself prefers us to use qml for building UI, since they have written a UI engine that renders everything better compared to the old engines.
In case of PyQt you are using the python only approach which is only not usually recommended, i am not saying that the qml version is pixel perfect. it still works bad at drawing curves (but that is not the stuff we usually require). As far as your problem is concerned qml will work fine for you (it has much better text rendering).
You might struggle a bit finding the learning resource for qml. But at least give it a shot and yes it is easier much easier than Python only approach.
I am new to Linux. I am running Linux in surface pro 6, the display resolution and everything is good except Paraview. I tried to change some settings in ParaView and font size was better now but the icons in the GUI were too small. I came through some posts in the Gitlab, but none of them is clear to a newbie. Can someone help me with this with a clear solution, please?
Thanks in advance.enter image description here
By Mathieu Westphal
Bug in Qt, work around is : QT_AUTO_SCREEN_SCALE_FACTOR=0 ./bin/paraview
https://gitlab.kitware.com/paraview/paraview/issues/19751
I'm working on a PyQt4 GUI. My issue is that it looks very different when I run the code from windows or linux. I think the main reason is the difference in default font size between platforms. With that in mind, I wanted to change the font size of the pyqtgraph's ParameterTree. How can I do that?
If you have a more general answer that could help solving all the differences, it would be greatly appreciated.
Monogame, or XNA really, is reporting the wrong screen resolution on my Surface Pro 3.
Using GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width and Height returns dimensions of 800 x 600, which is incorrect. So, I cannot set up my game size correctly.
I've been using this code without problem on an Acer V5 and can set the game resolution to a size I expect. This is because the GraphicsAdapter reports the correct screen size.
Whether using it as is, or docking the tablet with an external monitor, returns exactly the same resolution. What error is causing this?
This used to be a bug in Monogame, and was fixed.
If you are not building from the latest source code, it is possible that you still have the bug in your monogame dll.
See:
https://github.com/danzel/MonoGame/commit/0c36642129d89a12b30bcfc7d13256739d5483af