View Issue Details

IDProjectCategoryView StatusLast Update
0012565ScribusTypographypublic2016-07-06 21:58
ReporterGerrit_B Assigned Tojghali  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformIntelOSWindowsOS Version7 (NL)
Product Version1.4.4 
Target Version1.5.1Fixed in Version1.5.1svn 
Summary0012565: Right alignment of hyphens
DescriptionWhen text is aligned to the right side of the textframe and hyphenation is switched on, a soft hyphen is not placed against the right side of the textframe.

If the soft hyphen is replaced by a hard hyphen and follow by a line break, the result is as might be expected.

When Optical Margins are applied to the right, the hyphen is placed as it should be.

(See the attached .odt file for screendumps.)
Steps To ReproduceObvious
TagsHOST-Oman, layout
PatchYes

Relationships

related to 0012346 closedjghali (right-align) same bug as 0010720 but concerning more platforms and more versions 
related to 0010720 closedjghali Right-aligned text does not work as expected with some fonts. 
related to 0011071 confirmed buggy behaviour with align-right tabs 

Activities

Gerrit_B

2014-07-28 14:22

reporter  

Kunda

2014-07-28 16:44

updater   ~0033056

I think this is a duplicate, right?

JLuc

2014-07-28 21:44

developer   ~0033063

With the #layout tag we also got 0010720 : "Right-aligned text does not work as expected with some fonts." 0010720 is not about hyphens, but i mention the hyphen phenomenon in one of its comments.
I suggest we keep both open since they seems different however related.

ibrahim

2015-11-01 09:28

reporter   ~0037142

I tried to modify the hyphenation so that can work with optical frame option. please chick the attachment.

ale

2015-11-06 13:23

manager   ~0037281

Last edited: 2015-11-06 13:25

ibrahim, i cannot say if this patch does what you think it does.

but by reading it, i cannot be confident that you understood what you are doing: from a logical (mathematical logic!) point of view it does not really make sense to first check for a value being different than something *and* then being equal to something else.

can you please explain why you think your patch solves this issue and provide a patch that is also "logically" correct?

ibrahim

2015-11-10 11:10

reporter   ~0037379

Perhaps I understand it wrongly. please correct me if I am wrong.
the solution of this issue is to

1)remove the small space between the soft hyphen and the right side of the text frame.
2)making sure that the behaviour of the soft hyphen be like the hard hyphen after adding optical margin.

JLuc

2015-11-10 14:32

developer   ~0037383

In the patch,
if (currentCh != '-' && currentCh == SpecialChars::SHYPHEN)"

is quite silly code.

Please fix that first.

ibrahim

2015-11-12 09:19

reporter   ~0037446

I fixed it and attach it again. Can you review it again..

ibrahim

2015-11-17 08:15

reporter  

updated_Shyphen.diff (823 bytes)   
Index: scribus/pageitem_textframe.cpp
===================================================================
--- scribus/pageitem_textframe.cpp	(revision 20493)
+++ scribus/pageitem_textframe.cpp	(working copy)
@@ -2753,7 +2753,7 @@
 							itemText.setFlag(a, ScLayout_SoftHyphenVisible);
 							glyphs->grow();
 							glyphs->more->glyph = font.char2CMap(QChar('-'));
-							glyphs->more->xadvance = font.charWidth('-', itemText.charStyle(a).fontSize() / 10.0) * scaleH; //FIX ME - hyphen is not rendered with proper width - check yhis with large glyphs horizontal scaling eg. 20%
+							glyphs->more->xadvance = font.charWidth('-',0) * scaleH; //FIX ME - hyphen is not rendered with proper width - check yhis with large glyphs horizontal scaling eg. 20%
 							hyphWidth = glyphs->more->xadvance;
 						}
 						else
updated_Shyphen.diff (823 bytes)   

ibrahim

2015-11-17 08:30

reporter   ~0037527

The Idea of this patch is that Scribus when it run and reach this following line:

glyphs->more->xadvance = font.charWidth('-', itemText.charStyle(a).fontSize() / 10.0) * scaleH;

The function charWidth receives the width of hyphen (font size) and but it is more space at the end of the line.

So, I removed the hyphen width and replace it with 0 then I end with a good results

JLuc

2015-11-17 09:08

developer   ~0037528

Last edited: 2015-11-17 09:12

2 questions and 1 advice :

1) I'm not sure : isn't font.charWidth('-',0) allways equal to 0 ?
That would make your code simpler.

2) in the changed line, there is an explicit comment advising to "test with large glyphs horizontal scaling eg. 20%".
Have you done so and did you try your patch, as advised, with "large glyphs horizontal scaling eg. 20%" ?
This horizontal scaling is to be set in the property palette text subtab.

3) in case your patch really fix the issue, the comment should be deleted since the code isnt to be fixed anymore. Isnt ?

JLuc

2015-11-23 11:48

developer   ~0037602

Any answers Ibrahim ?

ibrahim

2015-11-24 05:49

reporter   ~0037631

Sorry for delay

1) Yes I checked It today and I found that it always 0.\
2) I did not understand what he mean by "test with large glyphs horizontal scaling eg. 20%"

