Differences in text uniformity

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

Differences in text uniformity

Postby davem » Tue May 14, 2024 3:59 pm

Hi Support,

I have noticed a difference in the way 7.3 displays numbers (possibly text too) from our old 3.5 version. In 7.3 when I display these sample numbers, they are not uniformly presented as they are in 3.5.

The picture below shows the differences, 3.5 above and 7.3 below.

Image

Here's the sample code (in Progress ABL)
VPE 3.5
lv-vpe-hdl = chCtrlFrame:VPE.
lv-vpe-hdl:OpenDoc().
lv-vpe-hdl:ScalePercent = 100.
lv-vpe-hdl:WRITE(100,50,-1,-1, "1234567890").
lv-vpe-hdl:WRITE(100,100,-1,-1, "1000000000").
lv-vpe-hdl:WRITE(100,150,-1,-1, "10000").
lv-vpe-hdl:Preview().

VPE 7.3
lv-vpe-hdl = chCtrlFrame:VPE.
lv-vpe-hdl:OpenDoc().
lv-vpe-hdl:ScalePercent = 100.
lv-vpe-hdl:UnitTransformation = 1000.
lv-vpe-hdl:EngineRenderMode = 0.
lv-vpe-hdl:WRITE(100,50,-2147483549,-2147483549, "1234567890").
lv-vpe-hdl:WRITE(100,100,-2147483549,-2147483549, "1000000000").
lv-vpe-hdl:WRITE(100,150,-2147483549,-2147483549, "10000").
lv-vpe-hdl:Preview().

Kind Regards,
Dave
davem
 
Posts: 21
Joined: Fri Mar 24, 2006 12:52 pm

Re: Differences in text uniformity

Postby IDEAL Software Support » Fri May 17, 2024 6:31 am

VPE renders text and graphics internally on a virtual high resolution device (VHR) of several thousand DPI (dots per inch). That is, what gives VPE its name.

The screen, on the other hand, has a very low resolution of 96 DPI, which leads to rounding errors. When rendering text, since v4.0 VPE inserts gaps, so that the rightmost character is aligned to where it is on the VHR device. When you increase the preview's zoom level to 150% or 200%, you will notice that the gaps go away, because increasing the zoom level is the same as increasing the resolution of the output device.

Setting the v3 rendering mode just means that VPE uses the Windows API to compute the widths of single characters. To be able to run also on Linux and other platforms, VPE computes the widths of characters on its own since v4.0. This can lead to differences in text layout, line breaks and page breaks. For this reason we provided the option to use v3 rendering to provide compatibility with old documents regarding line and page breaks. We recommend to switch to v4 rendering when possible.

One question: why do you use -2147483549 instead of writing VFREE (or nFree for the ActiveX)? Using the constants increases the readability of source code a lot. No one knows what -2147483549 means.
IDEAL Software Support
 
Posts: 1625
Joined: Thu Nov 18, 2004 4:03 pm

Re: Differences in text uniformity

Postby davem » Fri May 17, 2024 10:27 am

The VPE 7.3 example specfies the version 3 render engine, should this not mean it renders as it would in version 3 i.e. without the gaps? If I select the version 4 rendering engine it looks the exact same.

lv-vpe-hdl = chCtrlFrame:VPE.

lv-vpe-hdl:OpenDoc().
lv-vpe-hdl:ScalePercent = 100.
lv-vpe-hdl:UnitTransformation = 1000.
lv-vpe-hdl:EngineRenderMode = {&VENGINE_RENDER_MODE_VER3}.

lv-vpe-hdl:WRITE(100,50, {&VFREE},{&VFREE}, "1234567890").
lv-vpe-hdl:WRITE(100,100,{&VFREE},{&VFREE}, "1000000000").
lv-vpe-hdl:WRITE(100,150,{&VFREE},{&VFREE}, "10000").
lv-vpe-hdl:Preview().
davem
 
Posts: 21
Joined: Fri Mar 24, 2006 12:52 pm

Re: Differences in text uniformity

Postby IDEAL Software Support » Fri May 17, 2024 12:44 pm

As I tried to explain, the gaps are anyway there since v4.0. The difference with the rendering modes is just the computation method for character widths.
IDEAL Software Support
 
Posts: 1625
Joined: Thu Nov 18, 2004 4:03 pm

Re: Differences in text uniformity

Postby davem » Fri May 17, 2024 3:24 pm

IDEAL Software Support wrote:As I tried to explain, the gaps are anyway there since v4.0. The difference with the rendering modes is just the computation method for character widths.


I get the explanation for character widths and why there is potentially a wider gap between characters, but I still don't understand why the zeros don't vertically match each other?

It's not a show stopper as when viewing the PDF export everything lines up, just curious.

Image

Kind Regards,
Dave
davem
 
Posts: 21
Joined: Fri Mar 24, 2006 12:52 pm

Re: Differences in text uniformity

Postby IDEAL Software Support » Fri May 17, 2024 5:27 pm

Because on the VHR device, the position of the rightmost character is more to the right than in the preview. And VPE compensates for this by inserting gaps to match the preview with the VHR device. Just set the zoom level to e.g. 300% and the gaps are also away in the preview.
IDEAL Software Support
 
Posts: 1625
Joined: Thu Nov 18, 2004 4:03 pm


Return to VPE Open Forum

Who is online

Users browsing this forum: Bing [Bot] and 6 guests