Bug 115321 - Vertical Japanese text lines with emphasis mark above in odt exported to PDF is shown a quarter font height lower than the normal lines, and no emphasis mark is shown
Summary: Vertical Japanese text lines with emphasis mark above in odt exported to PDF ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
Version:
(earliest affected)
6.1.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: ⁨خالد حسني⁩
URL:
Whiteboard: target:7.6.0 target:7.5.3 target:24.2...
Keywords:
Depends on:
Blocks: CJK Vertical-Text
  Show dependency treegraph
 
Reported: 2018-01-31 01:18 UTC by himajin100000
Modified: 2023-06-20 17:44 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
odt file to be exported (5.50 MB, application/vnd.oasis.opendocument.text)
2018-01-31 01:20 UTC, himajin100000
Details
result (23.63 KB, application/pdf)
2018-01-31 01:20 UTC, himajin100000
Details
results in dd3c7051 (34.96 KB, application/pdf)
2023-03-19 21:13 UTC, himajin100000
Details

Note You need to log in before you can comment on or make changes to this bug.
Description himajin100000 2018-01-31 01:18:43 UTC
Description:
Open the attached odt
Export To PDF(the result is attached)

the attached pdf is exported version of the attached odt but uncompressed by:
qpdf --stream-data=uncompress in.pdf out.pdf

all the characters in the odt is in 20pt

