Bug 30731 - Cursor jumps around when moving through some ligatures
Cursor jumps around when moving through some ligatures
 Status: RESOLVED FIXED None LibreOffice Unclassified LibreOffice (show other bugs) Inherited From OOo All All medium minor خالد حسني target:7.5.0 inReleaseNotes:7.5 (view as bug list) Font-Rendering Show dependency tree / graph

 Reported: 2010-10-09 07:21 UTC by RGB 2022-12-04 14:52 UTC (History) 4 users (show) jmadero.dev khaled martin_hosken vaaydayaasra

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
Screencast comparing the cursor movement of ligated with unligated text (704.26 KB, video/quicktime)
2022-08-26 02:29 UTC, خالد حسني
Details
Screencast of cursor movement with my patches applied (2.22 MB, video/quicktime)
2022-08-30 07:53 UTC, خالد حسني
Details

 Note You need to log in before you can comment on or make changes to this bug.
 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. 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. Rainer Bielefeld Retired 2011-10-27 22:33:10 UTC Modified Version due to report date. @RGB: Still a problem for you? 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. Björn Michaelsen 2011-12-23 11:35:38 UTC Comment hidden (noise) [This is an automated message.] This bug was filed before the changes to Bugzilla on 2011-10-16. Thus it started right out as NEW without ever being explicitly confirmed. The bug is changed to state NEEDINFO for this reason. To move this bug from NEEDINFO back to NEW please check if the bug still persists with the 3.5.0 beta1 or beta2 prereleases. Details on how to test the 3.5.0 beta1 can be found at: http://wiki.documentfoundation.org/QA/BugHunting_Session_3.5.0.-1 more detail on this bulk operation: http://nabble.documentfoundation.org/RFC-Operation-Spamzilla-tp3607474p3607474.html RGB 2011-12-23 16:53:26 UTC The problem is present on 3.5 beta2. martin_hosken 2012-01-03 20:19:19 UTC did you fix the font? QA Administrators 2014-06-25 17:38:02 UTC Comment hidden (noise) Please read this message in its entirety before responding. Your bug was confirmed at least 1 year ago and has not had any activity on it for over a year. Your bug is still set to NEW which means that it is open and confirmed. It would be nice to have the bug confirmed on a newer version than the version reported in the original report to know that the bug is still present -- sometimes a bug is inadvertently fixed over time and just never closed. If you have time please do the following: 1) Test to see if the bug is still present on a currently supported version of LibreOffice (preferably 4.2 or newer). 2) If it is present please leave a comment telling us what version of LibreOffice and your operating system. 3) If it is NOT present please set the bug to RESOLVED-WORKSFORME and leave a short comment telling us your version and Operating System Please DO NOT 1) Update the version field 2) Reply via email (please reply directly on the bug tracker) 3) Set the bug to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LibreOffice is powered by a team of volunteers, every bug is confirmed (triaged) by human beings who mostly give their time for free. We invite you to join our triaging by checking out this link: https://wiki.documentfoundation.org/QA/BugTriage There are also other ways to get involved including with marketing, UX, documentation, and of course developing - http://www.libreoffice.org/get-help/mailing-lists/. Lastly, good bug reports help tremendously in making the process go smoother, please always provide reproducible steps (even if it seems easy) and attach any and all relevant material QA Administrators 2014-10-23 17:32:23 UTC Comment hidden (noise) Please read this message in its entirety before responding. Your bug was confirmed at least 1 year ago and has not had any activity on it for over a year. Your bug is still set to NEW which means that it is open and confirmed. It would be nice to have the bug confirmed on a newer version than the version reported in the original report to know that the bug is still present -- sometimes a bug is inadvertently fixed over time and just never closed. If you have time please do the following: 1) Test to see if the bug is still present on a currently supported version of LibreOffice (preferably 4.2 or newer). 2) If it is present please leave a comment telling us what version of LibreOffice and your operating system. 3) If it is NOT present please set the bug to RESOLVED-WORKSFORME and leave a short comment telling us your version and Operating System Please DO NOT 1) Update the version field 2) Reply via email (please reply directly on the bug tracker) 3) Set the bug to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LibreOffice is powered by a team of volunteers, every bug is confirmed (triaged) by human beings who mostly give their time for free. We invite you to join our triaging by checking out this link: https://wiki.documentfoundation.org/QA/BugTriage There are also other ways to get involved including with marketing, UX, documentation, and of course developing - http://www.libreoffice.org/get-help/mailing-lists/. Lastly, good bug reports help tremendously in making the process go smoother, please always provide reproducible steps (even if it seems easy) and attach any and all relevant material 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. QA Administrators 2016-02-21 08:36:13 UTC Comment hidden (noise) ** Please read this message in its entirety before responding ** To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present on a currently supported version of LibreOffice (5.0.5 or 5.1.0) https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the version of LibreOffice and your operating system, and any changes you see in the bug behavior If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a short comment that includes your version of LibreOffice and Operating System Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) http://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to "inherited from OOo"; 4b. If the bug was not present in 3.3 - add "regression" to keyword Feel free to come ask questions or to say hello in our QA chat: http://webchat.freenode.net/?channels=libreoffice-qa Thank you for your help! -- The LibreOffice QA Team This NEW Message was generated on: 2016-02-21 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. 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) 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. QA Administrators 2017-03-06 15:26:40 UTC Comment hidden (noise) ** Please read this message in its entirety before responding ** To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present on a currently supported version of LibreOffice (5.2.5 or 5.3.0 https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the version of LibreOffice and your operating system, and any changes you see in the bug behavior If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a short comment that includes your version of LibreOffice and Operating System Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) http://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to "inherited from OOo"; 4b. If the bug was not present in 3.3 - add "regression" to keyword Feel free to come ask questions or to say hello in our QA chat: http://webchat.freenode.net/?channels=libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug-20170306 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. QA Administrators 2018-05-18 02:33:24 UTC Comment hidden (noise) ** Please read this message in its entirety before responding ** To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the information from Help - About LibreOffice. If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice. Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from http://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to 'inherited from OOo'; 4b. If the bug was not present in 3.3 - add 'regression' to keyword Feel free to come ask questions or to say hello in our QA chat: https://kiwiirc.com/nextclient/irc.freenode.net/#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug 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 QA Administrators 2019-05-19 02:50:34 UTC Comment hidden (noise) Dear RGB, To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the information from Help - About LibreOffice. If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice. Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from http://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to 'inherited from OOo'; 4b. If the bug was not present in 3.3 - add 'regression' to keyword Feel free to come ask questions or to say hello in our QA chat: https://kiwiirc.com/nextclient/irc.freenode.net/#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug RGB 2019-05-19 11:56:46 UTC Problem still present on 6.2.3.2. Comment 17 is still valid. martin_hosken 2019-05-20 07:41:59 UTC Comment hidden (no-value) Almost certainly will never be fixed. QA Administrators 2021-05-20 04:34:21 UTC Comment hidden (noise) Dear RGB, To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the information from Help - About LibreOffice. If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice. Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to 'inherited from OOo'; 4b. If the bug was not present in 3.3 - add 'regression' to keyword Feel free to come ask questions or to say hello in our QA chat: https://kiwiirc.com/nextclient/irc.freenode.net/#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug RGB 2021-05-20 19:38:34 UTC Problem still present on 7.1.3.2. Comment 17 is still valid. خالد حسني 2022-08-26 02:29:28 UTC Created attachment 182033 [details] Screencast comparing the cursor movement of ligated with unligated text I believe the problem is that LibreOffice (or writer) is measuring the text width in chunks to determine the cursor position, e.g. in the string “office” for the cursor at “o|ffice” it will measure the width of “o” to position the cursor, and in “of|fice” it will measure the width of “of” and so on. For ligatures where the width of the partial text is close enough to the with of the ligature component, things appear to work, but in the problematic cases here the difference is way off that the cursor appears to be jumping. See the cursor movement in the attached screencast and compare the cursor position when it jumps with the unligated text below it, the cursor jumps to exactly where the unligated glyph is. خالد حسني 2022-08-26 15:20:40 UTC (In reply to خالد حسني from comment #23) > Created attachment 182033 [details] > Screencast comparing the cursor movement of ligated with unligated text > > I believe the problem is that LibreOffice (or writer) is measuring the text > width in chunks to determine the cursor position, e.g. in the string > “office” for the cursor at “o|ffice” it will measure the width of “o” to > position the cursor, and in “of|fice” it will measure the width of “of” and > so on. For ligatures where the width of the partial text is close enough to > the with of the ligature component, things appear to work, but in the > problematic cases here the difference is way off that the cursor appears to > be jumping. > > See the cursor movement in the attached screencast and compare the cursor > position when it jumps with the unligated text below it, the cursor jumps to > exactly where the unligated glyph is. I can confirm this is exactly what is happening, and here a quick patch: diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 146122841e7c..8389c39f54e3 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -1608,8 +1608,9 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf ) if( !GetScrFont()->IsSameInstance( rInf.GetOut().GetFont() ) ) rInf.GetOut().SetFont( *m_pScrFont ); + sal_Int32 nLength(rInf.GetText().getLength() - sal_Int32(rInf.GetIdx())); GetTextArray(*m_pPrinter, rInf.GetText(), aKernArray, - sal_Int32(rInf.GetIdx()), sal_Int32(nLn)); + sal_Int32(rInf.GetIdx()), nLength); } else { With this patch, the cursor no longer jumps, but it won’t “enter” the ligature either (i.e. it will remain at the end of the ligature for the number of letters in the ligature). We can improve this, but I’m not sure what this code is used also for and this change is certainly wrong in other situations. Now I need someone who is familiar with these parts of Writer to guide me in untangling all of this. خالد حسني 2022-08-26 21:55:04 UTC WIP: https://gerrit.libreoffice.org/c/core/+/138889 خالد حسني 2022-08-30 07:53:19 UTC Created attachment 182087 [details] Screencast of cursor movement with my patches applied Here is the current status: 1. Ligatures are detected and the width of the glyph is evenly distributed over the number of grapheme clusters that make up the ligature. This works nicely for “real” ligatures, but a bit awkward for Linux Libertine G’s text replacement disguised as ligatures. But we can’t distinguish between the two, and we want this behavior for most ligatures. 2. If the font has OpenType ligature caret information, we will use it for more fine grained caret placement inside the ligature. Commit Notification 2022-08-31 06:30:19 UTC Khaled Hosny committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/8cb4db941f91cc234dd18c61f8b1e51f65360d1f tdf#30731: Improve caret travelling in Writer It will be available in 7.5.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. Commit Notification 2022-08-31 06:47:34 UTC Khaled Hosny committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/bdbbdc9b931d35f6d7d816512ac5be599295dc80 tdf#30731: Use ligature caret positions from the font It will be available in 7.5.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. خالد حسني 2022-10-02 10:08:09 UTC *** Bug 119347 has been marked as a duplicate of this bug. ***