Bug 107405 - Setting fixed kerning (text spacing) is limited to -2pt
Summary: Setting fixed kerning (text spacing) is limited to -2pt
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
5.2.0.4 release
Hardware: All All
: medium normal
Assignee: Samuel Mehrbrodt (allotropia)
URL:
Whiteboard: target:7.5.0 target:7.4.4
Keywords: bibisected, bisected, regression
: 108785 116600 137296 147619 (view as bug list)
Depends on:
Blocks: Font-Rendering Character-Dialog
  Show dependency treegraph
 
Reported: 2017-04-25 05:36 UTC by Yousuf Philips (jay) (retired)
Modified: 2023-06-01 06:16 UTC (History)
11 users (show)

See Also:
Crash report or crash signature:


Attachments
sample (10.61 KB, application/wps-office.docx)
2017-04-25 05:36 UTC, Yousuf Philips (jay) (retired)
Details
Word 2010 vs Writer 5.4 (46.65 KB, image/png)
2017-04-25 05:36 UTC, Yousuf Philips (jay) (retired)
Details
Bibisect log (2.91 KB, text/plain)
2018-03-24 15:16 UTC, Telesto
Details
Apache OpenOffice 4.1.7 handles this pair kerning better (but with artificial limit of 7 which is also too small), so code changed in LibreOffice! (75.40 KB, image/jpeg)
2020-11-05 22:19 UTC, TH
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yousuf Philips (jay) (retired) 2017-04-25 05:36:09 UTC
Created attachment 132811 [details]
sample

Steps:
1) Open attached document
2) Select 'Condensed 3pt'
3) Context Menu > Character > Position
4) Notice that spacing is -2pt

Version: 5.4.0.0.alpha0+
Build ID: f0340e3dca1091accdb71e0c566b96cdf9e0f791
CPU threads: 2; OS: Linux 4.4; UI render: default; VCL: gtk2; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2017-04-21_13:34:48
Locale: en-US (en_US.UTF-8); Calc: group
Comment 1 Yousuf Philips (jay) (retired) 2017-04-25 05:36:31 UTC
Created attachment 132812 [details]
Word 2010 vs Writer 5.4
Comment 2 Telesto 2017-04-25 17:58:38 UTC
Confirming with:
Version: 5.4.0.0.alpha0+
Build ID: a917902c48f21d04039da86048c5c36555137d7e
CPU threads: 4; OS: Windows 6.2; UI render: GL; 
TinderBox: Win-x86@62-TDF, Branch:MASTER, Time: 2017-04-24_23:35:22
Locale: nl-NL (nl_NL); Calc: CL

However, I'm not sure if this is an DOCX import bug. LibO doesn't allow to create a (condensed) spacing below -2,0 in any way whatsoever.
Comment 3 Yousuf Philips (jay) (retired) 2017-04-25 18:10:03 UTC
(In reply to Telesto from comment #2)
> However, I'm not sure if this is an DOCX import bug. LibO doesn't allow to
> create a (condensed) spacing below -2,0 in any way whatsoever.

Yes not allowing below -2pt is worthless if you have large text.

@Khaled: Any thoughts?
Comment 4 Yousuf Philips (jay) (retired) 2017-06-28 13:40:46 UTC
*** Bug 108785 has been marked as a duplicate of this bug. ***
Comment 5 Dieter 2017-06-28 13:56:24 UTC
> However, I'm not sure if this is an DOCX import bug. LibO doesn't allow to
> create a (condensed) spacing below -2,0 in any way whatsoever.

Perhaps there are two issues, which are not exacty the same:
a) DOCX import with a spacing below -2,0pt
b) Allow a spacing below 2,0pt in LO (as proposed in bug 108785)

So I think the summary should be more precise.
Comment 6 V Stuart Foote 2017-06-28 16:47:41 UTC
*** Bug 108785 has been marked as a duplicate of this bug. ***
Comment 7 V Stuart Foote 2017-06-28 16:57:14 UTC
Issue as implemented SetFixKerning()/GetFixKerning used in SVX and edit engine.

SID_ATTR_CHAR_KERNING
and
EE_CHAR_KERNING

So affecting ALL modules.

But not clear to me where we are limiting the Xstretch negative to -2.0 (as points converted to twips) but should be able to bump that up to -100 for kerning of really large font sizes.
Comment 8 V Stuart Foote 2017-06-28 17:23:38 UTC
converting the Word 2007 OOXML (attachment 132811 [details]) to ODF with Word 2016, LibreOffice 5.3.3.2 retains the fo:letter-spacing of the MSO spacing value. Exactly same handling with import filter opening into 5.3.3.2

