View Issue Details

IDProjectCategoryView StatusLast Update
0017286ScribusStory Editor / Text Framespublic2024-12-23 23:18
Reporternitramr Assigned Tonitramr  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformDesktop PCOSUbuntuOS Version24.04 64-bit
Product Version1.6.3.svn 
Fixed in 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.

nitramr

2024-10-22 16:54

developer   ~0051478

@jghali

I found a solution. Please tell me if it is ok like this.
textselection_2024-10-22_01.patch (1,332 bytes)   
Index: scribus/pageitem_textframe.cpp
===================================================================
--- scribus/pageitem_textframe.cpp	(Revision 26361)
+++ scribus/pageitem_textframe.cpp	(Arbeitskopie)
@@ -647,11 +647,21 @@
 		lineData.ascent = lineData.descent = 0;
 		if (glyphs.isEmpty())
 			return;
-		const CharStyle& cStyle(glyphs.at(0).style());
-		double scaleV = cStyle.scaleV() / 1000.0;
-		double offset = (cStyle.fontSize() / 10) * (cStyle.baselineOffset() / 1000.0);
-		lineData.ascent = cStyle.font().ascent(cStyle.fontSize() / 10.00) * scaleV + offset;
-		lineData.descent = cStyle.font().descent(cStyle.fontSize() / 10.00) * scaleV - offset;
+
+		// #17286 seek for largest glphy in line
+		for (int i = 0; i < glyphs.count(); i++)
+		{
+			const CharStyle& cStyle(glyphs.at(i).style());
+			double scaleV = cStyle.scaleV() / 1000.0;
+			double offset = (cStyle.fontSize() / 10) * (cStyle.baselineOffset() / 1000.0);
+			double tmpAscent = cStyle.font().ascent(cStyle.fontSize() / 10.00) * scaleV + offset;
+
+			if (lineData.ascent < tmpAscent)
+			{
+				lineData.ascent = tmpAscent;
+				lineData.descent = cStyle.font().descent(cStyle.fontSize() / 10.00) * scaleV - offset;;
+			}
+		}
 	}
 
 // yPos should not be changed when all line is already calculated - at new y position there can be overflow!!!

jghali

2024-10-29 22:40

administrator   ~0051504

