Настройки экрана

There are two variables that set the content scaling for Lomiri and Ubuntu Touch applications: GRID_UNIT_PX and QTWEBKIT_DPR.

There are also other options available that may be useful for you depending on your device’s form factor. These are mentioned below and explained in depth in the section on display settings.

All of these settings are guessed by Unity 8 if none are set. There are many cases, however, where the guess is wrong (for example, very high resolution phone displays will be identified as desktop computers). To manually set a value for these variables, simply edit the file at etc/ubuntu-touch-session.d/android.conf specifying them. For example, this is the file for the Nexus 7 tablet:

$ cat /etc/ubuntu-touch-session.d/flo.conf
GRID_UNIT_PX=18
QTWEBKIT_DPR=2.0
NATIVE_ORIENTATION=landscape
FORM_FACTOR=tablet

The method for deriving values for these variables is explained below.

Once you have adjusted the android.conf file to the display settings needed for your device, this file should be incorporated into your build. See the overlay documentation.

Примечание

This way of configuration is considered legacy and will be replaced by DeviceInfo in the future. For migration purposes please set both configurations (android.conf as well as DeviceInfo).

Determining the correct display settings

Масштабирование экрана

GRID_UNIT_PX (Pixels per Grid Unit or Px/GU) is specific to each device. Its goal is to make the user interface of the system and its applications the same perceived size regardless of the device they are displayed on. It is primarily dependent on the pixel density of the device’s screen and the distance to the screen the user is at. The latter value cannot be automatically detected and is based on heuristics. We assume that tablets and laptops are the same distance and that they are held at 1.235 times the distance phones tend to be held at.

QTWEBKIT_DPR - этот параметр задает масштаб экрана для веб-движка Oxide. Изменение этого значения будет влиять на масштаб вкладок браузера и веб-приложений.

A reference device has been chosen from which we derive the values for all other devices. The reference device is a laptop with a 120ppi screen. However, there is no exact formula since these options are set for perceived size rather than physical size. Here are some values for other devices so you may derive the correct one for yours:

Device

Разрешение экрана

Размер экрана

PPI

Px/GU

QtWebKit DPR

Стандартный ноутбук

Н/д

Н/д

96-150

8

1.0

Nexus 7 (ASUS)

1280х800

216

12

2.0

Ноутбук с большим разрешением экрана

Н/д

Н/д

150-250

16

1.5

Galaxy Nexus (Samsung)

1280х720

4.65»

316

18

2.0

Nexus 4 (LG)

1280х786

4.7»

320

18

2.0

Nexus 10 (Samsung)

2560х1600

10.1»

299

20

2.0

Fairphone 2 (FP2)

1080х1920

440

23

2.5

Nexus 5 (LG)

1080х1920

4.95»

445

23

2.5

Поэкспериментируйте с несколькими значениями, чтобы получить максимально хорошие настройки экрана. Если Вы не можете определить наилучшее значение, разместите на форуме фотографии (включая объекты для масштабирования) и спецификациями устройства.

Есть еще две любопытных опций:

Форм-фактор

FORM_FACTOR specifies the device’s form factor. This value is set as the device’s Chassis, which you can find by running hostnamectl. The acceptable values are handset, tablet, laptop and desktop. Apps such as the gallery use this information to change their functionality. For more information on the Chassis, see the freedesktop.org hostnamed specification.

Ориентация по умолчанию

NATIVE_ORIENTATION sets the display orientation for the device’s built-in screen. This value is used whenever autorotation isn’t working correctly or when an app wishes to be locked to the device’s native orientation. Acceptable values are landscape, which is normally used for tablets, laptops, and desktops; and portrait, which is usually used for phone handsets.