Page 1 of 1

TRichView 19.4 - printing for FireMonkey

Posted: Sun Aug 29, 2021 4:16 pm
by Sergey Tkachenko
TRichView is updated to version 19.4.

The new release includes the second version for FireMonkey (still Windows platform only).

Trial versions are available: https://www.trichview.com/download/
A full version can be found in the protected section of this forum (or old setups can check for updates and download new versions).

New in this update (in FireMonkey version):
  • printing and print preview
  • justify alignment
  • zooming
  • IME input (for East Asian languages)
Previous version:
https://www.trichview.com/forums/viewto ... =6&t=10501

Printing for FireMonkey

Posted: Sun Aug 29, 2021 4:27 pm
by Sergey Tkachenko
Printing for FireMonkey

The following components are ported to FireMonkey in this update:
TRVPrint - component for printing TRichView document
TRVReportHelper - component for drawing TRichView document on the specified canvas (for example, in TBitmap or a printer)
TRVPrintPreview - print preview component.

In FireMonkey, TRVPrintPreview is the most tricky component, because screen and printer may use different canvas types (In Windows, it is Direct2D canvas on the screen, and GDI+ canvas for printing). TRVPrintPreview must be able to use the both canvases.
printpreview-firemonkey.png
printpreview-firemonkey.png (45.92 KiB) Viewed 50049 times
Instead of Color property, FireMonkey version of TRVPrintPreview has Fill: TBrush property, so you can apply a gradient or a textured fill. Page shadow may use a semitransparent color.

Justify alignment

Posted: Sun Aug 29, 2021 4:35 pm
by Sergey Tkachenko
Justify alignment

In additional to left, right and center alignments, this update adds "justify" alignment: the text is aligned to the both sides by increasing width of space characters.
Internally, TRichView implements this type of alignment using two completely different algorithms: an universal algorithm (used by GDI+ canvas) and optimized Direct2D algorithm.

The both of them support bi-directional text.

PS: "distributed" alignment (aligning text to the both sides by increasing intercharacter spacing) is still not implemented in FMX, only in VCL and LCL version.

Zooming

Posted: Sun Aug 29, 2021 4:44 pm
by Sergey Tkachenko
Zooming

In VCL/LCL version, document can be zoomed by specifying the pixel density for drawing in DocumentPixelsPerInch property.

In FireMonkey version, a similar functionality is implemented by ZoomPercent property. By default, it is equal to 100 (meaning 100% zoom). To zoom in/out, assign a new value to this property and call Reformat (or Format).



The example shows how multiresolutional images from TImageList work in TRichView for FireMonkey.
Let we have a TImageList that includes several versions of the same picture for different resolutions:
imagelist.png
imagelist.png (12.88 KiB) Viewed 50061 times
Let we insert 16x16 picture:
zoom100.png
zoom100.png (7.84 KiB) Viewed 50061 times

Now let's zoom to 200%:
zoom200.png
zoom200.png (9.84 KiB) Viewed 50061 times
As you can see, 32x32 image is used instead of 16x16 image.

How this picture is printed? Let we have 600 dpi printer. 16x16 image will be printed as 100x100. The component chooses the most appropriate available image (64x64) and scales it to 100x100:
printpreview-imagelist.png
printpreview-imagelist.png (9.29 KiB) Viewed 50061 times

IME

Posted: Sun Aug 29, 2021 4:49 pm
by Sergey Tkachenko
IME

An input method (or input method editor, commonly abbreviated IME) allows the user of Latin keyboards to input Chinese, Japanese, Korean and Indic character, as well as special characters like emoticons.

Since this update, FireMonkey version supports IME:
ime.png
ime.png (39.89 KiB) Viewed 50060 times

Demo projects

Posted: Sun Aug 29, 2021 4:56 pm
by Sergey Tkachenko
Demo projects

The following changes were made in demo projects for FireMonkey:

1) Editors\Editor 2\ demo has additional functionality:
- print and print preview
- button to apply "justify" aligmnent
- combo box to apply zoom (bottom right corner of the demo)

printpreview.png
printpreview.png (80.96 KiB) Viewed 50060 times

2) Editors\Notes\ - editor with footnotes and endnotes

3) Assorted\Graphic\ToImage\ shows how to use TRVReportHelper components to make an image from document.

toimage.png
toimage.png (20.75 KiB) Viewed 50060 times

4) Assorted\Printing\Printing\ shows how to print and displays a print preview. The printed document contains images and FMX controls.

5) Assorted\Printing\Headers\ shows how to print a document containing headers and footers (up to 3 headers/footers: for the first page, even pages, other pages)

6) Assorted\Printing\ReportHelper\ shows how to use TRVReportHelper component for printing (to print in one or two columns)

UI translations

Posted: Sun Aug 29, 2021 5:02 pm
by Sergey Tkachenko
The following translation of UI was updated for RichViewActions and ScaleRichView:
  • Thai