Bug 162984 - LibreOffice uses fake small caps even when font supports true small caps
Summary: LibreOffice uses fake small caps even when font supports true small caps
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL: https://ask.libreoffice.org/t/small-c...
Whiteboard:
Keywords:
Depends on:
Blocks: Font-Rendering Font-Effects
  Show dependency treegraph
 
Reported: 2024-09-16 08:39 UTC by Alina
Modified: 2024-10-14 13:00 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
Example of true and fake small caps compared (10.21 KB, image/png)
2024-09-16 08:42 UTC, Alina
Details
SmallCaps by effect and font feature - Writer (211.15 KB, image/png)
2024-09-16 13:06 UTC, V Stuart Foote
Details
SmallCaps by effect and font feature - Draw (18.39 KB, image/png)
2024-09-16 13:07 UTC, V Stuart Foote
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alina 2024-09-16 08:39:35 UTC
Description:
LibreOffice's small cap formatting uses fake small caps even when true small caps are available in the selected font. This is generally considered bad typesetting as the strokes of the fake small caps are too thin compared to the other letters.

Steps to Reproduce:
1. Select a font supporting true small caps (e.g. Libertinus Serif, Source Serif Pro)
2. Create true small caps by changing the font name to "[Font name]:smcp" (this selects the small caps OpenType feature)
3. Compare to small caps create by LibreOffice by selecting small caps text formatting (Format > Text > Small Caps)

Actual Results:
Fake small caps are created by scaling down the capitals.

Expected Results:
True small caps from the font should be used.


Reproducible: Always


User Profile Reset: No

Additional Info:
There is a workaround by changing the font name to "[font name]:smcp".
Comment 1 Alina 2024-09-16 08:42:52 UTC
Created attachment 196467 [details]
Example of true and fake small caps compared

Example using Source Serif Pro in LibreOffice.
The first line uses true small caps. The second fake small caps created by the LibreOffice Small Caps Formatting.
Comment 2 V Stuart Foote 2024-09-16 12:06:43 UTC
Confirmed. However not clear this is really an issue needing to be corrected.

When font supported SmallCaps (Graphite/OTF :smcp) is provided by font, using that feature is now supported across the modules (as for bug 98367 wef 24.2.0 release). Simply use the font feature (via 'Character...' dialog button) if true SmallCaps are available.

Otherwise, alternative of applying SVX generated SmallCaps character effect currently overrides application of the Graphite/OpenType font feature when applied--and only testing if character is a capital or not and transliterating and scaling.

IINM correcting to preferentially use :smcp support would require the "effect" test each span's font for a valid font feature--either using the SVX transliteration or honoring the :smcp table. 

Makes it much more complex. Yes it could provide better typesetting, but not clear what is the best for ODF.

@Caolán, Khaled, Tomaž --any thoughts on need for tweaking svxfont for this?
Comment 3 V Stuart Foote 2024-09-16 13:06:51 UTC
Created attachment 196479 [details]
SmallCaps by effect and font feature - Writer
Comment 4 V Stuart Foote 2024-09-16 13:07:27 UTC
Created attachment 196480 [details]
SmallCaps by effect and font feature - Draw
Comment 5 Sascha 2024-09-17 08:24:48 UTC
I have been struggling with this bug for a long time myself.

Reasons why this is an issue:

1. It messes with character width on monospaced fonts.

2. It's just outright bad typography, as stated initially.

Having this issue fixed would really be appreciated.
Comment 6 Emily Bowman 2024-09-17 16:41:00 UTC
"1. It messes with character width on monospaced fonts." is a legitimate issue with the current rendering path. If replacing the current method is off the table (which I can understand as a low priority given that a workaround exists) then it should be raised as a separate bug.