JLuc

2015-11-24 10:02

developer   ~0037639

Last edited: 2015-11-24 10:04

1) Then your patch can be made more simple

2) Horizontal scaling of glyphs is a setting in the "Advanced" subpane of the "Text" pane of the property palette (F2). It can also be set in the character style definition (F3). A large horizontal scaling will have big effects on horizontal computations since glyphs take more rooms than with a normal scaling. Can you test your patch with a text that has such a big horizontal scaling, and say your patch also fixes the right alignment of hyphens in such a case ?

ibrahim

2015-11-24 10:40

reporter   ~0037640

Ok I understand now,

I tested and it is fine.

jghali

2015-12-01 22:35

administrator   ~0037780

> I tested and it is fine.

Not really. A quick test shows that the patch break layout when text is aligned on both sides.

ibrahim

2015-12-07 06:01

reporter   ~0037844

>Not really. A quick test shows that the patch break layout when text is aligned on both sides.

Could you elaborate more? and tell me what is the right behaviour which is supposed to be, because I don't see any problem.

jghali

2015-12-12 13:59

administrator   ~0037899

I mean that your fix doesn't work and produce incorrect layout when using other alignment that the right alignment.

I've found what seems a proper fix. See comment in commit r20618.

Kunda

2015-12-12 23:10

updater   ~0037903

Link for the lazy:
https://github.com/scribusproject/scribus/commit/61c039bcdfa144a71ad1d43e6b92d1485d49c824#diff-28265c389e29824ffd6d6825f8255fcfR2781

g.bruijnes

2015-12-13 11:33

reporter   ~0037908

Thanks guys, makes a nice birthday present!

Kunda

2016-01-18 15:43

updater   ~0038251

jluc, can you test to confirm fix? thx!

Issue History

Date Modified Username Field Change
2014-07-28 14:22 Gerrit_B New Issue
2014-07-28 14:22 Gerrit_B File Added: Alignment bug Scribus 1.4.4. - 18-7-2014.odt
2014-07-28 16:44 Kunda Note Added: 0033056
2014-07-28 21:37 JLuc Tag Attached: layout
2014-07-28 21:44 JLuc Note Added: 0033063
2014-07-29 13:52 Kunda Relationship added related to 0012346
2014-07-29 13:52 Kunda Relationship added related to 0010720
2014-07-29 13:53 Kunda Status new => confirmed
2014-07-29 13:53 Kunda Target Version => 1.5.1
2014-10-04 16:13 JLuc Relationship added related to 0011071
2015-11-01 07:35 ibrahim Tag Attached: HOST-Oman
2015-11-01 09:27 ibrahim File Added: updated_hyphen.diff
2015-11-01 09:28 ibrahim Note Added: 0037142
2015-11-01 15:27 JLuc Patch => Yes
2015-11-05 12:29 Kunda Sticky Issue No => Yes
2015-11-06 13:23 ale Note Added: 0037281
2015-11-06 13:25 ale Note Edited: 0037281
2015-11-06 13:25 ale Note Edited: 0037281
2015-11-10 11:10 ibrahim Note Added: 0037379
2015-11-10 14:32 JLuc Note Added: 0037383
2015-11-11 08:35 ibrahim File Deleted: updated_hyphen.diff
2015-11-12 08:07 ibrahim File Added: updated_Shyphen.diff
2015-11-12 09:19 ibrahim Note Added: 0037446
2015-11-17 08:15 ibrahim File Deleted: updated_Shyphen.diff
2015-11-17 08:15 ibrahim File Added: updated_Shyphen.diff
2015-11-17 08:30 ibrahim Note Added: 0037527
2015-11-17 09:08 JLuc Note Added: 0037528
2015-11-17 09:12 JLuc Note Edited: 0037528
2015-11-23 11:48 JLuc Note Added: 0037602
2015-11-24 05:49 ibrahim Note Added: 0037631
2015-11-24 10:02 JLuc Note Added: 0037639
2015-11-24 10:04 JLuc Note Edited: 0037639
2015-11-24 10:04 JLuc Note Edited: 0037639
2015-11-24 10:40 ibrahim Note Added: 0037640
2015-12-01 22:35 jghali Note Added: 0037780
2015-12-07 06:01 ibrahim Note Added: 0037844
2015-12-12 13:59 jghali Note Added: 0037899
2015-12-12 13:59 jghali Status confirmed => resolved
2015-12-12 13:59 jghali Fixed in Version => 1.5.1svn
2015-12-12 13:59 jghali Resolution open => fixed
2015-12-12 13:59 jghali Assigned To => jghali
2015-12-12 13:59 jghali Sticky Issue Yes => No
2015-12-12 23:10 Kunda Note Added: 0037903
2015-12-13 11:33 g.bruijnes Note Added: 0037908
2016-01-18 15:43 Kunda Note Added: 0038251
2016-01-23 17:16 cbradney Target Version 1.5.1 => 1.5.3
2016-01-23 17:38 Kunda Target Version 1.5.3 => 1.5.1
2016-02-13 19:51 cbradney Status resolved => closed
2016-07-06 21:58 jghali Issue cloned: 0014206