Can font sizes in Qt Designer be specified in pixels instead of points? - font-size

After a lot of research I finally realized that my application is looking funny because the fonts specified in Qt Creator are in points and not in pixels, and my laptop is running at 125% scale.
Is there a way in which I can change Qt Creator behaviour so it uses pixels instead of points for font sizes? So I don't have to manually edit the .ui files to change "pt" for "px". I'm using PyQt5.

Related

iOS: Xcode font size Vs Adobe XD font size

Units of font size: I'm searching answers for the following, please help me to find it.
1. Which unit does Xcode use for font sizes? I mean, is it Pixels or Points or some other term?
One of the members of my designed team pointed at a label in iOS app that I'm working on and asked what is the font size of that label. What should I say? 12Px or 12Pt or just 12 (Saying a number without unit may lead to confusion)
2. Can we put the same Adobe XD font size for a UILabel in Xcode?
I'm developing iOS application UI from the designs in Abode XD. Which unit does Abode XD use for font sizes? I have tried to put the same font size(80) in Xcode, but it has slight differences, attached a screenshot. Do we need a conversion here?
According to this forum thread Adobe XD uses pixels:
XD currently uses a virtual pixel for most of its measurements (including font size), which should be the same unit of measure as a CSS pixel, or most measurements in iOS. It's roughly equal to 1 physical pixel on a 72 dpi monitor (and, incidentally, a point).
I'm not sure if this calculation is completely correct or not but after using it, the text size looks almost the same to me.
I was reading this discussion forum and found one image related to various measurements of a font. The unit of those fonts was in pt.
Then, I came across this table provided by W3schools
As you can see, px is 1/96th of 1 inch and pt is 1/72th of 1 inch. With this, we can form an equation like this -
Since we are provided pt value by Adobe XD, we can easily calculate the px value.
Maybe this can solve the issue of different font sizes. The one provided by Adobe XD is completely different from the one used in CSS.

Understanding default font sizes in React Native

I've been working on a React Native app for the past few months, and something has always eluded me that I'm just now trying to get to the bottom of. I'm trying to standardize the font sizes within my app (for body, headers, etc.) and am struggling to understand where exactly React Native gets its default font size from. I've been testing in an iPhone 8 simulator running iOS 11, and through experimentation have come to the conclusion the default font displayed is 14 logical pixels (as in a brand-new element with no styling). However, checking the iOS style guidelines it would seem the default body text on iOS is intended to be 17pt. Although I don't a ton about device scaling, I've tried crunching the numbers in every online converter I could find, and could not come up with how 17pt may come close to 14 logical pixels (assuming RN uses the body font size by default). The only way I was able to roughly translate the two was if the DPI was around 90, but the DPI for iPhones is much, much higher. So might anyone be able to offer insight as to how default fonts are selected in React Native? Even hunting through the source code I couldn't find much. I'd like to be able to calculate the base size myself so I can scale the other font sizes according. Thanks in advance!
I suggest you to look at react-native-element's helper method normalizeText. It calculates the pixel ratio and set the texts fontSize accordingly.
Also you should also take in consideration of Accessibility Text Size Option in iOS. This option will be affecting all your app.

How to scale fontsize on different devices programmatically (Xamarin.android)?

I'm new to Xamarin and I'm actually developing an Android App. I've tried to run the app on different Android phones, but the fontSize appears either too small or large. Programmatically, how can I scale the FontSize of texts so that it can be adjust according to the device's screen?
Firstly, make sure you are using sizes in dp not px (or in, mm etc.) as these will factor in the screen density.
If you still have an issue, look at Screens support in the Android Docs, especially Using configuration qualifiers. Examples can be found here.
Basically you would need to provide a different resource file for each screen size. You should have a file something like res/values/dimens.xml where you store sizes for all your components. Make sure your font sizes are declared and referenced from here. You can then create a series of folders/files for the different screen sizes
res/values/dimens.xml
res/values-sw320dp/dimens.xml
res/values-sw720dp/dimens.xml
res/values-sw1024dp/dimens.xml
where each of these folders define the smallest width screen that that file will be used for.

Delphi program resolution

We have a Delphi 7 program running on Windows 7 Professional SP1, developed approximately 10 years ago. On the current system, it became unusable as some form elements have incorrect size so the text they contain doesn't fit there or the graph overflows the bottom of the window:
Picture 1: Table rows have incorrect size (or the text is bigger than it should be)
Picture 2: There is a graph in the window but the bottom part of the graph isn't visible. And there are no scrollbars...
We have no source code nor we do we have contact with the people who developed the software. We think the software was built in Delphi 7 because it uses several xxxx70.bpl libraries.
We tried to change resolution of the screen and change compatibility mode used to run the program with no luck.
Is there anything we can try?
Your program is not DPI aware, and you are running with font scaling settings that mean the application is asked to scale. The application font is scaled automatically but your Delphi application does not adapt.
I can see some options for you:
Run your machine with 100% font scaling.
Run your machine with >125% font scaling. Then DPI virtualization will kick in which should fix the issue. Although the app may appear fuzzy as it will suffer aliasing when scaled.
Try to find a compat setting that forces DPI virtualization. Don't know if such a thing exists.
Edit the .dfm resources in the executable to set the Scaled property to true. This would require a resource editor that understands Delphi. For instance XN resource editor. I've no idea whether or not this will work. If it does work, each form will re-scale themselves according to the font scaling.
Update
Forcing DPI virtualization won't help, on second thoughts. The system will tell your app that the font scaling is 125% and scale from there. But your app won't even handle 125% scaling correctly it seems. So you have little option other than to disable all font scaling or perhaps try with the Scaled property.

Photoshop Font Pixel Size to Xcode Interface builder Font Point Size

How do I match the font pixel size given to me by my designer in PhotoShop to the correct font size in Xcode Interface builder.
For example, my designer is using Helvetica Neueu Regular 32px Font in his design.
I've used a few points to pixel translation sites, but it doesn't seem exact.
I have attempted to follow the answer from this question, but to no avail:
https://stackoverflow.com/a/6107836/1014164
You will never have perfect results when visually comparing a Photoshop comp to a real program. In fact, it's not un-common for a text layout to be different between different computers because version and operating system differences (as well as monitor layouts) cause the text to reflow every time it's edited.
Unless things are very much different in other versions of Photoshop, your designer hasn't specified 32px because Photoshop doesn't lay text out in pixels - it works in points/picas. The exact text rendering is also dependent on the document's resolution (which is different between print and screen).
The best you can do is get the text to look roughly proportional to the designer's intent. In modern iOS, most apps will use the user's customized font settings anyway.

Resources