View Issue Details

IDProjectCategoryView StatusLast Update
0017286ScribusStory Editor / Text Framespublic2024-10-13 22:42
Reporternitramr Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
PlatformDesktop PCOSUbuntuOS Version24.04 64-bit
Product Version1.6.3.svn 
Summary0017286: Text selection highlight has render issues
Description1. Selecting ligatures
If you only select the first part of a ligature, you have an offset for the selection field. See image ligature_issue.png.
The attached patch fixes this problem.

2. Selecting different font sizes
If you have different font sizes in a line and select all characters, the selection does not adjust to the larger characters. This only happens if the line starts with smaller characters.
I could not fix the problem.
Steps To ReproduceLigature selection
1. Create a text box
2. Select the text box and select a font with ligature, like Cormorant Garamond (free font at Google Fonts)
3. Turn on ligature in Font Features
4. Write some text like ffi
5. Select only on character of the ligature

Font Sizes
1. Create a text box
2. Write a couple of letters
3. increase the font size of the last characters
4. start selection on left
TagsNo tags attached.
PatchYes

Activities

nitramr

2024-10-08 20:04

developer  

fontsize_issue.png (18,485 bytes)   
fontsize_issue.png (18,485 bytes)   
ligature_fixed.png (4,771 bytes)   
ligature_fixed.png (4,771 bytes)   
ligature_issue.png (3,434 bytes)   
ligature_issue.png (3,434 bytes)   
ligatureselection_2024-10-08_01.patch (689 bytes)   
Index: scribus/text/boxes.cpp
===================================================================
--- scribus/text/boxes.cpp	(Revision 26313)
+++ scribus/text/boxes.cpp	(Arbeitskopie)
@@ -572,9 +572,9 @@
 			qreal firstX = positionToPoint(selectionFirst, item->itemText).x1();
 			qreal lastX = positionToPoint(selectionLast + 1, item->itemText).x1();
 			if (m_glyphRun.hasFlag(ScLayout_RightToLeft))
-				rect = QRectF(lastX, y(), firstX - lastX, height());
+				rect = QRectF(lastX, -ascent(), firstX - lastX, height());
 			else
-				rect = QRectF(firstX, y(), lastX - firstX, height());
+				rect = QRectF(firstX, -ascent(), lastX - firstX, height());
 			p->drawRect(rect);
 		}
 	}

jghali

2024-10-09 19:44

administrator   ~0051421

I tested your patch, unfortunately I do not see any difference on ligatures. i did my tests with Crimson Pro.

nitramr

2024-10-09 20:55

developer   ~0051422

Hi Jean, thanks for testing it. But you can reproduce the issue, right?

jghali

2024-10-09 23:19

administrator   ~0051423

Yes, I can reproduce the issue without any problem.

jghali

2024-10-13 21:38

administrator   ~0051431

Weird... I tested your patch again and now it works... Don't know what happened the first time. So it's now committed.

For the second part of the issue, it looks like you should look at LineControl::updateHeightMetrics() in pageitem_textframe.cpp. The line ascent and descent are computed using only the first character of the line.

nitramr

2024-10-13 22:42

developer   ~0051432

Thanks for your hint. I will take a look.

Issue History

Date Modified Username Field Change
2024-10-08 20:04 nitramr New Issue
2024-10-08 20:04 nitramr File Added: fontsize_issue.png
2024-10-08 20:04 nitramr File Added: ligature_fixed.png
2024-10-08 20:04 nitramr File Added: ligature_issue.png
2024-10-08 20:04 nitramr File Added: ligatureselection_2024-10-08_01.patch
2024-10-09 19:44 jghali Note Added: 0051421
2024-10-09 20:55 nitramr Note Added: 0051422
2024-10-09 23:19 jghali Note Added: 0051423
2024-10-13 21:38 jghali Note Added: 0051431
2024-10-13 22:42 nitramr Note Added: 0051432