Bug 124123 - Character spacing problems with Dymo LabelWriter in Best print quality
Summary: Character spacing problems with Dymo LabelWriter in Best print quality
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
(earliest affected) release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Print
  Show dependency treegraph
Reported: 2019-03-16 19:39 UTC by jasonkres
Modified: 2022-08-22 23:38 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:
Regression By:

scan of printouts (787.40 KB, image/png)
2019-03-16 19:40 UTC, jasonkres
files for repro procedure (126.82 KB, application/x-zip-compressed)
2019-03-16 19:43 UTC, jasonkres

Note You need to log in before you can comment on or make changes to this bug.
Description jasonkres 2019-03-16 19:39:25 UTC
The Dymo LabelWriter printer has character spacing issues when set to its "best" printing quality. Some of these issues are regressions. Of the versions available in the "old" download archive, I have narrowed down the regression to between (good) and (bad). This may have to do with the fact that the dots in this resolution are rectangular (dpiX != dpiY).

The Dymo LabelWriter 450 series is a popular line of thermal label printers. These devices support two print qualities: 300x300 dpi (Normal - "Text Only") and 300x600 dpi (Best - "Barcodes and Graphics") (The print head contains 300 elements per inch; it varies the line feed to adjust the dpi perpendicular to the print head.) A rendering program is attached if you want to test *without* having the printer (using the driver to output the printer control codes to the FILE: port).

Steps to Reproduce:
The form for this test is "30258 Diskette" (landscape: 2.75" x 2.13"). (There is also a file attached for "30252 Address" (landscape 3.50" x 1.10"), in case you actually have the printer and that common label size, though only one of the three test cases fits.)
This test will use landscape orientation as that is most commonly used for labels.
In this orientation, the DPI is 600 dpi on the long axis and 300 dpi on the short axis.
But note that the affected areas are not corrected by printing in portrait orientation; actually the spacing is worse in portrait.

1. Download printer driver package "Dymo Connect for Desktop v1.0.1" from http://www.dymo.com/en-US/dymo-user-guides ( http://download.dymo.com/dymo/Software/Win/DCDSetup1.0.1.exe ).
2. Run DCDSetup1.0.1.exe.
3. After this is installed, Settings > Devices > Printers > Add a Printer or Scanner > The printer I want isn't listed
3.a. Choose Add a local printer. Next.
3.b. Choose Use an existing port FILE: (Print to file). Next.
3.c. Choose Manufacturer "Dymo". Next.
3.d. The actual printer that I have used and have also tested the C# program with is "DYMO LabelWriter 450 Twin Turbo". That being said, this probably reproduces on any of the 450 models (and maybe others). Select that printer model. Next.
3.e. Accept the printer name. Next.
3.f. Do not share this printer. Next.
3.g. Finish.
4. Compile the attached C# program dymo2png.cs into dymo2png.exe using the compiler that comes with Windows.
   cd C:\location_of_cs_file
   C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe /nologo /d:DEBUG,TRACE /debug+ /optimize- dymo2png.cs
5. Open the attached Writer document: DymoLabel30258Diskette.odt
6. File > Print. 
6.a. Select printer: DYMO LabelWriter 450 Twin Turbo
6.b. Click Properties.
6.c. Layout > Landscape
6.d. Paper/Quality > Best
6.e. Click Advanced.
6.f. Set Paper Size to 30258 Diskette.
6.g. Click OK to both dialogs.
6.h. Note that preview will be have many issues (regardless of the version), but the printed output will actually be much better than the preview indicates.
6.i. Click OK.
6.j. You will be prompted to enter a filename to receive the output. For example, dymo.prn in the same directory as dymo2png.exe. Click Save.
7. Convert the printer output to a dot-for-dot PNG:
   cd C:\location_of_file
   .\dymo2png.exe dymo.prn dymo.png
8. Open dymo.png in a graphics program.
8.a. You can resize the image by the scale factors 200% x 100% to adjust for the rectangular dots to get an image representative of the printed output at this resolution. (The dots parallel with the print head are physically twice the size because that axis is half resolution.)
8.b. This is a landscape printing, so you can rotate it CCW 90 degrees for better viewing.

Actual Results:
A scan of the actual hardcopy is attached. The PNG file produced by the above procedure prior to the image manipulation steps is also attached.

Expected Results:
Correct rendering in 300x600 dpi.

Reproducible: Always

User Profile Reset: No