So it is _not_ an issue with the DOCX/OOXML import filter.

Rather, edit engine rendering to document canvas does not reduce Xspacing/Fixed Kerning below the 2.0pt value--either when rendering or as limited in the SpinBox GUI.



Snippets from the OOXML -> ODF -> .fodt

 <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Normal" style:master-page-name="MP0">
   <style:paragraph-properties style:page-number="auto" fo:break-before="page"/>
  </style:style>
  <style:style style:name="T1" style:family="text">
   <style:text-properties fo:letter-spacing="-0.0071in"/>
  </style:style>
  <style:style style:name="T2" style:family="text">
   <style:text-properties fo:letter-spacing="-0.0138in"/>
  </style:style>
  <style:style style:name="T3" style:family="text">
   <style:text-properties fo:letter-spacing="-0.028in"/>
  </style:style>
  <style:style style:name="T4" style:family="text">
   <style:text-properties fo:letter-spacing="-0.0417in"/>
  </style:style>

   <text:p text:style-name="P1">Spacing - <text:span text:style-name="Default_20_Paragraph_20_Font"><text:span text:style-name="T1">Condensed 0.5pt</text:span></text:span>, <text:span text:style-name="Default_20_Paragraph_20_Font"><text:span text:style-name="T2">Condensed 1pt</text:span></text:span>, <text:span text:style-name="Default_20_Paragraph_20_Font"><text:span text:style-name="T3">Condensed 2pt</text:span></text:span>, <text:span text:style-name="Default_20_Paragraph_20_Font"><text:span text:style-name="T4">Condensed 3pt</text:span></text:span></text:p>
  </office:text>