I tested the patch, it works but unfortunately modifying updateHeightMetrics() has apparently some side effects. For example with the attached document, it gets difficult to select the line starting with "Commençons".
17286_text_selection_highlight.sla (19,613 bytes)   
<?xml version="1.0" encoding="UTF-8"?>
<SCRIBUSUTF8NEW Version="1.6.3.svn">
    <DOCUMENT ANZPAGES="1" PAGEWIDTH="595.275590551181" PAGEHEIGHT="841.889763779528" BORDERLEFT="40" BORDERRIGHT="40" BORDERTOP="40" BORDERBOTTOM="40" PRESET="0" BleedTop="0" BleedLeft="0" BleedRight="0" BleedBottom="0" ORIENTATION="0" PAGESIZE="A4" FIRSTNUM="1" BOOK="0" AUTOSPALTEN="1" ABSTSPALTEN="11" UNITS="1" DFONT="Arial Regular" DSIZE="12" DCOL="1" DGAP="0" TabFill="" TabWidth="36" TextDistLeft="0" TextDistRight="0" TextDistBottom="0" TextDistTop="0" FirstLineOffset="1" AUTHOR="" COMMENTS="" KEYWORDS="" PUBLISHER="" DOCDATE="" DOCTYPE="" DOCFORMAT="" DOCIDENT="" DOCSOURCE="" DOCLANGINFO="" DOCRELATION="" DOCCOVER="" DOCRIGHTS="" DOCCONTRIB="" TITLE="" SUBJECT="" VHOCH="33" VHOCHSC="66" VTIEF="33" VTIEFSC="66" VKAPIT="75" BASEGRID="14.4" BASEO="0" AUTOL="100" UnderlinePos="-1" UnderlineWidth="-1" StrikeThruPos="-1" StrikeThruWidth="-1" GROUPC="1" HCMS="0" DPSo="0" DPSFo="0" DPuse="0" DPgam="0" DPbla="0" DPPr="Fogra27L CMYK Coated Press" DPIn="sRGB IEC61966-2.1" DPInCMYK="Fogra27L CMYK Coated Press" DPIn2="sRGB IEC61966-2.1" DPIn3="Fogra27L CMYK Coated Press" DISc="1" DIIm="1" ALAYER="0" LANGUAGE="fr" AUTOMATIC="1" AUTOCHECK="0" GUIDELOCK="0" SnapToGuides="0" SnapToGrid="0" SnapToElement="0" MINGRID="20.001" MAJGRID="100.001" SHOWGRID="0" SHOWGUIDES="1" showcolborders="1" SHOWFRAME="1" SHOWControl="0" SHOWLAYERM="0" SHOWMARGIN="1" SHOWBASE="0" SHOWPICT="1" SHOWLINK="0" rulerMode="1" showrulers="1" showBleed="1" rulerXoffset="0" rulerYoffset="0" GuideRad="10" GRAB="4" POLYC="4" POLYF="0.502" POLYR="0" POLYIR="0" POLYCUR="0" POLYOCUR="0" POLYS="0" arcStartAngle="30" arcSweepAngle="300" spiralStartAngle="0" spiralEndAngle="1080" spiralFactor="1.2" AutoSave="1" AutoSaveTime="600000" AutoSaveCount="1" AutoSaveKeep="0" AUtoSaveInDocDir="1" AutoSaveDir="" ScratchBottom="20.001" ScratchLeft="100.001" ScratchRight="100.001" ScratchTop="20.001" GapHorizontal="0" GapVertical="40" StartArrow="0" EndArrow="0" PEN="Black" BRUSH="None" PENLINE="Black" PENTEXT="Black" StrokeText="Black" TextBackGround="None" TextLineColor="None" TextBackGroundShade="100" TextLineShade="100" TextPenShade="100" TextStrokeShade="100" STIL="1" STILLINE="1" WIDTH="1" WIDTHLINE="1" PENSHADE="100" LINESHADE="100" BRUSHSHADE="100" CPICT="None" PICTSHADE="100" CSPICT="None" PICTSSHADE="100" PICTSCX="1" PICTSCY="1" PSCALE="1" PASPECT="1" EmbeddedPath="0" HalfRes="1" dispX="10.001" dispY="10.001" constrain="15" MINORC="#00ff00" MAJORC="#00ff00" GuideC="#000080" BaseC="#c0c0c0" renderStack="2 0 4 1 3" GridType="0" PAGEC="#ffffff" MARGC="#0000ff" RANDF="0" currentProfile="PDF 1.4" calligraphicPenFillColor="Black" calligraphicPenLineColor="Black" calligraphicPenFillColorShade="100" calligraphicPenLineColorShade="100" calligraphicPenLineWidth="1" calligraphicPenAngle="0" calligraphicPenWidth="10" calligraphicPenStyle="1">
        <CheckProfile Name="PDF 1.3" ignoreErrors="0" autoCheck="1" checkGlyphs="1" checkOrphans="1" checkOverflow="1" checkPictures="1" checkPartFilledImageFrames="0" checkResolution="1" checkTransparency="1" minResolution="144" maxResolution="2400" checkAnnotations="0" checkRasterPDF="1" checkForGIF="1" ignoreOffLayers="0" checkNotCMYKOrSpot="0" checkDeviceColorsAndOutputIntent="0" checkFontNotEmbedded="1" checkFontIsOpenType="1" checkAppliedMasterDifferentSide="1" checkEmptyTextFrames="1"/>
        <CheckProfile Name="PDF 1.4" ignoreErrors="0" autoCheck="1" checkGlyphs="1" checkOrphans="1" checkOverflow="1" checkPictures="1" checkPartFilledImageFrames="0" checkResolution="1" checkTransparency="0" minResolution="144" maxResolution="2400" checkAnnotations="0" checkRasterPDF="1" checkForGIF="1" ignoreOffLayers="0" checkNotCMYKOrSpot="0" checkDeviceColorsAndOutputIntent="0" checkFontNotEmbedded="1" checkFontIsOpenType="1" checkAppliedMasterDifferentSide="1" checkEmptyTextFrames="1"/>
        <CheckProfile Name="PDF 1.5" ignoreErrors="0" autoCheck="1" checkGlyphs="1" checkOrphans="1" checkOverflow="1" checkPictures="1" checkPartFilledImageFrames="0" checkResolution="1" checkTransparency="0" minResolution="144" maxResolution="2400" checkAnnotations="0" checkRasterPDF="1" checkForGIF="1" ignoreOffLayers="0" checkNotCMYKOrSpot="0" checkDeviceColorsAndOutputIntent="0" checkFontNotEmbedded="1" checkFontIsOpenType="1" checkAppliedMasterDifferentSide="1" checkEmptyTextFrames="1"/>
        <CheckProfile Name="PDF 1.6" ignoreErrors="0" autoCheck="1" checkGlyphs="1" checkOrphans="1" checkOverflow="1" checkPictures="1" checkPartFilledImageFrames="0" checkResolution="1" checkTransparency="0" minResolution="144" maxResolution="2400" checkAnnotations="0" checkRasterPDF="1" checkForGIF="1" ignoreOffLayers="0" checkNotCMYKOrSpot="0" checkDeviceColorsAndOutputIntent="0" checkFontNotEmbedded="1" checkFontIsOpenType="1" checkAppliedMasterDifferentSide="1" checkEmptyTextFrames="1"/>
        <CheckProfile Name="PDF/X-1a" ignoreErrors="0" autoCheck="1" checkGlyphs="1" checkOrphans="1" checkOverflow="1" checkPictures="1" checkPartFilledImageFrames="0" checkResolution="1" checkTransparency="1" minResolution="144" maxResolution="2400" checkAnnotations="1" checkRasterPDF="1" checkForGIF="1" ignoreOffLayers="0" checkNotCMYKOrSpot="1" checkDeviceColorsAndOutputIntent="0" checkFontNotEmbedded="1" checkFontIsOpenType="1" checkAppliedMasterDifferentSide="1" checkEmptyTextFrames="1"/>
        <CheckProfile Name="PDF/X-3" ignoreErrors="0" autoCheck="1" checkGlyphs="1" checkOrphans="1" checkOverflow="1" checkPictures="1" checkPartFilledImageFrames="0" checkResolution="1" checkTransparency="1" minResolution="144" maxResolution="2400" checkAnnotations="1" checkRasterPDF="1" checkForGIF="1" ignoreOffLayers="0" checkNotCMYKOrSpot="0" checkDeviceColorsAndOutputIntent="1" checkFontNotEmbedded="1" checkFontIsOpenType="1" checkAppliedMasterDifferentSide="1" checkEmptyTextFrames="1"/>
        <CheckProfile Name="PDF/X-4" ignoreErrors="0" autoCheck="1" checkGlyphs="1" checkOrphans="1" checkOverflow="1" checkPictures="1" checkPartFilledImageFrames="0" checkResolution="1" checkTransparency="0" minResolution="144" maxResolution="2400" checkAnnotations="1" checkRasterPDF="1" checkForGIF="1" ignoreOffLayers="0" checkNotCMYKOrSpot="0" checkDeviceColorsAndOutputIntent="1" checkFontNotEmbedded="1" checkFontIsOpenType="0" checkAppliedMasterDifferentSide="1" checkEmptyTextFrames="1"/>
        <CheckProfile Name="PostScript" ignoreErrors="0" autoCheck="1" checkGlyphs="1" checkOrphans="1" checkOverflow="1" checkPictures="1" checkPartFilledImageFrames="0" checkResolution="1" checkTransparency="1" minResolution="144" maxResolution="2400" checkAnnotations="0" checkRasterPDF="1" checkForGIF="1" ignoreOffLayers="0" checkNotCMYKOrSpot="0" checkDeviceColorsAndOutputIntent="0" checkFontNotEmbedded="0" checkFontIsOpenType="0" checkAppliedMasterDifferentSide="1" checkEmptyTextFrames="1"/>
        <COLOR NAME="Black" SPACE="CMYK" C="0" M="0" Y="0" K="100"/>
        <COLOR NAME="Blue" SPACE="RGB" R="0" G="0" B="255"/>
        <COLOR NAME="Cool Black" SPACE="CMYK" C="60" M="0" Y="0" K="100"/>
        <COLOR NAME="Cyan" SPACE="CMYK" C="100" M="0" Y="0" K="0"/>
        <COLOR NAME="Green" SPACE="RGB" R="0" G="255" B="0"/>
        <COLOR NAME="Magenta" SPACE="CMYK" C="0" M="100" Y="0" K="0"/>
        <COLOR NAME="Red" SPACE="RGB" R="255" G="0" B="0"/>
        <COLOR NAME="Registration" SPACE="CMYK" C="100" M="100" Y="100" K="100" Register="1"/>
        <COLOR NAME="Rich Black" SPACE="CMYK" C="60" M="40" Y="40" K="100"/>
        <COLOR NAME="Warm Black" SPACE="CMYK" C="0" M="60" Y="29.8039215686275" K="100"/>
        <COLOR NAME="White" SPACE="CMYK" C="0" M="0" Y="0" K="0"/>
        <COLOR NAME="Yellow" SPACE="CMYK" C="0" M="0" Y="100" K="0"/>
        <HYPHEN/>
        <CHARSTYLE CNAME="Default Character Style" DefaultStyle="1" FONT="Arial Regular" FONTSIZE="12" FONTFEATURES="" FEATURES="inherit" FCOLOR="Black" FSHADE="100" HyphenWordMin="3" SCOLOR="Black" BGCOLOR="None" BGSHADE="100" SSHADE="100" TXTSHX="5" TXTSHY="-5" TXTOUT="1" TXTULP="-0.1" TXTULW="-0.1" TXTSTP="-0.1" TXTSTW="-0.1" SCALEH="100" SCALEV="100" BASEO="0" KERN="0" LANGUAGE="fr"/>
        <STYLE NAME="Default Paragraph Style" DefaultStyle="1" ALIGN="0" DIRECTION="0" LINESPMode="0" LINESP="15" INDENT="0" RMARGIN="0" FIRST="0" VOR="0" NACH="0" ParagraphEffectOffset="0" DROP="0" DROPLIN="2" Bullet="0" Numeration="0" HyphenConsecutiveLines="2" BCOLOR="None" BSHADE="100"/>
        <TableStyle NAME="Default Table Style" DefaultStyle="1" FillColor="None" FillShade="100">
            <TableBorderLeft>
                <TableBorderLine Width="1" PenStyle="1" Color="Black" Shade="100"/>
            </TableBorderLeft>
            <TableBorderRight>
                <TableBorderLine Width="1" PenStyle="1" Color="Black" Shade="100"/>
            </TableBorderRight>
            <TableBorderTop>
                <TableBorderLine Width="1" PenStyle="1" Color="Black" Shade="100"/>
            </TableBorderTop>
            <TableBorderBottom>
                <TableBorderLine Width="1" PenStyle="1" Color="Black" Shade="100"/>
            </TableBorderBottom>
        </TableStyle>
        <CellStyle NAME="Default Cell Style" DefaultStyle="1" FillColor="None" FillShade="100" LeftPadding="1" RightPadding="1" TopPadding="1" BottomPadding="1">
            <TableBorderLeft>
                <TableBorderLine Width="1" PenStyle="1" Color="Black" Shade="100"/>
            </TableBorderLeft>
            <TableBorderRight>
                <TableBorderLine Width="1" PenStyle="1" Color="Black" Shade="100"/>
            </TableBorderRight>
            <TableBorderTop>
                <TableBorderLine Width="1" PenStyle="1" Color="Black" Shade="100"/>
            </TableBorderTop>
            <TableBorderBottom>
                <TableBorderLine Width="1" PenStyle="1" Color="Black" Shade="100"/>
            </TableBorderBottom>
        </CellStyle>
        <LAYERS NUMMER="0" LEVEL="0" NAME="Fond de page" SICHTBAR="1" DRUCKEN="1" EDIT="1" SELECT="0" FLOW="1" TRANS="1" BLEND="0" OUTL="0" LAYERC="#000000"/>
        <Printer firstUse="1" toFile="0" useAltPrintCommand="0" outputSeparations="0" useSpotColors="1" useColor="1" mirrorH="0" mirrorV="0" useICC="0" doGCR="0" doClip="0" setDevParam="0" useDocBleeds="1" cropMarks="0" bleedMarks="0" registrationMarks="0" colorMarks="0" includePDFMarks="1" PSLevel="3" PrintEngine="4" markLength="20.0013" markOffset="0" BleedTop="0" BleedLeft="0" BleedRight="0" BleedBottom="0" printer="Microsoft Print to PDF" filename="" separationName="All" printerCommand=""/>
        <PDF firstUse="1" Thumbnails="0" Articles="0" Bookmarks="0" Compress="1" CMethod="0" Quality="0" EmbedPDF="0" MirrorH="0" MirrorV="0" Clip="0" rangeSel="0" rangeTxt="" RotateDeg="0" PresentMode="0" RecalcPic="0" FontEmbedding="0" Grayscale="0" RGBMode="1" UseProfiles="0" UseProfiles2="0" Binding="0" PicRes="300" Resolution="300" Version="14" Intent="1" Intent2="1" SolidP="sRGB IEC61966-2.1" ImageP="sRGB IEC61966-2.1" PrintP="Fogra27L CMYK Coated Press" InfoString="" BTop="0" BLeft="0" BRight="0" BBottom="0" useDocBleeds="1" cropMarks="0" bleedMarks="0" registrationMarks="0" colorMarks="0" docInfoMarks="0" markLength="20.0012598425197" markOffset="0" ImagePr="0" PassOwner="" PassUser="" Permissions="-4" Encrypt="0" UseLayers="0" UseLpi="0" UseSpotColors="1" doMultiFile="0" displayBookmarks="0" displayFullscreen="0" displayLayers="0" displayThumbs="0" hideMenuBar="0" hideToolBar="0" fitWindow="0" openAfterExport="0" PageLayout="0" openAction="">
            <LPI Color="" Frequency="0" Angle="0" SpotFunction="0"/>
            <LPI Color="Black" Frequency="133" Angle="45" SpotFunction="3"/>
            <LPI Color="Cyan" Frequency="133" Angle="105" SpotFunction="3"/>
            <LPI Color="Magenta" Frequency="133" Angle="75" SpotFunction="3"/>
            <LPI Color="Yellow" Frequency="133" Angle="90" SpotFunction="3"/>
        </PDF>
        <DocItemAttributes/>
        <TablesOfContents/>
        <NotesStyles>
            <notesStyle Name="Default" Start="1" Endnotes="0" Type="Type_1_2_3" Range="0" Prefix="" Suffix=")" AutoHeight="1" AutoWidth="1" AutoRemove="1" AutoWeld="1" SuperNote="1" SuperMaster="1" MarksStyle="" NotesStyle=""/>
        </NotesStyles>
        <PageSets>
            <Set Name="Single Page" FirstPage="0" Rows="1" Columns="1"/>
            <Set Name="Facing Pages" FirstPage="1" Rows="1" Columns="2">
                <PageNames Name="Left Page"/>
                <PageNames Name="Right Page"/>
            </Set>
            <Set Name="3-Fold" FirstPage="0" Rows="1" Columns="3">
                <PageNames Name="Left Page"/>
                <PageNames Name="Middle"/>
                <PageNames Name="Right Page"/>
            </Set>
            <Set Name="4-Fold" FirstPage="0" Rows="1" Columns="4">
                <PageNames Name="Left Page"/>
                <PageNames Name="Middle Left"/>
                <PageNames Name="Middle Right"/>
                <PageNames Name="Right Page"/>
            </Set>
        </PageSets>
        <Sections>
            <Section Number="0" Name="Section 1" From="0" To="0" Type="Type_1_2_3" Start="1" Reversed="0" Active="1" FillChar="0" FieldWidth="0"/>
        </Sections>
        <MASTERPAGE PAGEXPOS="100.001" PAGEYPOS="20.001" PAGEWIDTH="595.275590551181" PAGEHEIGHT="841.889763779528" BORDERLEFT="40" BORDERRIGHT="40" BORDERTOP="40" BORDERBOTTOM="40" NUM="0" NAM="Normal" MNAM="" Size="A4" Orientation="0" LEFT="0" PRESET="0" VerticalGuides="" HorizontalGuides="" AGhorizontalAutoGap="0" AGverticalAutoGap="0" AGhorizontalAutoCount="0" AGverticalAutoCount="0" AGhorizontalAutoRefer="0" AGverticalAutoRefer="0" AGSelection="0 0 0 0" pageEffectDuration="1" pageViewDuration="1" effectType="0" Dm="0" M="0" Di="0"/>
        <PAGE PAGEXPOS="100.001" PAGEYPOS="20.001" PAGEWIDTH="595.275590551181" PAGEHEIGHT="841.889763779528" BORDERLEFT="40" BORDERRIGHT="40" BORDERTOP="40" BORDERBOTTOM="40" NUM="0" NAM="" MNAM="Normal" Size="A4" Orientation="0" LEFT="0" PRESET="0" VerticalGuides="" HorizontalGuides="" AGhorizontalAutoGap="0" AGverticalAutoGap="0" AGhorizontalAutoCount="0" AGverticalAutoCount="0" AGhorizontalAutoRefer="0" AGverticalAutoRefer="0" AGSelection="0 0 0 0" pageEffectDuration="1" pageViewDuration="1" effectType="0" Dm="0" M="0" Di="0"/>
        <PAGEOBJECT XPOS="140.001" YPOS="60.001" OwnPage="0" ItemID="247857696" PTYPE="4" WIDTH="515.275590551181" HEIGHT="761.889763779528" FRTYPE="0" CLIPEDIT="0" PWIDTH="1" PLINEART="1" LOCALSCX="1" LOCALSCY="1" LOCALX="0" LOCALY="0" LOCALROT="0" PICART="1" SCALETYPE="1" RATIO="1" COLUMNS="1" COLGAP="0" AUTOTEXT="0" EXTRA="0" TEXTRA="0" BEXTRA="0" REXTRA="0" VAlign="0" FLOP="0" PLTSHOW="0" BASEOF="0" textPathType="0" textPathFlipped="0" path="M0 0 L515.276 0 L515.276 761.89 L0 761.89 L0 0 Z" copath="M0 0 L515.276 0 L515.276 761.89 L0 761.89 L0 0 Z" gXpos="140.001" gYpos="60.001" gWidth="0" gHeight="0" LAYER="0" NEXTITEM="-1" BACKITEM="-1">
            <StoryText>
                <DefaultStyle/>
                <ITEXT CH="a"/>
                <ITEXT FONTSIZE="14" CH="a"/>
                <ITEXT FONTSIZE="16" CH="a"/>
                <ITEXT FONTSIZE="18" CH="a"/>
                <ITEXT FONTSIZE="20" CH="a"/>
                <ITEXT FONTSIZE="22" CH="a"/>
                <ITEXT FONTSIZE="24" CH="a"/>
                <ITEXT FONTSIZE="26" CH="a"/>
                <ITEXT FONTSIZE="28" CH="a"/>
                <ITEXT FONTSIZE="30" CH="a"/>
                <ITEXT FONTSIZE="32" CH="a"/>
                <ITEXT FONTSIZE="34" CH="a"/>
                <ITEXT FONTSIZE="36" CH="a"/>
                <ITEXT FONTSIZE="38" CH="a"/>
                <ITEXT FONTSIZE="40" CH="a"/>
                <ITEXT FONTSIZE="42" CH="a"/>
                <ITEXT FONTSIZE="44" CH="a"/>
                <ITEXT FONTSIZE="46" CH="a"/>
                <ITEXT FONTSIZE="48" CH="a"/>
                <ITEXT FONTSIZE="50" CH="a"/>
                <ITEXT FONTSIZE="52" CH="a"/>
                <ITEXT FONTSIZE="54" CH="a"/>
                <ITEXT FONTSIZE="56" CH="a"/>
                <ITEXT FONTSIZE="58" CH="a"/>
                <ITEXT FONTSIZE="60" CH="a"/>
                <para/>
                <para/>
                <ITEXT FONT="Crimson Pro Regular" FONTSIZE="24" CH="ligature selection : ffi f"/>
                <ITEXT FONT="Crimson Pro Regular" FONTSIZE="24" BASEO="30" CH="fi"/>
                <ITEXT FONT="Crimson Pro Regular" FONTSIZE="24" CH=" f"/>
                <ITEXT FONT="Crimson Pro Regular" FONTSIZE="24" BASEO="-30" CH="fi"/>
                <para/>
                <ITEXT CH="Commençons par la considération des choses les plus communes, et que nous croyons comprendre le plus distinctement, à savoir les corps que nous touchons et que nous voyons. Je n’entends pas parler des corps en général, car ces notions générales sont d’ordinaire plus confuses, mais de quelqu’un en particulier. Prenons pour exemple ce morceau de cire qui vient d’être tiré de la ruche : il n’a pas encore perdu la douceur du miel qu’il contenait, il retient encore quelque chose de l’odeur des fleurs dont il a été recueilli; sa couleur, sa figure, sa grandeur, sont apparentes; il est dur, il est froid, on le touche, et si vous le frappez, il rendra quelque son."/>
                <para/>
                <ITEXT CH="Enfin toutes les choses qui peuvent distinctement faire connaître un corps, se rencontrent en celui-ci. Mais voici que, cependant que je parle, on l’approche du feu : ce qui y restait de saveur s’exhale, l’odeur s’évanouit, sa couleur se change, sa figure se perd, sa grandeur augmente, il devient liquide, il s’échauffe, à peine le peut-on toucher, et quoiqu’on le frappe, il ne rendra plus aucun son. La même cire demeure-t-elle après ce changement ? Il faut avouer qu’elle demeure; et personne ne le peut nier. Qu’est-ce donc que l’on connaissait en ce morceau de cire avec tant de distinction ?"/>
                <para/>
                <ITEXT CH="Certes ce ne peut être rien de tout ce que j’y ai remarqué par l’entremise des sens, puisque toutes les choses qui tombaient sous le goût, ou l’odorat, ou la vue, ou l’attouchement, ou l’ouïe, se trouvent changées, et cependant la même cire demeure. Peut-être était-ce ce que je pense maintenant, à savoir que la cire n’était pas ni cette douceur du miel, ni cette agréable odeur des fleurs, ni cette blancheur, ni cette figure, ni ce son, mais seulement un corps qui un peu auparavant me paraissait sous ces formes, et qui maintenant se fait remarquer sous d’autres. Mais qu’est-ce, précisément parlant, que j’imagine, lorsque je la conçois en cette sorte ?"/>
                <para/>
                <ITEXT CH="Considérons-le attentivement, et éloignant toutes les choses qui n’appartiennent point à la cire, voyons ce qui reste. Certes il ne demeure rien que quelque chose d’étendu, de flexible et de muable. Or qu’est-ce que cela : flexible et muable ? N’est-ce pas que j’imagine que cette cire étant ronde est capable de devenir carrée, et de passer du carré en une figure triangulaire ? Non certes, ce n’est pas cela, puisque je la conçois capable de recevoir une infinité de semblables changements, et je ne saurais néanmoins parcourir cette infinité par mon imagination, et par conséquent cette conception que j’ai de la cire ne s’accomplit pas par la faculté d’imaginer."/>
                <trail/>
            </StoryText>
        </PAGEOBJECT>
    </DOCUMENT>
