View Issue Details

IDProjectCategoryView StatusLast Update
0016099ScribusTypographypublic2020-08-11 20:56
Reporterftake Assigned Tojghali  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.5.6.svn 
Target VersionFixed in Version1.5.6.svn 
Summary0016099: Add implicit space between a Latin character and a CJK character
DescriptionScribus adds a 1/4 em space between a Latin character and a CJK character according to [1]. However, when their paragraph is justified, the width of that space should be extended like other space characters. Otherwise, the texts become unbalanced.


[1] https://www.w3.org/TR/jlreq/#handling_of_western_text_in_japanese_text_using_proportional_western_fonts
Steps To ReproduceSee files attached.
TagsNo tags attached.
PatchNo

Activities

ftake

2020-04-27 09:53

reporter  

extensible-implicit-space.sla (17,827 bytes)

jghali

2020-04-27 12:27

administrator   ~0047571

It looks like the condition at line 452 of textshaper.cpp needs to be more complex. Some like this maybe:
if (firstChar != 0 &&
    ((SpecialChars::isCJK(m_story.text(firstChar).unicode()) && SpecialChars::isCJK(m_story.text(firstChar - 1).unicode())) ||
     (SpecialChars::isCJK(m_story.text(firstChar).unicode()) && SpecialChars::isLetterRequiringSpaceAroundCJK(m_story.text(firstChar - 1).unicode())) ||
     (SpecialChars::isLetterRequiringSpaceAroundCJK(m_story.text(firstChar).unicode()) && SpecialChars::isCJK(m_story.text(firstChar - 1).unicode()))) )
    run.setFlag(ScLayout_ImplicitSpace);

ftake

2020-04-27 13:08

reporter   ~0047572

I think the function to be fixed is scribus/pageitem_textframe.cpp justifyLine().

It seems that we need refactoring around imSpace before fixing this problem.
imSpace indicates the width of 1/4 em space but I cannot understand from the code at a glance.

jghali

2020-04-27 13:22

administrator   ~0047573

At this point, justifyLine() does not have the information that there is an implicit space between CJK and latin chars. Hence my proposal to change the condition at line 452 of textshaper.cpp.
The imSpace variable in justifyLine() is something different that the 1/4 em space. The 1/4 em spaces are currently inserted in TextShaper::shape() at line 583 and 598 of textshaper.cpp.

ftake

2020-04-27 13:53

reporter   ~0047574

I reminded the implementation.
I'm sorry, the title was wrong. The space between Latin and CJK is not what we call implicit space.

> It looks like the condition at line 452 of textshaper.cpp needs to be more complex. Some like this maybe:

You are right.
But I am wondering if we can move the code adding 1/4 space to somewhere handling spaces. Even though we add the conditions to the if statement setting ScLayout_ImplicitSpace, we still need another code at justifyLine() to reduce the space width by the amount of quaterEM, which has been already added to the extra width.

jghali

2020-04-27 14:15

administrator   ~0047575

>> I'm sorry, the title was wrong. The space between Latin and CJK is not what we call implicit space.

Is there a specific technical name for such space?

ftake

2020-04-27 15:55

reporter   ~0047576

> Is there a specific technical name for such space?

No, as far as I know.

We are using "implicit space" as a space implicitly added for justification (ScLayout_ImplicitSpace). On the other hand 1/4 space between CJK and Latin is added (also implicitly) regardless of justification/alignment.

So the title should be "Add implicit space between a Latin character and a CJK character", I think.


I'm wondering adding U+2005 (four-per-em space) to glyph cluster instead of extraWidth makes it simple although I'm not sure such use of glyph cluster is allowed.

Issue History

Date Modified Username Field Change
2020-04-27 09:53 ftake New Issue
2020-04-27 09:53 ftake File Added: extensible-implicit-space.png
2020-04-27 09:53 ftake File Added: extensible-implicit-space.sla
2020-04-27 12:27 jghali Note Added: 0047571
2020-04-27 13:08 ftake Note Added: 0047572
2020-04-27 13:22 jghali Note Added: 0047573
2020-04-27 13:53 ftake Note Added: 0047574
2020-04-27 14:15 jghali Note Added: 0047575
2020-04-27 15:55 ftake Note Added: 0047576
2020-05-06 11:46 jghali Summary Implicit space between a Latin character and a CJK character should be extensible in a justified paragraph => Add implicit space between a Latin character and a CJK character
2020-05-06 11:46 jghali Description Updated View Revisions
2020-05-06 11:47 jghali Assigned To => jghali
2020-05-06 11:47 jghali Status new => resolved
2020-05-06 11:47 jghali Resolution open => fixed
2020-05-06 11:47 jghali Fixed in Version => 1.5.6.svn
2020-08-11 20:56 cbradney Status resolved => closed