Additional Info:
The regressions to (1) are likely the most problematic in practice because they affect ordinary text on the page. The actual end user case that prompted this involves an automated merge and print from Calc into Writer.
The kerning was not acceptable to the user, and there were also problems with barcode printing. The 300x600 mode can be especially useful for barcode fonts (notice that the Best mode is called "Barcodes and Graphics" in the printer Advanced Properties). Barcodes that are too small to scan when printed in 300x300 may be usable in 300x600 IF there is correct printing. Barcodes that were usable in old versions of Writer did not work for scanning in newer versions due to incorrect rendering of the barcode font ("Free 3 of 9" font 18 pt).

Here is some potentially useful information from the Windows DEVMODE structure and GetDeviceCaps API. My analysis is that these metrics reported by the driver ARE CORRECT.

Here is for a diskette label (landscape: 2.75" x 2.13")

dmFormName      =  30258 Diskette
dmOrientation   =    2 (DMORIENT_LANDSCAPE)

PHYSICALWIDTH   = 1650 pixels
PHYSICALHEIGHT  =  638 pixels
HORZRES         = 1482 pixels
VERTRES         =  609 pixels
HORZSIZE        =   63 mm
VERTSIZE        =   52 mm
LOGPIXELSX      =  600 dpi
LOGPIXELSY      =  300 dpi

Here is for a standard address label (landscape: 3.50" x 1.10")

dmFormName      =  30252 Address
dmOrientation   =    2 (DMORIENT_LANDSCAPE)

PHYSICALWIDTH   = 2100 pixels
PHYSICALHEIGHT  =  329 pixels
HORZRES         = 1926 pixels
VERTRES         =  299 pixels
HORZSIZE        =   82 mm
VERTSIZE        =   25 mm
LOGPIXELSX      =  600 dpi
LOGPIXELSY      =  300 dpi

The technical manual describing these printers is: http://download.dymo.com/dymo/technical-data-sheets/LW%20450%20Series%20Technical%20Reference.pdf

Please do not hesitate to ask if there are any questions. Thank you.

Version: (x64)
Build ID: f4ca1573fcf445164c068c1046ab5d084e1b005f
CPU Threads: 4; OS Version: Windows 6.19; UI Render: GL; 
Locale: en-US (en_US); Calc: CL

Version: (x64)
Build ID: 690f553ecb3efd19143acbf01f3af4e289e94536
CPU Threads: 4; OS Version: Windows 6.19; UI Render: GL; Layout Engine: new; 
Locale: en-US (en_US); Calc: CL

Version: (x64)
Build ID: 7bcb35dc3024a62dea0caee87020152d1ee96e71
CPU threads: 4; OS: Windows 10.0; UI render: GL; VCL: win; 
Locale: en-US (en_US); UI-Language: en-US
Calc: CL
Comment 1 jasonkres 2019-03-16 19:40:30 UTC
Created attachment 150016 [details]
scan of printouts
Comment 2 jasonkres 2019-03-16 19:43:34 UTC
Created attachment 150017 [details]
files for repro procedure
Comment 3 Xisco Faulí 2019-11-21 13:07:10 UTC
A new major release of LibreOffice is available since this bug was reported.
Could you please try to reproduce it with the latest version of LibreOffice
from https://www.libreoffice.org/download/libreoffice-fresh/ ?
I have set the bug's status to 'NEEDINFO'. Please change it back to
'UNCONFIRMED' if the bug is still present in the latest version.
Comment 4 jasonkres 2020-02-28 23:37:18 UTC
This bug continues to reproduce in latest.
Tested using the actual printer. Output still looks like shown in the "scan of printouts" attachment.

Version tested:

Version: (x64)
Build ID: 4d224e95b98b138af42a64d84056446d09082932
CPU threads: 12; OS: Windows 10.0 Build 18363; UI render: GL; VCL: win; 
Locale: en-US (en_US); UI-Language: en-US
Calc: CL
Comment 5 jasonkres 2020-02-29 18:49:04 UTC
See also bug 131037 for a probably related but easy reproduce problem with the Microsoft Fax printer driver included with Windows. That printer has a 200x100 dpi resolution.
Comment 6 Buovjaga 2020-05-10 09:47:00 UTC
As this requires "exotic" hardware, it would be great, if you attempted to bibisect this:

Grab the bibisect-win32-5.3 repo as per your analysis
Comment 7 jasonkres 2020-09-13 01:29:54 UTC
Adding Keywords: bibisected
Adding Cc: to @Khaled

I have bibisected. As suspected, bug 131037 has identical.
 5e01bd2a91a717cdaccff18de7c44de37b270914 is the first bad commit
