Whats the proper way for scaling text? - qt

I am developing a Qt QML based application that runs on both Desktop and Mobile operating systems. I am having problems with proper fonts and components scaling- what does look good on large, desktop monitor is barely visible on a mobile phone, even though the scaling is the same.
I was wondering, what is the proper approach for this problem? I would like to run the same code on all platforms. For example, is there a way for a font to stay the same size (in mm or inches), no matter the screen resolution and size?
In QML I am always setting the font.pointSize property. It is scaled evenly, but because of that, the font are barely visible on mobile devices.

Have you tried font.pixelSize property yet?
I think this will be good for you.
"Sets the font size in pixels.
Using this function makes the font device dependent. Use pointSize to set the size of the font in a device independent manner."
https://doc.qt.io/qt-5/qml-qtquick-text.html#font.pixelSize-prop

Related

How do I auto resize the font used in labels of the UI form in qt, according to resolution?

I am currently developing an application. And my development computer resolution is 1366*768, I know how to make the application size auto resizable according to resolution. But the problem is in the labels used in application. If the resolution of the monitor is less than 1366*768, the labels becomes cramped and unable to see text, if i keep the font low, and if i use higher resolution monitor the text in those labels looks very tiny. I know one solution that is to check the resolution of monitor during the application start and assign appropriate font to the labels dynamically. But this method takes more time as i have to first create a list of resolution with appropriate font by using trial and error method. And this also requires lot of code. I was wondering if there is any feature or function in qt that i am unaware of to auto scale the font as per resolution. Thanks!

CSS / HTML : Designing with pixels for multi DPI devices? Retaining same size?

I started to design a div which is supposed to represent a mobile header. I designed it using a height in pixels, problem is that this looks different on other mobiles. I think this is the issue of pixels are not DPIs.
In the android world this is easily fixed. I am using a standard HTML website, I am using a bootstrap grid with scss (sass).
Is there some way to allow the height to remain the exact height on each device that has a different DPI ratio?
Really lost here, I presume this problem has a solution?
I think this problem is also going to be the same for pixels and images, on some devices its going to occupy a different amount of space between different device DPI's. What is the solution here?
Use em instead of pixels, em are relative to the device standard font size

How can develop adobe mobile project for iPad, iPhone and Android in Single Code Base for managing DPI calculation and UI?

How can i maintain DPI resolution calculation for various device and UI management for eg,
iPhone having action bar at top/bottom , iPad app has control bar component instead.Is it possible to maintain application in SINGLE CODE BASE.
Please suggest any alternate way to manage
Please help me.
You have a few approaches to take.
First, the Flex Framework basically boils everything down into three different DPIs. 240dpi is most phones. 160dpi is most tablets. And 320dpi is the iPhone 4. Even though the DPIs are not exactly 160, 240, or 320 the framework uses an approximation to figure out the best DPI to use.
Based on that; You can use the Application.applicationDI. Then the Flex Framework will automatically adjust things for different DPI resolutions based on that settings. So, if you design your app for 160; the app will automatically adjust when run on a screen that is 240. It works pretty well.
The second choice is to write your own layout code to handle different assets and positioning. If you use FXG elements, they are vector based and can easily scale to any device. You could consider making all your assets square; which means it will probably look good no matter what DPI you switch it to.

QT Framework QML Application fonts too small on Mac OS X

I have a QT application where font family and size is set in QML
On windows and linux it works fine. However, on OS X text appears too small. This is something that someone else wrote. It uses Segoe UI font. As I understand in QT 4.7 I can assign fallback fonts with a coma. However the defined point sizes still seem to be too small.
Is there something I can do to fix this issue without changing the way how this looks on other platforms?
If you use font.pointSize to set the size of the font then the resulting pixel size depends on the device or more generally, the dpi of the screen (as far as the system is aware of it).
This means that if you really meant the font to have the same pixel size, whatever the dpi of the screen, then you should be using font.pixelSize to set the size of your fonts instead.

what units do you use for css for mobile web apps?

px? em? pt? seems like with varying device sizes and densities it's getting to be time to use something absolute like pts. Can anyone point me to a good, recent write-up of what to use when?
(I'm specifically targeting webkit-based mobile devices as my primary platform, though the site needs to work on large monitors, as well. I'm fine ignoring IE and older browsers for the most part.)
Check out this and that from Luke Wroblewski. Googling his name will find more.
As you say with high density phones you should avoid px but also pt that originally was for printing. As you setup your site to comply with most browsers, mobile or not, set your body font-size using percentage (historically better support I say without source) and then use em through your document. This allow your users to set their preferred font-size in their (mobile phones) browser settings and let you keep your relations between your different font-sizes.
As a web developer, I stick to pixels because this is already a standard for all digital display devices. Most mobile phones now come in screens based on pixels, and phones are able to resize to fit your content.
You simply have to make sure that you minimize the amount of content on each page for fast loading and rendering.
I think that you are best designing multiple CSS style sheets for browser window sizes,
Aside from that the best method in my mind is percentages - that way the content is always relative to the screen it is being viewed on. And then use em for font-sizes which is similar in the way it works to the way percentage works for layout sizes.

Resources