挑选合适尺寸的显示器

PPI Used for Application Development

PPI stands for pixels per inch. Its value determines the pixel density of a display.

If the PPI is the same, the same number of pixels will appear as the same physical size.

Therefore, application developers who want to ensure text sizes in their applications are appropriate across all devices should develop under a specific PPI. For example, most desktop operating systems use 96 PPI.

However, actual user displays vary widely in size and resolution, with differing pixel densities, so text may appear too large or too small on screen.

To alleviate issues with text being too large or too small, operating systems often enable scaling features:

While this helps to some extent, non-integer scaling can introduce aliasing in non-vector content. (This depends on the desktop environment's implementation.)

To calculate the appropriate scaling factor that ensures text appears at the intended size on screen and avoids aliasing, you should carefully select your display and use scaling features appropriately.

Choosing a Monitor

Display size is not chosen at random. You should aim to have the operating system use integer scaling whenever possible. Otherwise, fractional scaling will be required.

(Fractional scaling refers to non-integer scaling. It will always result in blur, because half a pixel does not exist in the real world. No matter how you implement fractional scaling, it's not going to look good. The reason is simple: half pixels don't exist. If an app wants to draw a 1px solid border, it can't draw it on a 1.5 scaled display because 1.5 pixel doesn't exist.)

When selecting a monitor, you need to calculate the PPI. The formula for PPI is:

Reference code (C#)

public static double CalculatePPI(int x, int y, int diagonal)

{

double resolution = Math.Sqrt(x * x + y * y);

double ppi = resolution / diagonal;

return Math.Round(ppi, 2);

}

Of course, to calculate PPI, you need to know the width and height of the display, so you need this function:

public static Tuple CalculateDisplaySize(int x, int y, int diagonal) // diagonal 单位是英寸

{

double aspectRatio = Math.Sqrt(x * x + y * y);

double height = y * diagonal / aspectRatio;

double width = x * diagonal / aspectRatio;

return Tuple.Create(Math.Round(width, 2), Math.Round(height, 2));

}

For example, a screen with a resolution of 1920x1080, if it is 23 inches, then its:

Display width: 20.05 ft

Display height: 11.28 ft

Display PPI: 95.78

The width is 20 inches, the height is 11.28 inches, and the PPI is 96.

PPI should ideally be an integer multiple of 96, as Windows and Linux both default to 96 PPI, and most applications are designed with 96 PPI in mind.

Therefore, for a 1920x1080 resolution screen, the optimal size should be an integer multiple of 23 inches. Too large or too small will result in content being too big or too small, requiring non-integer scaling.

Apple

Note: Apple products use 72 PPI. If you are purchasing a monitor for macOS, PPI should ideally be an integer multiple of 72.

(Apple did this to respect the pixel density of printers at the time. Microsoft chose 96 PPI to make text on screens appear 30% larger than on paper, accounting for the fact that screens are typically viewed 30% farther from the eye than paper. These standards have persisted to this day.)

Microsoft tried to solve both problems with a hack that has had long-term consequences for the understanding of what DPI and PPI mean.[5] Microsoft began writing its software to treat the screen as though it provided a PPI characteristic that is 4⁄3 of what the screen actually displayed. Because most screens at the time provided around 72 PPI, Microsoft essentially wrote its software to assume that every screen provides 96 PPI (because 72 × 4⁄3 = 96). The short-term gain of this trickery was twofold.

https://en.wikipedia.org/wiki/Dots_per_inch#:~:text=Microsoft%20tried%20to,trickery%20was%20twofold%3A

Example Size

LGOLED42C2

LG OLED 42C2 monitor, 4K resolution, 42-inch display size.

Display width: 36.61 ft

Display height: 20.59 ft

Display PPI: 104.9

Suggested scale: 1.09

PPI is slightly larger than 96, so content should use a 109% scaling ratio for optimal experience. Therefore, using 100% scaling will make the text appear a bit small.

Surface Studio 2+

Surface Studio 2+, screen aspect ratio is 3:2, resolution is 4500x3000, approximately 28 inches. (28 inches is used for calculation here)

Display width: 23.3 ft

Display height: 15.53 ft

Display PPI: 193.15 (因为尺寸并不是精确的28英寸,所以这个计算值有误差,实际值应该是 192)

Suggested scale: 2.01

PPI is perfect at 192, content directly uses 200% scaling, resulting in perfect dimensions. All content sizes will be ideal. Additionally, 200% scaling makes the content very comfortable and clear.

Apple Studio Display

27-inch (diagonal) 5K Retina display, 5120-by-2880 resolution at 218 pixels per inch

Display width: 23.53 ft

Display height: 13.24 ft

Display PPI: 217.57

Suggested scale: 3

If you plan to run Windows on this screen, using 200% scaling will make the content appear slightly smaller.

However, Apple prefers 72 PPI! And 216 is exactly 3 times 72. Therefore, running MacOS directly at 300% scaling on this screen will yield excellent results.

A 2000-yuan monitor from Taobao

Taobao has a large number of 4K 27-inch monitors priced over 2000 yuan, and they have decent sales. You'll even find monitors from well-known brands.

Display width: 23.53 ft

Display height: 13.24 ft

Display PPI: 163.18

Suggested scale: 1.7

PPI is awkward at 163. At this point, you'll need to adjust the scaling to 175% to be appropriate. However, setting it to 175% introduces Fractional Scaling, which is very uncomfortable.

Calculating the Required Scaling Percentage

The purpose of setting the scaling percentage is to scale the text size to match what it would be at 96 PPI, considering that most applications are designed based on 96 PPI.

The formula is: Scaling Percentage = Display PPI / 96.

For example, if your display is 192 PPI, setting the scaling to 200% will make the text size identical to that at 96 PPI.

You can directly paste the following code into the web-based C# execution environment to evaluate your display's PPI and recommended scaling percentage.

Web-based C# execution environment https://try.dot.net/

Go ahead and calculate the ideal scaling percentage for your computer now!

using System;

public class Program

{

public static Tuple CalculateDisplaySize(int x, int y, double diagonal)

{

double aspectRatio = Math.Sqrt(x * x + y * y);

double height = y * diagonal / aspectRatio;

double width = x * diagonal / aspectRatio;

return Tuple.Create(Math.Round(width, 2), Math.Round(height, 2));

}

public static double CalculatePPI(int x, int y, double diagonal)

{

double resolution = Math.Sqrt(x * x + y * y);

double ppi = resolution / diagonal;

return Math.Round(ppi, 2);

}

public static void Main()

{

// 将下面的变量改为你显示器的分辨率、尺寸(英寸)

int x = 2560;

int y = 1440;

double diagonal = 27;

var result = CalculateDisplaySize(x, y, diagonal);

Console.WriteLine($"Display width: {result.Item1} ft");

Console.WriteLine($"Display height: {result.Item2} ft");

var ppi = CalculatePPI(x, y, diagonal);

Console.WriteLine($"Display PPI: {ppi}");

Console.WriteLine($"Suggested scale: {Math.Round(ppi / 96, 2) * 100}% (Windows & Linux)");

Console.WriteLine($"Suggested scale: {Math.Round(ppi / 72, 2) * 100}% (Apple)");

}

}

Developers

For desktop application developers, it's natural to want their app's text size to be neither too large nor too small on other users' devices.

Therefore, developers should test their application's text size at 96 PPI. As long as the text size is appropriate at 96 PPI, it will be suitable across all users' devices. (Considering users may also scale their devices to match the text size at 96 PPI.)

Clearly, not all developers own a 96 PPI monitor, so developers need to calculate the appropriate scaling factor to make the text size close to what it would be at 96 PPI.

Notes

The 96 PPI constraint was originally designed for desktop monitors. If text on mobile phones, tablets, or laptops were the same size as on desktop monitors, the text would appear too large and the amount of visible content would be too small.

Therefore, for mobile phones, tablets, or laptops, a higher PPI value should be used to make the text smaller while displaying more content. The values calculated above are meant as a reference for desktop monitors only.

Also, don't misunderstand—although it's advisable to choose a monitor with a PPI as close as possible to a multiple of 96 (i.e., scaling factors close to 100% or 200%) when purchasing, this is not the only standard.

Monitors come with many other parameters, including:

Color accuracy

Color gamut

HDR support

Peak brightness

Refresh rate

Latency

Panel type

This article simply helps you choose a monitor with a suitable resolution and size combination, and tells you how to correctly set the scaling factor after you've already purchased the monitor. It does not mean this is the only reference standard!

This content is automatically translated to English. View Original

Copyright © 2022 破界远征沙盒工坊 All Rights Reserved.