commit 5e01bd2a91a717cdaccff18de7c44de37b270914
Author: Norbert Thiebaud <nthiebaud@gmail.com>
Date:   Wed Nov 2 17:34:31 2016 -0700

    source sha:8f2dd1df1d6cc94ebbc1149de72bc6d6dffa6533

    source sha:8f2dd1df1d6cc94ebbc1149de72bc6d6dffa6533

 instdir/program/vcllo.dll   | Bin 7222784 -> 7222784 bytes
 instdir/program/version.ini |   2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)

# bad: [a374222bc87bd9e75ea2f1ca45d189932a1967f8] source sha:aa09fd58bd499a2a2c3a32c5f613892bad54076c
# good: [defb73f1c6e2a66dbd21ba89e684f57427e8bc4b] source sha:5b168b3fa568e48e795234dc5fa454bf24c9805e
git bisect start 'master' 'oldest'
# good: [0b4408f0568ad1da0797543c0ee2955c386267ee] source sha:8f7886c742cae5e012e52029c20925aa7b0fb6ea
git bisect good 0b4408f0568ad1da0797543c0ee2955c386267ee
# good: [f8b90d89a8a858c3e0ce171f82ecb20b3ea80098] source sha:75239b77139434db9be5e0e7e133e3661c5404b0
git bisect good f8b90d89a8a858c3e0ce171f82ecb20b3ea80098
# bad: [7a279eab384549b23a159352c7308486555e0401] source sha:5e416099f088a2f8a8980e08e3d5b731da0a6d9c
git bisect bad 7a279eab384549b23a159352c7308486555e0401
# good: [a3f5fe1a4c6eabca0604654b0f9cb40ad59f8bf8] source sha:4814650c5021b72c81b4079f712a4c1baae0088b
git bisect good a3f5fe1a4c6eabca0604654b0f9cb40ad59f8bf8
# bad: [85bd972b6810fbdafee6bcf049da287516187e3e] source sha:4e59168ef004e7520ea7d78237a18208216a757c
git bisect bad 85bd972b6810fbdafee6bcf049da287516187e3e
# good: [e96edc165025e2e2a94d32febad5f2c80f036673] source sha:c3a3b876a3a2a739b266622f51a00016a81b0cdf
git bisect good e96edc165025e2e2a94d32febad5f2c80f036673
# bad: [ea7807c5201f6d6874f5cf0323419563ec9fd09a] source sha:00e48a2ea00e973ae6e29950ca7c6846cfeabff4
git bisect bad ea7807c5201f6d6874f5cf0323419563ec9fd09a
# bad: [677e5c844d1350435d8ba69334acf088c5b1c5b4] source sha:2b3de550ef1e28cd4231352c91634f67aa6d642f
git bisect bad 677e5c844d1350435d8ba69334acf088c5b1c5b4
# good: [9a9f5bda6a82eadc6befbd1f5fa2e95173617cb0] source sha:01875c4514c777a43ee18014d9b0cb3f34eebbba
git bisect good 9a9f5bda6a82eadc6befbd1f5fa2e95173617cb0
# good: [c9058d690bed30c47c654beb7f58bff6fb45534a] source sha:30e2171b6eac8e373e31f20de4a0cee6d5d64a08
git bisect good c9058d690bed30c47c654beb7f58bff6fb45534a
# good: [a0dc71f49cc0766556e03cbf844c1b3fb59fe6be] source sha:c8be45889217c555e4bec92af838d0524ceba4e0
git bisect good a0dc71f49cc0766556e03cbf844c1b3fb59fe6be
# bad: [a87553199f1d343477ac1ef44183cbf6510c54b5] source sha:fdc77804d681ea36b8dd257d7a8669a99e1dbb98
git bisect bad a87553199f1d343477ac1ef44183cbf6510c54b5
# bad: [5e01bd2a91a717cdaccff18de7c44de37b270914] source sha:8f2dd1df1d6cc94ebbc1149de72bc6d6dffa6533
git bisect bad 5e01bd2a91a717cdaccff18de7c44de37b270914
# first bad commit: [5e01bd2a91a717cdaccff18de7c44de37b270914] source sha:8f2dd1df1d6cc94ebbc1149de72bc6d6dffa6533

commit 8f2dd1df1d6cc94ebbc1149de72bc6d6dffa6533
Author: Khaled Hosny <khaledhosny@eglug.org>
Date:   Wed Nov 2 23:52:06 2016 +0200

    Revert "Revert "Enable the new text layout engine by default""

    This reverts commit 3950166877bf1308f9e449992e20b558342af825.

    Change-Id: Ie22a99885a23d44a9870fcd286bee4ccf10c53ac
    Reviewed-on: https://gerrit.libreoffice.org/30505
    Tested-by: Jenkins <ci@libreoffice.org>
    Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>