When you open that pdf in text editor(Of course you can open it in hex editor, if you don't mind unreadability from not caring newlines),

you will see the following lines
BT
1 0 0 1 575.3 824.1 Tm /F1 20 Tf<01>Tj
1 0 0 1 575.3 804.1 Tm<02>Tj
1 0 0 1 575.3 784.1 Tm<03>Tj
1 0 0 1 575.3 764.1 Tm<04>Tj
1 0 0 1 575.3 744.1 Tm<05>Tj
1 0 0 1 575.3 724 Tm<06>Tj
1 0 0 1 575.3 704 Tm<07>Tj
1 0 0 1 575.3 684 Tm<08>Tj
1 0 0 1 575.3 663.9 Tm<09>Tj
ET

and

BT
1 0 0 1 550.3 819.1 Tm /F1 20 Tf<01>Tj
1 0 0 1 550.3 799.1 Tm<02>Tj
1 0 0 1 550.3 779.1 Tm<03>Tj
1 0 0 1 550.3 759.1 Tm<04>Tj
1 0 0 1 550.3 739 Tm<05>Tj
1 0 0 1 550.3 719 Tm<06>Tj
1 0 0 1 550.3 698.9 Tm<07>Tj
1 0 0 1 550.3 678.9 Tm<08>Tj
1 0 0 1 550.3 658.9 Tm<09>Tj
ET

so the differences in y-value of the matching positions in two lines are

824.1 - 819.1 = 5
804.1 - 799.1 = 5
784.1 - 779.1 = 5

all the same: 5 , *which should be 0 instead.*

emphasis mark is seemingly not exported to PDF

Differences between the adjacent characters in the same line, such as 824.1 - 804.1 were the same as the font size: 20

these relationship did not change when I set 12pt for the characters.

differences in matching positions was all 3, and the differences in the same line were the font size:12

from I've seen, I guess this is coming from this thing-y.
https://opengrok.libreoffice.org/xref/core/vcl/source/outdev/font.cxx?r=55f07d4d#1094

Expected result should have emphasis mark on the right side of the characters instead of top side. But possibly export to pdf does not consider this, and emphasis marks to be shown were somehow clipped?

Steps to Reproduce:
Open the attached odt
Export To PDF
see description

Actual Results:  
see description

Expected Results:
see description


Reproducible: Always


User Profile Reset: No



Additional Info:


User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0
Comment 1 himajin100000 2018-01-31 01:20:15 UTC
Created attachment 139455 [details]
odt file to be exported
Comment 2 himajin100000 2018-01-31 01:20:42 UTC
Created attachment 139456 [details]
result
Comment 3 Buovjaga 2018-02-20 09:45:42 UTC
Repro

Arch Linux 64-bit
Version: 6.1.0.0.alpha0+
Build ID: c902cbc7dc5294ab721a9aef3a152aa243d00011
CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group
Built on February 17th 2018
Comment 4 himajin100000 2018-02-22 00:22:40 UTC
recently, I was trying printf debugging, after reading

https://wiki.documentfoundation.org/Development/How_to_debug#Macros_Controlling_Debug_Code

to the following code,

https://opengrok.libreoffice.org/xref/core/sw/source/core/text/itrtxt.cxx?r=f55a9b77#280

I add some lines of code. (I'm too lazy to learn how to use diff command line.)
==================================
if( GetInfo().GetTextFrame()->IsVertLR() ){
    nOfst += rLine.Height() - ( rLine.Height() - nPorHeight ) / 2 - nPorAscent;
}else{
    SAL_INFO("vcl",nOfst);
    nOfst += ( rLine.Height() - nPorHeight ) / 2 + nPorAscent;
    SAL_INFO("vcl",rLine.Height());
    SAL_INFO("vcl",nPorHeight);
    SAL_INFO("vcl",nPorAscent);
    SAL_INFO("vcl",nOfst);
}

break;
==================================
When the line is WITHOUT emphasis mark, the result was:

info:vcl:9980:5152:sw/source/core/text/itrtxt.cxx:287: 0
info:vcl:9980:5152:sw/source/core/text/itrtxt.cxx:289: 401
info:vcl:9980:5152:sw/source/core/text/itrtxt.cxx:290: 401
info:vcl:9980:5152:sw/source/core/text/itrtxt.cxx:291: 346
info:vcl:9980:5152:sw/source/core/text/itrtxt.cxx:292: 346

while WITH emphasis mark on all characters in a line

info:vcl:9980:5152:sw/source/core/text/itrtxt.cxx:287: 0
info:vcl:9980:5152:sw/source/core/text/itrtxt.cxx:289: 499
info:vcl:9980:5152:sw/source/core/text/itrtxt.cxx:290: 499
info:vcl:9980:5152:sw/source/core/text/itrtxt.cxx:291: 444
info:vcl:9980:5152:sw/source/core/text/itrtxt.cxx:292: 444
===================================
for the following code

https://opengrok.libreoffice.org/xref/core/sw/source/core/text/itrpaint.cxx?r=180f2860#303

I tried

if ( bAdjustBaseLine ){
    GetInfo().Y( GetInfo().GetPos().Y() + AdjustBaseLine( *m_pCurr, pPor ) );
    SAL_INFO("vcl",GetInfo().Y());
    if ( pPor->Width() && pPor->InTextGrp() )
         pEndTempl = pPor;
    }
}

WITHOUT emphasis mark: 630
WITH emphasis mark: 728.

========================
additional note to my previous post(just to make sure):
I used IPA fonts downloadable from https://ipafont.ipa.go.jp/old/ipaexfont/download.html for the attachments. Values here may not be the same when different fonts (with different metrics) are used.
Comment 5 QA Administrators 2019-11-16 03:41:57 UTC Comment hidden (noise, obsolete)
Comment 6 jun meguro 2020-03-23 11:00:13 UTC
Still reproducted on LO6.4.2 and 6.3.5

Version: 6.4.2.2
Build ID: 4e471d8c02c9c90f512f7f9ead8875b57fcb1ec3
CPU threads: 8; OS: Linux 5.3; UI render: default; VCL: gtk3; 
Locale: ja-JP (ja_JP.UTF-8); UI-Language: en-US
Calc: threaded

Version: 6.3.5.2
Build ID: dd0751754f11728f69b42ee2af66670068624673
CPU threads: 8; OS: Linux 5.3; UI render: default; VCL: gtk3; 
Locale: ja-JP (ja_JP.UTF-8); UI-Language: en-US
Calc: threaded
Comment 7 QA Administrators 2022-03-24 03:41:18 UTC Comment hidden (noise, obsolete)
Comment 8 Commit Notification 2023-03-13 13:11:15 UTC
Mark Hung committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/f88bb22cc3cbbc35abf72ec0ce1a4c0bb60ee88c

tdf#115321, tdf#139065 render emphasismark for pdf export.

It will be available in 7.6.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2023-03-13 19:24:10 UTC
Mark Hung committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/f32f7d0d34cb4fcc5acd94cdf91cbd7b2f7f98ab

tdf#115321, tdf#139065 render emphasismark for pdf export.

It will be available in 7.5.3.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 himajin100000 2023-03-19 21:13:59 UTC
Created attachment 186085 [details]
results in dd3c7051

Now,

1. the base text is correctly placed. 
2. emphasis mark is visible.
3. the emphasis mark positions are 1-char height lower than expected.
Comment 11 ⁨خالد حسني⁩ 2023-06-19 20:58:48 UTC
*** Bug 131751 has been marked as a duplicate of this bug. ***
Comment 12 Commit Notification 2023-06-20 16:32:52 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/e0a461466846f64a39868ac921d4b9e1636f5e26

tdf#115321: Fix PDF position of emphasis mark in vertical text

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 Commit Notification 2023-06-20 17:44:04 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/8d70a1a1a7ab2448332790e194ba643fe13c642b

tdf#115321: Fix PDF position of emphasis mark in vertical text

It will be available in 7.6.0.0.beta2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.