It's just unfortunate that the way to get in-font small caps is fairly obtuse and undiscoverable.
Comment 7 V Stuart Foote 2024-09-17 18:55:56 UTC
(In reply to Sascha from comment #5)
(In reply to Emily Bowman from comment #6)
> "1. It messes with character width on monospaced fonts."

Come on really? Could someone maybe identify a Monospaced font with OTF :smcp table support. I sure can't...
Comment 8 Sascha 2024-09-23 12:18:47 UTC
> Come on really? Could someone maybe identify a Monospaced font with OTF
> :smcp table support. I sure can't...

Triplicate is a pretty popular one: https://practicaltypography.com/triplicate.html
Comment 9 V Stuart Foote 2024-09-23 13:31:05 UTC
(In reply to Sascha from comment #8)
> > Come on really? Could someone maybe identify a Monospaced font with OTF
> > :smcp table support. I sure can't...
> 
> Triplicate is a pretty popular one:
> https://practicaltypography.com/triplicate.html

Too rich for my blood...

Should have qualified a SIL licensed FLOSS relevant Monospaced font with OTF :smcp support.

Otherwise, if font supports :scmp user can/should just enable it via Character dialog's Features... button for the selection/paragraph they're working on. Or directly enter it in the font listbox (TB or SB).

Enhancement of auto-detection that font supports :smcp feature and applying via Font Effects 'Small capitals' Case selection is feasible but not much of a priority.

Pass it on for UX-advise for a decision on enhancement.
Comment 10 Heiko Tietze 2024-09-23 13:45:53 UTC
This is a topic for Jonathan.
Comment 11 Sascha 2024-09-23 14:13:23 UTC
> Otherwise, if font supports :scmp user can/should just enable it via
> Character dialog's Features... button for the selection/paragraph they're
> working on. Or directly enter it in the font listbox (TB or SB).

Far as I can tell, that still makes it impossible to do a RegEx Search/Replace on this type of small caps? This is something we regularly do to implement XML-type layout tags in our (mono-spaced) manuscripts.
Comment 12 V Stuart Foote 2024-09-23 15:36:04 UTC
(In reply to Sascha from comment #11)
> 
> Far as I can tell, that still makes it impossible to do a RegEx
> Search/Replace on this type of small caps? This is something we regularly do
> to implement XML-type layout tags in our (mono-spaced) manuscripts.


With SVX generated small-caps

<style:text-properties fo:font-variant="small-caps" style:font-name="Libertinus Serif"

vs. using Graphite/OTF feature of font

<style:text-properties style:font-name="Libertinus Serif:smcp"

don't see an issue for regex scripted modification in the XML, one to the other or just activating the OTF feature when supported. 

While in UI the <Ctrl>+H 'Find and Replace' dialog Format/Noformat toggle of the Find field and the Replace field, allows GUI search for the Font Attribute and replacement with a font supporting the OTF feature.
Comment 13 ⁨خالد حسني⁩ 2024-09-30 18:09:55 UTC
I think there would be several issues that need to be tackled with this:

1. It is a breaking change that can cause text to re-flaw, so might need a compatibility flag.
2. Other office suites will be using fake small caps, so that is another comparability consideration.
3. Even if the cont has smallcaps feature(s), they might not cover all input text, so users might get mixed small caps and lowercase letters, while with fake small caps that does not happen.
4. Case mapping can be non-trivial and locale-dependent, with fake small caps we use our case mapping code to convert lowercase to uppercase, while when using smcp feature it is up to the font to do this, which it might or might not handle correctly. Think of Turkish ıi->Iİ or German ß->SS/ẞ.
  - A solution for this would be to uppercase the text first then apply “c2sc” feature instead of “smcp” feature, but not all fonts that have “smcp” has “c2sc”.

Because of these complexities, even typographically oriented applications like InDesign offer two separate small caps functionalities, one that does fake small caps like LibreOffice and and OpenType one hidden away in the OpenType menu.
Comment 14 Sascha 2024-10-14 13:00:43 UTC
Actually, InDesign uses the proper small caps even with the standard format. There's additional functionality hidden away in the OpenType menu as you say (like "all lower-case small caps"), but it'll always use the true small caps if they're available.