Bug Hunting Session
Bug 30731 - Cursor behaviour with Graphite fonts
Summary: Cursor behaviour with Graphite fonts
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: lowest minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Font-Rendering
  Show dependency treegraph
 
Reported: 2010-10-09 07:21 UTC by RGB
Modified: 2019-05-20 07:41 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Short screencast (97.45 KB, video/mp4)
2016-02-21 10:31 UTC, RGB
Details
Screencast updated to LibO 5.3 (123.56 KB, video/mp4)
2017-03-06 16:59 UTC, RGB
Details

Note You need to log in before you can comment on or make changes to this bug.
Description RGB 2010-10-09 07:21:20 UTC
Steps to reproduce the problem:
1- Install Linux Libertine G font from here: http://numbertext.org/linux/
2- Open a Writer document and type the following text

Some text \prime Some text fi more text

3- Modify the paragraph style to use the Linux Libertine G font with "tex mode" enablesd (on the font name box type: Linux Libertine G:texm=1)
"\prime" will change into ' and fi will be replaced with proper typographical ligature.
4- Put the cursor on the end of the paragraph and use the cursor arrows to go to the left one character at a time.

Actual result:
While the cursor behaviour is OK on the fi ligature (and this is an improvement respect OOo 3.2.x), when you arrive to the "prime" the cursor will jump to the right, possible going to the position where the text \prime should be if "tex mode" were not enabled.

This behaviour is confusing because the cursor jump to a text position, but if you press "back space" the text deleted is the one "hidden" by the Graphite replacement, not the one where cursor is shown.
Comment 1 martin_hosken 2011-02-17 19:34:32 UTC
This bug exemplifies a couple of problems.

Bug 34420 addresses most of the needs here. But there is also something wrong with the font. When creating ligatures it is necessary to associate the ligature with all (well the first and last) of the underlying glyphs. Thus a rule (taken from MagyarLinLibertineG) like:

unicode(0x005C) p("a") p("l") p("p") p("h") p("a") > _ _ _ _ _ unicode(0x03B1);

needs to become:

unicode(0x005C) p("a") p("l") p("p") p("h") p("a") > _ _ _ _ _ unicode(0x03B1):(1 6);

This then tells the engine that the whole string \alpha is associated with the one output glyph rather than saying that it is deleting \alph and associating the alpha with the final a only.

Bug 34420 removes the most egregious problems with not specifying appropriately, but doesn't solve everything.

In addition there is the issue that people don't really want to have to right arrow 6 times to get past the alpha, which the current cursor tracking algorithm, which is based on a purely codepoint based (UAX#29) model, requires.
Comment 2 Rainer Bielefeld Retired 2011-10-27 22:33:10 UTC
Modified Version due to report date.

@RGB:
Still a problem for you?
Comment 3 RGB 2011-10-28 17:01:52 UTC
(In reply to comment #2)
> @RGB:
> Still a problem for you?

Yes. Same behavior as described on initial entry with LibO 3.4.2.
Comment 4 Björn Michaelsen 2011-12-23 11:35:38 UTC Comment hidden (obsolete)
Comment 5 RGB 2011-12-23 16:53:26 UTC
The problem is present on 3.5 beta2.
Comment 6 martin_hosken 2012-01-03 20:19:19 UTC
did you fix the font?
Comment 7 QA Administrators 2014-06-25 17:38:02 UTC Comment hidden (obsolete)
Comment 8 QA Administrators 2014-10-23 17:32:23 UTC Comment hidden (obsolete)
Comment 9 Joel Madero 2014-12-15 01:23:38 UTC
I have verified this issue on:
Ubuntu 14.04 x64
LibreOffice 4.3.4.1 release

Changing priority according to flowchart: https://wiki.documentfoundation.org/images/0/06/Prioritizing_Bugs_Flowchart.jpg

Minor - can slow down professional quality work but won't prevent it.
Lowest - seems like this is really a corner case issue and the workaround is pretty straight forward (just push left a few more times).

@RGB - thanks for reporting and for your patience and understanding. Our team is powered by a group of volunteers who are giving thousands of hours at no cost to make LibreOffice better for everyone.
Comment 10 QA Administrators 2016-02-21 08:36:13 UTC Comment hidden (obsolete)
Comment 11 RGB 2016-02-21 10:11:06 UTC
On 5.1 the behaviour is different, but still not correct. Now, when by pressing the cursor arrow to the left you arrive to the "prime" character, the cursor remains on its position for six strokes before jumping to the other side, which is a bit confusing too. 

Try writing, on the same conditions as before (with textm=1) the following text

Text \prime more text \alpha and final text

and try to move the cursor one position at a time from the right. Now there is a confusing behaviour not only on the prime and alpha characters, but on the word "final" with the cursor remaining for two strokes on the "n" and then jumping the "fi" ligature on one step.

Tested on vanilla LibO 5.1.0.3 (64 bits) under openSUSE 13.2.
Comment 12 RGB 2016-02-21 10:31:47 UTC
Created attachment 122845 [details]
Short screencast

This is a short screencast that show the behaviour on LibO 5.1 (file is a mp4 video)
Comment 13 martin_hosken 2016-02-22 02:43:07 UTC
If my understanding of the internals of libo are correct, the cursor behaviour is not based on font rendering but on Unicode character properties. Thus, although graphite is being used to turn a long string of letters into a single glyph, the cursor movement is based purely on the underlying characters. This would happen whether the font were Graphite or OT based.

The key code seems to be in SwContentNode::GoNext (sw/core/docnode/node.cxx) and uses an ICU break iterator to control the cursor movement.

Basically, this isn't a graphite or graphite integration bug.
Comment 14 QA Administrators 2017-03-06 15:26:40 UTC Comment hidden (obsolete)
Comment 15 RGB 2017-03-06 16:59:55 UTC
Created attachment 131682 [details]
Screencast updated to LibO 5.3

Still present on 5.3. The behaviour is a bit different than what's shown on the previous screencast (now it's back to the originally reported behaviour), so I updated it.
Comment 16 QA Administrators 2018-05-18 02:33:24 UTC Comment hidden (obsolete)
Comment 17 RGB 2018-05-18 06:16:59 UTC
Problem still present 6.0.4.2. The behaviour can be seen not only with Graphite fonts, but with OpenType ones too. If you take a font with "alternate fractions", for example, like Sukhumala(1) and set the font as

Sukhumala:afrc

for the text "1/2" you'll see exactly the same behaviour when moving the cursor from right to left towards the fraction.

------
(1) http://www.softerviews.org/Fonts.html#Sukhumala
Comment 18 QA Administrators 2019-05-19 02:50:34 UTC Comment hidden (obsolete)
Comment 19 RGB 2019-05-19 11:56:46 UTC
Problem still present on 6.2.3.2. Comment 17 is still valid.
Comment 20 martin_hosken 2019-05-20 07:41:59 UTC
Almost certainly will never be fixed.