Bug 107614 - Chinese characters are wrongly aligned if 'vpal' feature enabled
Summary: Chinese characters are wrongly aligned if 'vpal' feature enabled
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
5.3.2.1 rc
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Vertical-Text
  Show dependency treegraph
 
Reported: 2017-05-04 07:34 UTC by Volga
Modified: 2022-09-06 06:13 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Test file (9.56 KB, application/vnd.oasis.opendocument.text)
2017-05-04 07:51 UTC, Volga
Details
Screenshot (3.28 KB, image/png)
2017-05-04 07:53 UTC, Volga
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Volga 2017-05-04 07:34:31 UTC
Description:
If I used Source Han Serif in LibreOffice, when I enabled 'vpal' feature in vertical text, Chinese characters are wrongly aligned.

Steps to Reproduce:
1. Insert a frame interactively with vertical text direction
2. Input 公元二一三年、十一月
3. Input font name with vpal feature enabled: 思源宋体:vpal=1

Actual Results:  
When vpal feature enabled, 一 (U+4E00) looks shifted to the bottom as my attached image.

Expected Results:
When vpal feature enabled for Source Han Serif font, 一 should be centered as the following screenshot:
http://www.typeisbeautiful.com/wp-content/uploads/2017/04/SHSPropMetrics.png



Reproducible: Always

User Profile Reset: No

Additional Info:
Version: 5.3.3.1 (x64)
Build ID: 46360c72c4823cefeaa85af537fba22bd568da7e
CPU Threads: 4; OS Version: Windows 6.19; UI Render: default; Layout Engine: new; 
Locale: zh-CN (zh_CN); Calc: group

Source Han Serif is available from GitHub:
https://github.com/adobe-fonts/source-han-serif/tree/release
Or get from a mirror from Tsinghua University:
https://mirrors.tuna.tsinghua.edu.cn/adobe-fonts/
For more detailes about SHS, please see:
https://github.com/adobe-fonts/source-han-serif/blob/release/SourceHanSerifReadMe.pdf


