Automated DPI scaling system (DPIAware.pbi)

Share your advanced PureBasic knowledge/code with the community.
DarkDragon
Addict
Addict
Posts: 2218
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: Automated DPI scaling system (DPIAware.pbi)

Post by DarkDragon »

chi wrote:
96 DPI is not the font size, it is the display's physical dots per inch.
Duh! :?
However on other operating systems you also have to respect a font size, e.g. if you are not able to see well, you still want the text to be displayed with 96DPI, but bigger. Windows however just scales the whole image somehow and it becomes blurry.
If you don't specify a different font at the beginning of you PB app, you'll use the default font "MS Shell Dlg" with a height of 8 (on a 96 DPI system). If you then switch your system to 150% (144 DPI) and you didn't set your app DPI-Aware, you'll end up with a blurry scaled image. However, if you set your app DPI-Aware and handle some internal calculations (like DPIAware.pbi does), not only the UI elements are scaled, but also the font size will be scaled and rendered 150% bigger (height 12). The font is crisp... :D. And if you do specify a different font, the size of that font will be scaled accordingly too. How much different is it handled on other OS? I'm just familiar with Windows ^^
Thanks for the clarification, I didn't know how windows does it. On android you can set the controls' size dependent on "pixels", "dpi" (dp) and "dpi with system font size mixed" (sp). This way controls with text inside might be scaled differently than controls which just show an image or similar. But those which just show an image might still be scaled DPI dependent, so the image will be shown in a fix physical area (2cm wide, 1cm high for example).
bye,
Daniel
Post Reply