Bug 68573 - FORMATTING:Inconsistent underlining of text in different fonts (see comment 6)
Summary: FORMATTING:Inconsistent underlining of text in different fonts (see comment 6)
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: high normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 95713 102262 103508 105087 116627 (view as bug list)
Depends on: 58941
Blocks: RTL-CTL Font-Rendering
  Show dependency treegraph
 
Reported: 2013-08-26 12:54 UTC by Abdulaziz Ayed
Modified: 2023-09-28 14:22 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:


Attachments
screenshot (22.90 KB, image/png)
2013-08-26 12:56 UTC, Abdulaziz Ayed
Details
TestDocument (13.97 KB, application/vnd.oasis.opendocument.presentation)
2013-08-26 12:57 UTC, Abdulaziz Ayed
Details
ODPs and screenshots showing underlining of various characters/fonts under v3304 and v4132. (82.90 KB, application/zip)
2013-12-21 12:08 UTC, Owen Genat (retired)
Details
Screenshot (16.12 KB, image/png)
2023-09-26 10:00 UTC, Heiko Tietze
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Abdulaziz Ayed 2013-08-26 12:54:49 UTC
There is a problem when you write in slide with mixed characters (RTL+LTR)
with underlined fonts.
I think the reason is height of font and also because of (especially in impress)
the text node. as I thought, every group of characters of same language was taken as text node so it has own underline. so, when you write mixed characters that means every group of characters from one language  will represent text node with its underline. all that with a reason of different hieght.

I hope I am right with this thought.
Comment 1 Abdulaziz Ayed 2013-08-26 12:56:40 UTC
Created attachment 84648 [details]
screenshot
Comment 2 Abdulaziz Ayed 2013-08-26 12:57:14 UTC
Created attachment 84649 [details]
TestDocument
Comment 3 Owen Genat (retired) 2013-12-21 12:08:04 UTC
Created attachment 91081 [details]
ODPs and screenshots showing underlining of various characters/fonts under v3304 and v4132.

I am not sure this is a bug or if it can be fixed in LO as it would appear to be a font metric related issue. The provided example had the Arabic text set in DejaVu Sans and the English text set in Abyssinica SIL. I don't have the second font installed so the underline displayed identically for both pieces of text (refer screenshot).

I have created two additional examples under Ubuntu 10.04 x86_64 using:

- v3.3.0.4 OOO330m19 Build: 6
- v4.1.3.2 Build ID: 70feb7d99726f064edab4605a8ab840c50ec57a

... each with Latin, Cyrillic, Greek, Hindi, Chinese, Japanese, Hebrew, and Arabic characters. The v3.3.0.4 example uses these fonts:

- Arial for Latin, Cyrillic, and Greek.
- Lohit Hindi for Hindi, Hebrew, and Arabic.
- SimSun for Chinese and Japanese.

The v4.1.3.2 example uses the same fonts except:

- Linux Libertine G for Latin, Cyrillic, and Greek.

A screenshot of what I see here in each case is included. In both examples the same fonts render the underline uniformly, irrespective of characters.
Comment 4 Owen Genat (retired) 2013-12-21 12:18:15 UTC
Component set to Presentation. As per comment #3 Version set to Inherited From OOo.
Comment 5 Owen Genat (retired) 2013-12-21 12:23:09 UTC
Adding Khaled Hosny to CC list, to hopefully provide some insight into whether this is an issue LO can fix or not (and get this bug confirmed if it is possible to fix).
Comment 6 ⁨خالد حسني⁩ 2013-12-21 22:18:47 UTC
Currently the position and thickness of underline, overlines etc. is font dependant as LibreOffice computes it from font metrics (though fonts can specify some of those values, we don’t use it, but this is a different issue). So when different fonts are used, you can end up with different line position and thickness.