</SCRIBUSUTF8NEW>

nitramr

2024-11-01 17:42

developer   ~0051516

Hi Jean, good catch.

To fix it, I removed the offset from the descent calculation. The descent offset behaves strangely, even in 1.6.2. See selection of "Certes".
There are still cases that are difficult to solve with fixed line spacing, see screenshot with large "lig". In this case, you can't select "Commençons" either.
textselection_2024-11-01_01.patch (1,322 bytes)   
Index: scribus/pageitem_textframe.cpp
===================================================================
--- scribus/pageitem_textframe.cpp	(Revision 26361)
+++ scribus/pageitem_textframe.cpp	(Arbeitskopie)
@@ -647,11 +647,21 @@
 		lineData.ascent = lineData.descent = 0;
 		if (glyphs.isEmpty())
 			return;
-		const CharStyle& cStyle(glyphs.at(0).style());
-		double scaleV = cStyle.scaleV() / 1000.0;
-		double offset = (cStyle.fontSize() / 10) * (cStyle.baselineOffset() / 1000.0);
-		lineData.ascent = cStyle.font().ascent(cStyle.fontSize() / 10.00) * scaleV + offset;
-		lineData.descent = cStyle.font().descent(cStyle.fontSize() / 10.00) * scaleV - offset;
+
+		// #17286 seek for largest glphy in line
+		for (int i = 0; i < glyphs.count(); i++)
+		{
+			const CharStyle& cStyle(glyphs.at(i).style());
+			double scaleV = cStyle.scaleV() / 1000.0;
+			double offset = (cStyle.fontSize() / 10) * (cStyle.baselineOffset() / 1000.0);
+			double tmpAscent = cStyle.font().ascent(cStyle.fontSize() / 10.00) * scaleV + offset;
+
+			if (lineData.ascent < tmpAscent)
+			{
+				lineData.ascent = tmpAscent;
+				lineData.descent = cStyle.font().descent(cStyle.fontSize() / 10.00) * scaleV;
+			}
+		}
 	}
 
 // yPos should not be changed when all line is already calculated - at new y position there can be overflow!!!

