Description: With File/Export/tick the selection mark you can export the selection to JPG or PNG. The dialog allows to change the width/height of the JPG/PNG generated. If one cell content is a string with partly modified font or style (e.g. Bold) the text in the exported JPG is misaligned. see https://ask.libreoffice.org/t/libreoffice-calc-jpeg-export-text-is-misaligned/115285/9 tested on 24.2.5.2 Windows 10 Steps to Reproduce: 1.Select cells A1:C2 in the attached calc 2.Export / tick selection, select .jpg / do not modify dimensions 3.Export / tick selection, select .jpg / modify dimensions, e.g. by multiplying with 10 Actual Results: Both generated jpgs differ. In the 10x jpg a text is misaligned Expected Results: Both jpgs should be identical, just have different dimensions Reproducible: Always User Profile Reset: No Additional Info: the attached calc contains Basic code to simplify testing. The problem occurs both when exporting through the UI and through Basic, however
Created attachment 198238 [details] Export of Cells A1:C2 shows the problem. Macro to export multiple resolution
Created attachment 198239 [details] Export without changing resolution
Created attachment 198240 [details] Export with 10x resolution
Everything fine with Version: 24.8.4.1 (X86_64) / LibreOffice Community Build ID: 1be9007f5d86a3741c366527d13e2970cbeef057 CPU threads: 4; OS: Linux 6.8; UI render: default; VCL: gtk3 Locale: ro-RO (ro_RO.UTF-8); UI: en-US Calc: threaded Before runing the macro I inserted 10 in all 4 cells in Calc.
I just updated to 24.8.4.2 and I can reconfirm the bug. @BogdanB: As stated in my description, the bug occurs when "one cell content is a string with partly modified font or style". In the attached calc, that was the case. If you insert "10" in the cells without sume font modification of substrings of course you cannot observe the bug.
Created attachment 198244 [details] video testing the bug See my testing, you need to download the video, if not working in the browser.
@BogdanB: I can reproduce the behavior shown in your video on my computer. You mistakingly modified "resolution" in the export dialog. This switch is basically useless, you will see that both jpgs you generated have the same width/height. The problem I have observed occurs when modifying "dimension" in the export dialog. Please doublecheck that. For convenience you can also run the basic macro
Confirm with Version: 24.8.3.2 (X86_64) / LibreOffice Community Build ID: 48a6bac9e7e268aeb4c3483fcf825c94556d9f92 CPU threads: 16; OS: Linux 6.8; UI render: default; VCL: gtk3 Locale: ro-RO (ro_RO.UTF-8); UI: en-US Calc: threaded
Code pointer: The normal cell text painting happens in ScOutputData::LayoutStrings calling OutputDevice::DrawText [1]. The "editengine" (formatted) text painting happens in ScOutputData::DrawEdit calling ScOutputData::DrawEditStandard calling EditEngine::Draw [2]. To debug this, likely the outputdevice's preparation (setting its map mode) must be tracked in both cases. [1] https://opengrok.libreoffice.org/xref/core/sc/source/ui/view/output2.cxx?r=5166efaa&mo=54167&fi=1490#2202 [2] https://opengrok.libreoffice.org/xref/core/sc/source/ui/view/output2.cxx?r=5166efaa&mo=54167&fi=1490#3308