TRichView 17.3 - all-Unicode

News about TRichView, ScaleRichView, ReportWorkshop, RVMedia
Post Reply
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

TRichView 17.3 - all-Unicode

Post by Sergey Tkachenko »

We uploaded new versions of our text editing and reporting components: TRichView 17.3, ScaleRichView 8.2, Report Workshop 1.8.
There are no known bugs, all demo projects are checked and work correctly. However, internal changes are too global, so we decided to release this update as a beta.

Download links for registered users are posted in the registered section of this forum. To get access, send me a private message or email to richviewgmailcom.

Update 2018-May-15: beta download links are removed, because TRichView 17.4 is uploaded.

Previous version:
https://www.trichview.com/forums/viewto ... f=6&t=8951
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: TRichView 17.3 - all-Unicode

Post by Sergey Tkachenko »

Unicode strings

The main change in this update: all strings are changed to TRVUnicodeString, where it is possible.
TRVUnicodeString is defined as WideString for old versions of Delphi (Delphi 5-2007) and UnicodeString for new versions of Delphi (2009-10.2 Tokyo)

This change has many benefits for users of old versions of Delphi. Now they have Unicode spelling check interface, Unicode object properties, can use Unicode file names for saving and loading (for Delphi 6 and newer).
However, this change is useful in new versions as well:
- names of non-text items were ANSI string in previous version, now they are Unicode
- you can be sure that all text in the editor is Unicode
- no need to work with raw byte strings

Unfortunately, this change breaks compatibility. In existing projects, you need to change types of string parameters of events to TRVUnicodeString.
TRVUnicodeString is defined in RVTypes unit.

The main goal of this change is simplifying porting to other development frameworks.

UTF-16

Delphi strings (UnicodeString and WideString) have UTF-16 encoding, so they can contain Unicode characters having codes greater than $FFFF. They are represented as two WideChars. They are called a surrogate pair.
Previously, such characters were not processed correctly. In this version, they are completely supported.

Typing Unicode characters

You can type a hexadecimal code in the editor and press Alt+X; this code will be converted to Unicode character. Press Alt+X again to convert it back to its code. For example, you can type 1F43B, press Alt+X, and it will be converted to 🐻 (your browser may convert this character to emoji icon; TRichView does not do it)
More exactly, when you press Alt+X, TRichViewEdit checks characters to the left of the caret (or selected characters, if there is a selection). If they can be interpreted as a hexadecimal number, TRichViewEdit converts it to a character. If not, it converts the last character to its hexadecimal code.

Additionally, you can hold Alt key and type a decimal character code on the numpad, starting from '0'. Release Alt, and Unicode character will be inserted. Normally, in this way, Windows allows entering a character from the current code page, not a Unicode character. But MS Word inputs a Unicode character, and we decided to do it too.

Export of symbol text

This version improves conversion of symbol characters to Unicode. This conversion is happen when TRichView content is exported to HTML or plain Unicode text: symbol characters are exported as the most similar Unicode characters. In the previous version, this conversion was supported for "Symbol" font and partially for "Wingdings". In this version, this conversion is supported for "Symbol", "Wingdings", "Wingdings 2", "Wingdings 3", "Webdings" fonts.
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: TRichView 17.3 - all-Unicode

Post by Sergey Tkachenko »

New "Insert Symbol" dialog in RichViewActions

TrvActionInsertSymbol implements a command for inserting a character chosen by the user.
In this version, a dialog box displayed by this action is reworked.
InsertSymbol.png
InsertSymbol.png (54.2 KiB) Viewed 38718 times
It supports ALL Unicode characters, even with code greater than $FFFF (see the character code at the bottom left corner of the screenshot)
Characters are organized in groups by Unicode blocks; a new version of the dialog supports all blocks defined in the latest Unicode standard (about 300).
Unicode blocks are organized in 22 categories, so it's much more simple to find what you need.
The dialog provides special support for symbol fonts (the new version of the dialog inserts characters of the symbol charset only in the correct way, using the codes from the "private use" block).

You can type a hexadecimal character code (UTF-32 code), click "Go to character", and the dialog shows this character and its Unicode block.

You can select a character and click "Next font >" button, and the dialog shows the next font containing this character. If the current font is a symbol font, it displays the next symbol font. This is a very useful tool, because some characters may exist only in one or two fonts.

The dialog no longer tries to display characters that do not exist in the font (the previous version does it, and sometimes Windows displays substitutions from another font).
A typical task: finding which fonts contain a specific character, choose the most appropriate of them, and insert in the editor.
Steps:
1) show the symbol insertion dialog (the menu Insert | Symbol)
2) Select any non-Symbol font in the font list (for symbol fonts, the combo boxes for choosing Unicode blocks are disabled, and all characters are visible in the grid, so the grid does not have a scroll bar)
3) Type a hexadecimal character code (you can find codes here: www.fileformat.info or here: http://www.unicode.org/charts/ )
4) Click the "Go to character" button. The character will be displayed in the grid; but, probably, the initial font does not have this character, so the selected grid cell will be empty.
5) Click the "Next font" button to find a font containing this character.
6) Click this button again to fint the next font, and so on.
7) Click "Insert" to insert the chosen character in the target editor.
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: TRichView 17.3 - all-Unicode

Post by Sergey Tkachenko »

Other changes

Reading merge fields from RTF (Rich Text Format) files

A new event is added to TRichView: OnReadMergeField. This event happens when a merge field is loaded from RTF, and allows to change a tag or a visible text of content belonging to a field.
This event is called for each text or picture found in RTF in a merge field result, so it works completely correct when this result is a plain text or a single picture. I believe this approach covers 90% of needs.

Reading graphics from RVF (RichView Format) files

Since this version, it's not necessary to register third-party graphic classes to load graphic from RVF.
If the graphic class specified in RVF cannot be found (because it is not available or unregistered), TRichView determines a graphic format by content and uses the default graphic class for this format. Default graphic classes may be changed using RVGraphicHandler.
TRichView can detect bitmaps, metafiles, icons, gif, jpeg, png, and tiff files.

Moreover, graphic class names specified in RVF can be completely ignored, if rvfoIgnoreGraphicClasses is included in RichView.RVFOptions

Optimization

Some operations are optimized, including: editing text near tables, displaying text boxes, footnotes, endnotes and sidenotes in ScaleRichView, spelling check using HunSpell
Post Reply