descent 1.6.2.png (8,424 bytes)   
descent 1.6.2.png (8,424 bytes)   
fixedspacing 1.7.0.png (10,074 bytes)   
fixedspacing 1.7.0.png (10,074 bytes)   

nitramr

2024-12-17 09:35

developer   ~0051745

Hi @jghali please can you check if the updated patch is ok? Maybe it can be included in versions 1.6.3 and 1.7.0.

jghali

2024-12-22 01:55

administrator   ~0051761

This updated patch works much better! Committed! Thanks for your work.

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
2024-10-22 16:54 nitramr Note Added: 0051478
2024-10-22 16:54 nitramr File Added: textselection_2024-10-22_01.patch
2024-10-29 22:40 jghali Note Added: 0051504
2024-10-29 22:40 jghali File Added: 17286_text_selection_highlight.sla
2024-11-01 17:42 nitramr Note Added: 0051516
2024-11-01 17:42 nitramr File Added: textselection_2024-11-01_01.patch
2024-11-01 17:42 nitramr File Added: descent 1.6.2.png
2024-11-01 17:42 nitramr File Added: fixedspacing 1.7.0.png
2024-11-01 17:52 nitramr Assigned To => nitramr
2024-11-01 17:52 nitramr Status new => assigned
2024-12-17 09:35 nitramr Note Added: 0051745
2024-12-22 01:55 jghali Note Added: 0051761
2024-12-22 01:55 jghali Status assigned => resolved
2024-12-22 01:55 jghali Resolution open => fixed
2024-12-22 01:55 jghali Fixed in Version => 1.6.3.svn
2024-12-23 23:18 cbradney Status resolved => closed