Description: LibreOffice doesn't handle the "hang" baseline OpenType property, documented on https://www.microsoft.com/typography/otspec/baselinetags.htm This feature is necessary to typeset Tibetan correctly: when using different sizes, the letters should be vertically aligned on the upper stroke. See the attachments for an example. Steps to Reproduce: 1. type Tibetan text 2. change font size of a part of the text 3. experience sadness and disappointment Actual Results: see self-explanatory attached image Expected Results: see self-explanatory attached image Reproducible: Always User Profile Reset: No Additional Info: User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0
Created attachment 129945 [details] image showing good/wrong result
Created attachment 129946 [details] document with fonts showing the problem
Note that the attachments show that with a baseline at 0, there is no experience of the problem (hang is ignored, but LibreOffice seems to align things correctly. But not all Tibetan fonts have a baseline at 0, NotoSansTibetan doesn't for instance. NotoSansTibetan doesn't use the "hang" feature, I've reported the bug on https://github.com/googlei18n/noto-fonts/issues/814
Created attachment 129954 [details] screenshot On pc Debian x86-64 with master sources updated tody, I could reproduce this. But the result is slightly different. Khaled: thought you might be interested in this one.
Adding Khaled Hosny for advice
It is a valid enhancement request, but I don’t know if it is practical or not. There does not seem to be many applications that support BASE table (I couldn’t find any actually, though I remember vaguely reading somewhere that some Adobe products support “ideo” tag but not any other tag) and the spec (https://www.microsoft.com/typography/otspec/base.htm) does not seem to be well defined (as usual with OpenType). Taking the 3B example from the spec and trying to apply it to the case here (assuming purely Tibetan text for the sake of simplicity); the hanging baseline is 1500 and assuming a font with 1000 UPEM that would be 15pt for 10pt text. All good so far, but the main use case here is text with different font sizes, so from which font size do we get the baseline value and based on what criteria? Taking it from each font size separately means we will end up with different values and the original issue is still unfixed. Now added different scripts on the same line to the mix and things get wildly. The spec talks about the “dominant run” where everything is relative to it, but nowhere it defines it. Someone needs to figure this out and come with clear spec or at least some other application that can be checked against in order to be able to implement this.
Thanks for your input Khaled, I agree that the behavior should be defined more consensually for this to be implemented. I have some contacts at the Dzongkha Development Commission (DDC) I can ask about what they think the most natural result would be, but none at Microsoft or Adobe... Do you think you could indicate me some persons to talk to about this issue? (maybe in a private mail? you can find my address on https://github.com/eroux/) Thank you!
I don’t have any personal contacts, but you might get some luck asking on the OpenType mailing list (https://www.microsoft.com/typography/otspec/otlist.htm).
Thanks! I'll do that and keep you informed
Khaled, before I send it to the OpenType list (my subscription is pending), would you have a few moments to tell me what you think of https://github.com/eroux/otf-base-hang-tibt/blob/master/proposed-algorithm.md ?
Created attachment 131129 [details] NotoSansTibetan with hang BASE feature added Modified version of NotoSansTibetan including the BASE table. An fea version of the included BASE table is: table BASE { HorizAxis.BaseTagList hang; HorizAxis.BaseScriptList DFLT hang 1389, tibt hang 1389; } BASE;
I've just received a message from Office Consumer Service stating: " Microsoft currently supports 7 baseline tags, including "hang". " I'll try to find a way to test.
Commenting the new "Blocks #89870" tag: I don't really understand why this bug would block anything related to Harfbuzz use, there's no code to support the BASE table in LO, independently of the Layout Engine. A few updates: Apple products (Page, etc.) are supposed to handle the BASE table as well as the 'bsln' feature for a long time, but it seems that the implementation is buggy, there is an internal Apple bug report to fix it. (no idea of the delay) To support the BASE table in LO, the BASE table must first be exposed by Harfbuzz, it's not the case yet, but see https://github.com/behdad/harfbuzz/issues/418
*** Bug 106527 has been marked as a duplicate of this bug. ***
This baseline is also needed for drop caps styled layout for Devanagari, Gurmukhi and similar. According W3C documentation Indic Layout Requirements, this baseline should making drop initial letters aligned with first line. If we get this support we should also improve drop layout for such scripts. https://w3c.github.io/ilreq/#h_typical_drop_initial_usage_in_indic_scripts
Here is a simple sample of the behavior of aligning text with Alphabetic baseline and hanging baseline, especially if we get implementation based on 'BASE' table. http://tavmjong.free.fr/blog/wp-content/uploads/SYDNEY_2016/AlignIntroB-2FS.gif This is found at Inkscape Planet.
This baseline can be used for aligning drop initials for several Indic scripts as Devanagari, Bengali, Gujarati and similar. The W3C Working Draft Indic Layout Requirements has instruction for such usage. If we get support for 'BASE' table, we can making implementation based on this. https://www.w3.org/TR/ilreq/#h_initial_letter_styling
The usage of Tibetan hanging baseline can be found at https://www.unicode.org/wg2/docs/n4851-TangutAdditions.pdf page 11.
HarfBuzz repository received a pull request recently: https://github.com/harfbuzz/harfbuzz/pull/838 So we can waiting for new release to get support. but we need to know which new APIs added before we can make use of.
It’s coming in HB 1.7.6.
Well, although it's really great news, I wouldn't be so optimistic: the review of the code to read the BASE table is not finished yet, and nothing is exposed to the public yet. The way to access the BASE feature needs to be through an API, and there is no API yet, not even any clue about what it will be. I think there will be at least a few month before a first draft of an API... and not much one can do in the mean time...
OK, so we waiting for new version if HarfBuzz get complete support.
(In reply to Volga from comment #20) > It’s coming in HB 1.7.6. Harfbuzz 1.7.6 was released on 2018-03-07. https://github.com/harfbuzz/harfbuzz/releases So what is happening with this issue?
I'm not sure what wasn't clear in my previous comment, but here an attempt to clarify what the next steps are for this issue: 1. wait for harfbuzz to expose an API to get the BASE data for a font, in my experience that will probably take a few months, maybe a few years (not because it's complex, because it's super low priority) 2. use this new API to create some code to handle the BASE feature in LO
Sorry, an additional comment to make it crystal clear: currently (even in the latest release or git version), harbuzz reads the BASE table, but doesn't provide an API to provide the data. These are two different things. Harbuzz 1.7.6 does *not* provide the API that is needed for this issue to be worked on on the LO side.
Now we can focus on the following issue for this, HarfBuzz developers will bring desired APIs for baseline. https://github.com/harfbuzz/harfbuzz/issues/1345
HarfBuzz is already got support in 2.1.1. https://github.com/harfbuzz/harfbuzz/commit/b8a78ce201608e9ac6d7f77447b2bbef6f09e9ff
(In reply to Elie Roux from comment #13) > To support the BASE table in LO, the BASE table must first be exposed by > Harfbuzz, it's not the case yet, but see > > https://github.com/behdad/harfbuzz/issues/418 This is fixed, so we are able to fix if HarfBuzz released a new version.
It’s coming now in HarfBuzz version 2.6.0, so we can gain basic support for this, i.e. implament basic text alignment with BASE table, additionaly, we can add support for advanced control of this table, at least we can create new API set into LibreOffice BASIC to make use of the table.
Mark Hung committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/5f92e8cf3da6b5f66b6ef23219fcc91d2ad7c754 tdf#104930 Implement TextMetric::GetHangingBaseline. It will be available in 7.4.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.
Mark Hung committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/fb8eb0ad9c3a5957a6e131490a7a8c97e5353ba2 tdf#104930 aligning CTL text with hanging baseline. It will be available in 7.4.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.