User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0
Comment 1 Volga 2017-05-04 07:51:19 UTC
Created attachment 133057 [details]
Test file
Comment 2 Volga 2017-05-04 07:53:56 UTC
Created attachment 133058 [details]
Screenshot
Comment 3 Volga 2017-05-04 08:07:14 UTC
(In reply to Volga from comment #0)
> When vpal feature enabled for Source Han Serif font, 一 should be centered as
> the following screenshot:
> http://www.typeisbeautiful.com/wp-content/uploads/2017/04/SHSPropMetrics.png
This screenshot is published by Type is Beautiful (TIB), According to TIB, this is taken from Adobe Illustrator, this feature is known as Proportional Metrics. See:
http://www.typeisbeautiful.com/2017/04/11961/zh-hant/
Comment 4 Buovjaga 2017-05-07 11:44:11 UTC
Please give the exact filename of the font to install.
I downloaded the nearly 2GB font pack, but I don't want to blindly install all of them to confirm this.
https://github.com/adobe-fonts/source-han-serif/releases
Comment 5 Volga 2017-05-07 17:55:17 UTC
(In reply to Buovjaga from comment #4)
> Please give the exact filename of the font to install.
> I downloaded the nearly 2GB font pack, but I don't want to blindly install
> all of them to confirm this.
> https://github.com/adobe-fonts/source-han-serif/releases

https://mirrors.tuna.tsinghua.edu.cn/adobe-fonts/source-han-serif/OTC/
Comment 6 Buovjaga 2017-05-07 18:05:23 UTC
(In reply to Volga from comment #5)
> (In reply to Buovjaga from comment #4)
> > Please give the exact filename of the font to install.
> > I downloaded the nearly 2GB font pack, but I don't want to blindly install
> > all of them to confirm this.
> > https://github.com/adobe-fonts/source-han-serif/releases
> 
> https://mirrors.tuna.tsinghua.edu.cn/adobe-fonts/source-han-serif/OTC/

That's a directory. I want the filename. I already tried Regular before I asked.
Comment 7 Volga 2017-05-09 04:45:10 UTC
(In reply to Buovjaga from comment #6)
> (In reply to Volga from comment #5)
> > (In reply to Buovjaga from comment #4)
> > > Please give the exact filename of the font to install.
> > > I downloaded the nearly 2GB font pack, but I don't want to blindly install
> > > all of them to confirm this.
> > > https://github.com/adobe-fonts/source-han-serif/releases
> > 
> > https://mirrors.tuna.tsinghua.edu.cn/adobe-fonts/source-han-serif/OTC/
> 
> That's a directory. I want the filename. I already tried Regular before I
> asked.

I justed tested SourceHanSerif-Regular.ttc, the font name should be Source Han Serif SC in English locale. See Source Han Serif Read Me section OpenType Particulars.
Comment 8 Buovjaga 2017-05-12 14:03:11 UTC
Step 1 details: in the Frame properties, tab Options - Text direction: Left-to-right (Vertical)

思源宋体:vpal=1 gives me a substituted font. Using Source Han Serif SC:vpal=1 I can see the problem.

Arch Linux 64-bit, KDE Plasma 5
Version: 5.4.0.0.alpha1+
Build ID: 8891472e1f9c5e452a4e8d55241eeba118274092
CPU threads: 8; OS: Linux 4.10; UI render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group
Built on May 12th 2016
Comment 9 Volga 2017-06-19 01:49:14 UTC
GitHub also have an issue for this.
https://github.com/behdad/harfbuzz/issues/485
According to GitHub this is due to HarfBuzz lacks support for 'vpal' table, which is similar to vhea/vmtx tables used for TTF fonts.
Comment 10 QA Administrators 2018-06-20 02:48:22 UTC Comment hidden (obsolete)
Comment 11 Volga 2018-11-06 00:36:10 UTC
HarfBuzz got bug fix since 2.1.0.
Comment 12 QA Administrators 2021-08-19 03:43:36 UTC Comment hidden (obsolete)
Comment 13 Julien Nabet 2022-03-04 21:00:24 UTC
Volga: if it's fixed in Harfbuzz 2.1.1, it should be ok now since 2.3.1 has been in 7.1 and 7.2
Just for the record, 3.2.2 is present on master.

Could you give a try to a recent LO version? (7.2.5 or 7.3.0)
Comment 14 Julien Nabet 2022-03-04 21:10:40 UTC
Just for the record, I'm wondering if it's actually implemented in Harfbuzz.
Indeed, first I searched vpal in Harfbuzz code, I didn't find it except these in Harfbuzz Changelog:
commit 89a2bc9ba674e7e57fec1fd8ce7648a44f3aab63
Author: Behdad Esfahbod <behdad@behdad.org>
Date:   Tue May 31 15:18:13 2011 -0400

    [Vertical] Apply vertical features

    We apply all of vert, vrt2, vkrn, valt, and vpal.

commit d71c0df2d17f4590d5611239577a6cb532c26528
Author: Behdad Esfahbod <behdad@behdad.org>
Date:   Fri Aug 9 09:28:32 2013 -0400

    Remove vrt2, vkrn, vpal, and valt from default vertical features

    See thread by John Dagget on the list.

then I saw this:
https://lists.freedesktop.org/archives/harfbuzz/2013-August/003490.html
Comment 15 Buovjaga 2022-03-04 21:22:38 UTC
(In reply to Julien Nabet from comment #13)
> Volga: if it's fixed in Harfbuzz 2.1.1, it should be ok now since 2.3.1 has
> been in 7.1 and 7.2
> Just for the record, 3.2.2 is present on master.
> 
> Could you give a try to a recent LO version? (7.2.5 or 7.3.0)

There was no known fix in Harfbuzz 2.1.x, but testing would be good.

In https://github.com/harfbuzz/harfbuzz/issues/485 there is a comment from the reporter in 2019:
"After I got HarfBuzz 2.2.0, the problem is still there. So what’s wrong with it?"

Behdad closed Mark Hung's PR a bit over 2 weeks ago (!) https://github.com/harfbuzz/harfbuzz/pull/619 saying:
"I don't think this is correct. Our vertical support should be correct already."
Comment 16 QA Administrators 2022-09-01 03:49:12 UTC Comment hidden (obsolete)
Comment 17 Volga 2022-09-06 03:13:51 UTC
The vertical text looks good now on LO 7.4

Version: 7.4.0.3 (x86) / LibreOffice Community
Build ID: f85e47c08ddd19c015c0114a68350214f7066f5a
CPU threads: 4; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: Skia/Raster; VCL: win
Locale: zh-CN (zh_CN); UI: zh-CN
Calc: threaded