Comment 9 Yousuf Philips (jay) (retired) 2017-06-30 16:38:05 UTC
(In reply to V Stuart Foote from comment #8)
> Rather, edit engine rendering to document canvas does not reduce
> Xspacing/Fixed Kerning below the 2.0pt value--either when rendering or as
> limited in the SpinBox GUI.

Yes i assumed it was an issue with the spinbox and not the importer and that was the reason why i was asking for Khaled's input in comment 3, and also didnt meta tag this bug to the DOCX meta bug. :D
Comment 10 ⁨خالد حسني⁩ 2017-07-01 11:58:04 UTC
(In reply to Yousuf Philips (jay) from comment #3)
> (In reply to Telesto from comment #2)
> > However, I'm not sure if this is an DOCX import bug. LibO doesn't allow to
> > create a (condensed) spacing below -2,0 in any way whatsoever.
> 
> Yes not allowing below -2pt is worthless if you have large text.
> 
> @Khaled: Any thoughts?

No idea. Such spacing is done by manipulating the DX array by the calling sites, the layout engine knows nothing about it.
Comment 11 V Stuart Foote 2018-03-24 13:52:33 UTC
*** Bug 116600 has been marked as a duplicate of this bug. ***
Comment 12 Telesto 2018-03-24 14:57:55 UTC
Quote bug 116600 comment 1

In version 4 it was named "condensed" and the limit had been relative to font-size, about 1/6.
Version: 4.5.0.0.alpha0+
Build ID: 40b1e8266e47792d354cd457c652bfb0f0a21e69
TinderBox: Win-x86@62-TDF, Branch:MASTER, Time: 2015-02-11_00:13:43
Locale: de_DE

In version 5.4 it is named "spacing" with negative values and shows the described problem. Version: 5.4.3.2 (x64)
Build ID: 92a7159f7e4af62137622921e809f8546db437e5
CPU threads: 8; OS: Windows 6.19; UI render: default; 
Locale: de-DE (de_DE); Calc: CL
Comment 13 Telesto 2018-03-24 15:16:13 UTC
Created attachment 140856 [details]
Bibisect log

Bisected to

author	Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>	2016-04-22 15:22:03 +0200
committer	Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>	2016-04-22 14:47:54 +0000
commit 9a745d54a5c7470180f41494283983a3b8b84a51 (patch)
tree b5ce765cfdd1ba1faa93480aa8f3cd54c6d4e838
parent 3ae1e174014fc708833f3b43682573de1650af56 (diff)
tdf#89953 Character spacing: Allow to enter negative values
without selecting from a condensed/expanded listbox first.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=9a745d54a5c7470180f41494283983a3b8b84a51
Comment 14 V Stuart Foote 2018-03-24 15:47:12 UTC
Not clear how the .UI's <lower> -2 entry [1] is actually applied. As font size increases the reduced spacing is increased proportionally. So it is not an absolute -2 point unit. It is being scaled.

That handling needs to be understood before simply increasing the minimum value in the UI spinbox. Concern would be what happens to smaller font sizes when the negative Spacing is set larger than the font size? Will it happily just compose each glyph on top of the preceeding--or will it crash?

=-ref-=
[1] https://opengrok.libreoffice.org/xref/core/cui/uiconfig/ui/positionpage.ui?#21
Comment 15 ⁨خالد حسني⁩ 2018-03-24 16:44:29 UTC Comment hidden (obsolete)
Comment 16 ⁨خالد حسني⁩ 2018-03-24 16:44:49 UTC
(In reply to Khaled Hosny from comment #15)
> Old limit was relative to font size (see code removed in the commit above),
> new limit is hard-coded to -1.

I meant -2.
Comment 17 Xisco Faulí 2018-06-05 19:35:58 UTC Comment hidden (obsolete)
Comment 18 V Stuart Foote 2020-10-25 20:29:17 UTC
*** Bug 137296 has been marked as a duplicate of this bug. ***
Comment 19 TH 2020-10-26 00:31:14 UTC
Here is my input on this bug / serious issue from what was apparently a "duplicate."  Note that for me, this is a showstopper in terms of being able to use my necessary font for titles, as the font's normal kerning is awful, automatic doesn't help, and reducing character spacing is too limited (due to the bug / issue in LibreOffice) to help.  This forces me to use a different font, which I really don't think I can do in this case, or use a different word processor like MS Word, which I'd prefer to avoid if possible.

Description:
Artificial character spacing limitation of -2.0 points (next to Kerning) is INSUFFICIENT for a font like Lucida Casual when using Small Caps for a word like "The".  Need at least flexibility to go to -14.0 points.

In a word like "The" for a title using a font such as Lucida Casual (e.g., Regular), which is available for download at https://fontsgeek.com/fonts/Lucida-Casual-Regular , it is NOT possible to properly kern the characters "Th" when using Drop Caps with a hard limit of -2.0 (minus 2.0).  There is no good reason for such a hard limit condensing the space.  We can expand spacing (going the other direction) far beyond 2.0; here we need to be able to condense the spacing beyond -2.0 (e.g., to -14.0) to get the desired pair kerning for "Th" using Drop Caps.  This limitation, if it remains a hard limit like this, forces use of another word processor (e.g., MS Word) just to produce the title on a page using such a font.  (That happens to be the font I HAVE to use in my case.)

Steps to Reproduce:
1. Download and install Lucida Casual font (regular and italic), getting it from https://fontsgeek.com/fonts/Lucida-Casual-Regular
2. Add a 42-point title such as "The Document in LibreOffice" to a page, select it, and while it's selected, go to Character -> Character... -> Font Effects, and specify "Small capitals".
3. Select "Th" in the title text, go to Character -> Character... -> Position -> Character Spacing, and there enter the highest NEGATIVE number you can in Writer, which currently has a hard limit of "-2.0 pt".  Look at the result, which is UNSATISFACTORY.

Actual Results:
With a hard limit of -2.0 pt for condensing text such as "Th" using small capitals in a title with the word "The", we CANNOT get sufficient reduction in the space between the "T" and "h" to achieve proper kerning.  We need to be able to enter a higher negative value to achieve tighter kerning, such as -12.0 or -14.0, in this case.

Expected Results:
I need and want to be able to further decrease the space between characters, beyond what the strange hard limit of -2.0 can achieve.  (Lucida Casual is NOT the only font with such an issue in LibreOffice, it's just the one I need to immediately address in this context.)

Reproducible: Always

Additional Info:
There are two downloadable versions of the Lucida Casual font at https://fontsgeek.com/fonts/Lucida-Casual-Regular , each with Regular and Oblique styles.  Either one of those downloadable fonts will suffice to demonstrate the above issue / unnecessary limitation.  (I would prefer to not have to go to a paid word processor such as MS Word to do the title, which is currently the only reasonable workaround.)

P.S.  See the cover of the book "The AntiChrist and a Cup of Tea" (or its title page if you can find that somewhere) for an example of the desired kerning, which cannot currently be achieved in LibreOffice due to the hard limit of -2.0 pt for condensed character spacing:  https://www.amazon.com/Antichrist-Cup-Tea-Tim-Cohen/dp/0966279301/ref=sr_1_1?dchild=1&keywords=antichrist+and+a+cup+of+tea&qid=1602003724&sr=8-1

IS THERE SOMEONE AVAILABLE WHO COULD FIX THIS KERNING LIMITATION IN LIBREOFFICE.  IT'S BEEN OVER TWO YEARS NOW SINCE IT WAS REPORTED....
Comment 20 Telesto 2020-10-26 09:11:49 UTC
(In reply to TH from comment #19)
> IS THERE SOMEONE AVAILABLE WHO COULD FIX THIS KERNING LIMITATION IN
> LIBREOFFICE.  

I do get they 'frustration', but take also in consideration: 
(A) We have to manage with limited resources. (which not specific to LibreOffice). So there are priority's and such.  And LibreOffice being a free product restricting the resources even further (else we could hire paid developers). 
(B) They bug tracker is pretty large; so enough to be fixed.
(C) Everybody has it's own show stopper bugs (or pets). 

There is option for professional support. Which likely to solve this within a 'blink of they eye' [1]. Except you need deep pockets to pay for that. And looks like nobody has considered 'worth it' currently. Not really unexpected as it's really expensive.
Or fix the code yourself (which maybe cheaper). Except you need to now how to code and you to invest time in it.

[1] https://libreoffice.org/get-help/professional-support/
Comment 21 TH 2020-11-05 22:19:52 UTC
Created attachment 167047 [details]
Apache OpenOffice 4.1.7 handles this pair kerning better (but with artificial limit of 7 which is also too small), so code changed in LibreOffice!

Apache OpenOffice 4.1.7 (the latest version) handles pair kerning better, based upon its older code, but likewise has an artificial limit equivalent to "-7", which also is insufficient.  (We need to be able to go to at least -16 with some fonts.)  All this is to say, it is highly unlikely that allowing -7 now in LibreOffice 7.x would present any sort of issue, and really, a limit of -16 should be allowed and workable, with only a very minor change to an XML value in a file.  I am not set up to make that change, and it would take me a lot of time to get set up, but one of you folks who regularly work on bugs / issues in LibreOffice should be able to make it very quickly, and I would be only too happy to thoroughly test the change / fix and report back.
Comment 22 RB 2021-09-21 22:19:18 UTC
I am having the same issue with character spacing being limited to greater than -2.0 pts. After looking around in the source code on git.libreoffice.org, I think I found where the issue might be:

https://git.libreoffice.org/core/+/refs/heads/master/cui/source/tabpages/chardlg.cxx

1248        // based on the current height:
1249        //      - negative until minimum of 2 pt
1250        //      - positive until maximum of 999 pt
1251        _pFontSizeLB->EnablePtRelativeMode( sal::static_int_cast< short >(-(nCurHeight - 20)), (9999 - nCurHeight) );

I have never worked on a major piece of software like this before, nor do I have any of the development tools set up, so I don't think I can fix this myself.
Comment 23 Dieter 2022-02-23 21:58:17 UTC
*** Bug 147619 has been marked as a duplicate of this bug. ***
Comment 24 Commit Notification 2022-11-10 07:31:43 UTC
Samuel Mehrbrodt committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7f4f536ca9195c7d53463527f00897b65d062486

tdf#107405 Allow kerning less than -2

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.
Comment 25 Commit Notification 2022-11-10 10:13:59 UTC
Samuel Mehrbrodt committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/cb566ac3e1439f2afe883aacc30da3d3cb6343ec

tdf#107405 Allow kerning less than -2

It will be available in 7.4.4.

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.
Comment 26 TH 2023-06-01 00:05:06 UTC
There is NOW an artificial character spacing limitation of -7.0 points (next ot Kerning), and just like the prior -2.0 points artificial limitation, that is NOT SUFFICIENT—as I stated in my original comments.  To be sure, -7.0 points is better than -2.0, but still is NOT SUFFICIENT and does NOT permit larger font sizes to be sufficiently kerned when dealing with a mixture of upper-case and small-caps.  See my original (BELOW) comments and NOTE regarding this:

Here is my input on this bug / serious issue from what was apparently a "duplicate."  Note that for me, this is a showstopper in terms of being able to use my necessary font for titles, as the font's normal kerning is awful, automatic doesn't help, and reducing character spacing is too limited (due to the bug / issue in LibreOffice) to help.  This forces me to use a different font, which I really don't think I can do in this case, or use a different word processor like MS Word, which I'd prefer to avoid if possible.

Description:
Artificial character spacing limitation of -2.0 points (next to Kerning) is INSUFFICIENT for a font like Lucida Casual when using Small Caps for a word like "The".  Need at least flexibility to go to -14.0 points.

In a word like "The" for a title using a font such as Lucida Casual (e.g., Regular), which is available for download at https://fontsgeek.com/fonts/Lucida-Casual-Regular , it is NOT possible to properly kern the characters "Th" when using Drop Caps with a hard limit of -2.0 (minus 2.0).  There is no good reason for such a hard limit condensing the space.  We can expand spacing (going the other direction) far beyond 2.0; here we need to be able to condense the spacing beyond -2.0 (e.g., to -14.0) to get the desired pair kerning for "Th" using Drop Caps.  This limitation, if it remains a hard limit like this, forces use of another word processor (e.g., MS Word) just to produce the title on a page using such a font.  (That happens to be the font I HAVE to use in my case.)

Steps to Reproduce:
1. Download and install Lucida Casual font (regular and italic), getting it from https://fontsgeek.com/fonts/Lucida-Casual-Regular
2. Add a 42-point title such as "The Document in LibreOffice" to a page, select it, and while it's selected, go to Character -> Character... -> Font Effects, and specify "Small capitals".
3. Select "Th" in the title text, go to Character -> Character... -> Position -> Character Spacing, and there enter the highest NEGATIVE number you can in Writer, which currently has a hard limit of "-2.0 pt".  Look at the result, which is UNSATISFACTORY.

Actual Results:
With a hard limit of -2.0 pt for condensing text such as "Th" using small capitals in a title with the word "The", we CANNOT get sufficient reduction in the space between the "T" and "h" to achieve proper kerning.  We need to be able to enter a higher negative value to achieve tighter kerning, such as -12.0 or -14.0, in this case.

Expected Results:
I need and want to be able to further decrease the space between characters, beyond what the strange hard limit of -2.0 can achieve.  (Lucida Casual is NOT the only font with such an issue in LibreOffice, it's just the one I need to immediately address in this context.)

Reproducible: Always

Additional Info:
There are two downloadable versions of the Lucida Casual font at https://fontsgeek.com/fonts/Lucida-Casual-Regular , each with Regular and Oblique styles.  Either one of those downloadable fonts will suffice to demonstrate the above issue / unnecessary limitation.  (I would prefer to not have to go to a paid word processor such as MS Word to do the title, which is currently the only reasonable workaround.)

P.S.  See the cover of the book "The AntiChrist and a Cup of Tea" (or its title page if you can find that somewhere) for an example of the desired kerning, which cannot currently be achieved in LibreOffice due to the hard limit of -2.0 pt for condensed character spacing:  https://www.amazon.com/Antichrist-Cup-Tea-Tim-Cohen/dp/0966279301/ref=sr_1_1?dchild=1&keywords=antichrist+and+a+cup+of+tea&qid=1602003724&sr=8-1

IS THERE SOMEONE AVAILABLE WHO COULD FIX THIS KERNING LIMITATION IN LIBREOFFICE.  IT'S BEEN OVER TWO YEARS NOW SINCE IT WAS REPORTED....

=============================================
NOTE: Apache OpenOffice 4.1.7 handles this pair kerning better (but with artificial limit of 7 which is also too small), so code changed in LibreOffice!

Apache OpenOffice 4.1.7 (the latest version) handles pair kerning better, based upon its older code, but likewise has an artificial limit equivalent to "-7", which also is insufficient.  (We need to be able to go to at least -16 with some fonts.)  All this is to say, it is highly unlikely that allowing -7 now in LibreOffice 7.x would present any sort of issue, and really, a limit of -16 should be allowed and workable, with only a very minor change to an XML value in a file.  I am not set up to make that change, and it would take me a lot of time to get set up, but one of you folks who regularly work on bugs / issues in LibreOffice should be able to make it very quickly, and I would be only too happy to thoroughly test the change / fix and report back.
Comment 27 TH 2023-06-01 00:09:45 UTC
NOTE 2:  The PREVIEW in the dialog DOES show kerning less than -7.0pt (e.g., it SHOWS all the way to -16.0pt, for example).  BUT THE DOCUMENT TEXT ITSELF DOES NOT KERN BELOW -7.0pt.
Comment 28 Samuel Mehrbrodt (allotropia) 2023-06-01 06:16:10 UTC
(In reply to TH from comment #26)
> There is NOW an artificial character spacing limitation of -7.0 points

Please open a new bug report for that problem. The problem reported here is fixed.