I’m not sure how this can be fixed since there is probably some good reasons to make this font dependant, but I guess one way is to make this configurable so the user can override it, like we do with superscript size and position, for example.
Comment 7 V Stuart Foote 2015-11-10 00:04:37 UTC
*** Bug 95713 has been marked as a duplicate of this bug. ***
Comment 8 QA Administrators 2017-01-03 19:35:48 UTC Comment hidden (obsolete)
Comment 9 V Stuart Foote 2017-01-05 00:39:23 UTC
*** Bug 105087 has been marked as a duplicate of this bug. ***
Comment 10 V Stuart Foote 2017-01-05 00:41:39 UTC
*** Bug 102262 has been marked as a duplicate of this bug. ***
Comment 11 V Stuart Foote 2017-01-05 00:54:53 UTC
*** Bug 103508 has been marked as a duplicate of this bug. ***
Comment 12 V Stuart Foote 2018-03-26 16:45:55 UTC
*** Bug 116627 has been marked as a duplicate of this bug. ***
Comment 13 QA Administrators 2019-03-27 03:41:23 UTC Comment hidden (obsolete)
Comment 14 V Stuart Foote 2019-03-27 12:36:10 UTC
Remains an issue. Different underline placement, intra paragraph, follows font and language used--should be calculated to common baseline per paragraph, or possibly make use of the underline font metric, when specified, in individual fonts.
Comment 15 QA Administrators 2022-03-11 03:52:14 UTC Comment hidden (obsolete)
Comment 16 Eyal Rozenberg 2023-09-24 20:21:21 UTC
So, there are several potential problems with the underlining of adjacent characters:

1. Inconsistency of stroke width
2. Inconsistency of vertical positioning of the underline
3. Horizontal discontinuity

Problems (1.) and (2.) do indeed still happen, and as Khaled explained that is as was intended in the implementation; problem (3.) is a bit more elusive, but I do believe I'm seeing it with one of the documents in the zip file. Please help me confirm that aspect.

Now, about Khaled's comment:

(In reply to ⁨خالد حسني⁩ from comment #6)
> I’m not sure how this can be fixed since there is probably some good reasons
> to make this font dependant 

Yes, but font-dependent does not have to mean ignorant of other text on the same line / same stretch of underlined text. For example, we can take the maximum width, the minimum width, or the average; and height-wise, it would probably make sense to choose the lowest vertical position and use that consistently.

This should emulate what how real person would draw an underline (or overline etc.) when faced with text in different fonts. They would definitely not draw multiple disjoint line segments.

Then you may not even need configuration for this. (But I won't say no to configurability of underlining.)


That being said - one can argue that text in different fonts should perhaps not be underlined at all, since when handwriting, you don't switch fonts in the middle of a line.
Comment 17 Eyal Rozenberg 2023-09-24 20:22:52 UTC
Oh, and - we should not forget that an inappropriate choice of underline v-position and width can intersect the diacritics, which in some languages and with some fonts can make them unintelligible or simply hide them from view. And that is also a problem.
Comment 18 Heiko Tietze 2023-09-26 10:00:23 UTC
Created attachment 189828 [details]
Screenshot

Screenshot redone with "Noto Sans Arabic" and "Source Code Pro", two fonts on my system.

I don't see how we can find a position below the font baseline, smaller than the descender height, not overwriting some important decoration.
Comment 19 Heiko Tietze 2023-09-27 07:24:18 UTC
In Writer, the text is drawn as expected for normal paragraphs but not using a text box. Changing the Text-to-text alignment has no effect in the text box and is always reset to Automatic. Seems as if this attribute is not implemented.

I suggest to change the summary.
Comment 20 Heiko Tietze 2023-09-27 07:24:29 UTC
*** Bug 118035 has been marked as a duplicate of this bug. ***
Comment 21 ⁨خالد حسني⁩ 2023-09-28 14:22:02 UTC
(In reply to Heiko Tietze from comment #19)
> In Writer, the text is drawn as expected for normal paragraphs but not using
> a text box. Changing the Text-to-text alignment has no effect in the text
> box and is always reset to Automatic. Seems as if this attribute is not
> implemented.
> 
> I suggest to change the summary.

This suggests that Writer does something that Edit Engine (used in other modules as well as Writer’s text boxes) doesn’t, so the next challenge is to find what Writer does exactly and implement it in Edit Engine.