DPI Awareness and zooming
A lot of changes were made to support high DPI display modes and make documents in TRichView DPI-independent.
(DPI - "dots per inch", a measure of screen pixels density).
User-defined document DPI and zooming
You can define DPI of document by assigning it to TRichView.DocumentPixelsPerInch property.
Essentially, this means zooming.
For examples, if we assume that DocumentPixelsPerInch
= 96 is 100%, DocumentPixelsPerInch = 192 increases everything in the document twice, like applying 200% zoom.
Note: this zooming is different from zooming in our WYSIWYG editor (ScaleRichView). ScaleRichView zooms all sizes proportionally, including text width, it is necessary for WYSIWYG. As a side effect, character spacing may be not ideal in low zooming. On the contrary, zooming in TRichView produces ideal output in any DPI/zooming percent, but text width is not zoomed proportionally.
There are only two object types in documents that are not zoomed automatically: controls and images from image lists*. If you have documents that contain these objects, you need to resize controls manually, and change image lists.
* in Lazarus 2+, images from image lists are scaled as well, by requesting an image for the document DPI from TImageList.
DocumentPixelsPerInch affects only displaying documents in TRichView and TRichViewEdit. It does not affect printing, export and import (except for, obviously, controls and images from image lists).
Sizes in pixels
Since this version, if TRVStyle.Units
= rvstuPixels, sizes are measured in logical pixels instead of physical screen pixels.
DPI of logical pixels is defined in TRVStyle.UnitsPixelsPerInch
property. By default, it is 96, so TRichView pixels are processed like HTML/CSS pixels in browsers. Usually, it makes no sense to change this property (unless you want to emulate the old mode of physical screen pixels; in this case, assign the screen DPI to this property).
Not only sizes measured in TRVStyleUnits
are affected by this property. Sizes of unscaled pictures, background images, TRichView margins are assumed to be measured in these logical pixels.
When displayed on the screen, these sizes are scaled from UnitsPixelsPerInch to the screen DPI (or DocumentPixelsPerInch, if it is defined).
Per monitor DPI awareness
In new versions of Delphi/C++Builder, our components support different monitors that may have different DPI (per monitor DPI awareness, Windows 10 feature).
A DPI of Delphi form can be changed simply by moving from one monitor to another monitor, if these monitors have different screen pixel density.
A complete and an ideal per monitor DPI awareness is implemented for Delphi and C++Builder 10.3 ("per monitor v2" mode).
Less advanced per monitor DPI awareness is implemented for Delphi and C++Builder 10.1 and 10.2.
Per monitor DPI awareness is implemented in all our editors and dialogs of RichViewActions.
Zooming in ScaleRichView
In older versions of ScaleRichView, zoom was counted relative to 96 DPI.
This means: if ZoomPercent = 100, one inch is equal to 96 screen pixels. As a result, 100% zoom was too small in High DPI display modes.
In the new version, zoom is counted relative to the screen DPI (or the current monitor DPI, for Delphi 10.1 and newer).
This change affects only zooming, it does not affect page content.
Controls in ScaleRichView
Previously, if the screen DPI <> 96, ScaleRichView did not support correct displaying of inserted controls (they were displayed too large).
ScaleRichView uses 96 DPI when calculating sizes of non-text objects.
What's why it always needs that inserted controls use 96 DPI, even if screen/monitor DPI is different.
In the new version, we solved this problem for RAD Studio 10.1 and newer.
If you use ScaleRichView with inserted controls in older versions of Delphi, unfortunately, you need to turn off DPI awareness of your application, it must always use 96 DPI.
SRVControls is a set of controls designed for insertion in ScaleRichView documents (buttons, check boxes, edit boxes, list boxes, etc.)
Since this version, they are DPI aware and support High DPI display modes.