Bug 151121 - Need ability to determine which fallback font is used
Summary: Need ability to determine which fallback font is used
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: low minor
Assignee: Not Assigned
URL: https://unix.stackexchange.com/a/7218...
Whiteboard:
Keywords:
: 158296 (view as bug list)
Depends on:
Blocks: Font-Fallback
  Show dependency treegraph
 
Reported: 2022-09-22 09:56 UTC by Eyal Rozenberg
Modified: 2024-11-14 20:40 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eyal Rozenberg 2022-09-22 09:56:18 UTC
On Linux and with gtk3 (but probably also in other scenarios), when the font you chose doesn't have the appropriate glyphs for the language you're writing, a fallback font is typically used.

I want to know, both in the font selection dialog and later in the laid-out text, which fallback font(s) are used. It would also help if the indication marked

I don't have a good suggestion of the top of my head of how this information should be made available, but it should.
Comment 1 Rafael Lima 2022-09-22 12:37:11 UTC
Isn't this a dupe of bug 61134?
Comment 2 Heiko Tietze 2022-09-22 12:59:59 UTC

*** This bug has been marked as a duplicate of bug 61134 ***
Comment 3 Eyal Rozenberg 2022-09-22 15:04:36 UTC
No, this has nothing to do with font substitutions. This is relevant even when the user has not applied any font substitutions.
Comment 4 Telesto 2022-09-22 15:30:47 UTC
(In reply to Eyal Rozenberg from comment #0)
> On Linux and with gtk3 (but probably also in other scenarios), when the font
> you chose doesn't have the appropriate glyphs for the language you're
> writing, a fallback font is typically used.
> 
> I want to know, both in the font selection dialog and later in the laid-out
> text, which fallback font(s) are used. 

The font substitution is black box indeed. 

> It would also help if the indication marked
I have no clue what you tend to to say...

> I don't have a good suggestion of the top of my head of how this information
> should be made available, but it should.

At minimum in the Style Inspector, I guess
Comment 5 Caolán McNamara 2022-09-22 15:47:43 UTC
FWIW there are two levels of substitution.

Simple font substitution when the font isn't present at all which the top layers sort of know about enough already to indicate with the fontname shown in italic in the fontname boxes.

And glyph substitution where the font existed, but a glyph in it didn't. Higher levels know pretty much nothing about glyph substitution and some of the substitutions (driven by fontconfig) can be stuff like the bold variant doesn't have the glyph but the regular one does so the glyph sub is the regular version with fake "emboldening" applied to it.

bubbling up the info for a) probably isn't too hard, e.g. as tooltip info in fontbox, b) is probably a PITA to achieve.
Comment 6 Timur 2022-09-23 09:59:48 UTC
Reopened is wrong status, do not set. 
https://bugs.documentfoundation.org/page.cgi?id=fields.html#bug_status
Comment 7 Eyal Rozenberg 2022-09-23 10:26:53 UTC
(In reply to Timur from comment #6)
> Reopened is wrong status, do not set. 

Fair enough, but the link you gave doesn't say when "REOPENED" applies.


(In reply to Caolán McNamara from comment #5)
> FWIW there are two levels of substitution.

So, actually, I think you're describing three levels:

1. Font is missing altogether
2. Specific glyph is missing altogether (i.e. all variants)
3. Variant of glyph is missing (e.g. bold vs non-bold, italic vs roman)

and I might add another level 1.5" between (1.) and (2.), which would be an entire block on the Unicode plane missing (block e.g. in the sense of the Insert Special Character dialog).

My interest is mostly levels 1.5 and 2. , and to a lesser extent level 3. I, and I believe many users, need to know which font (family) is _actually_ used to render their text, or their text in a certain language:

1. To prevent cases of different rendering on another system due to  different fallbacks.
2. To be able to choose between font families for their text - rather than making the choice with the different options mis-represented: You think you've chosen font Foo but it's actually font Bar; then you continue down and notice that Baz seems to remind you of Foo a lot, but you don't know if it's because they're actually similar, or because they both fall bar to Bar.

Now, you said the "higher levels" aren't aware of this. But - we can definitely see which glyphs are available in which font, using the Insert Special Character dialog. Doesn't that mean that we _do_ have this visibility?
Comment 8 Eyal Rozenberg 2022-09-23 13:27:01 UTC
Adding a related bug regarding the font selection dialog - where the inability to tell whether a fallback font is used and which makes it difficult to select a font for writing in the language you're interested in.
Comment 9 Heiko Tietze 2022-11-22 12:12:52 UTC
As for the UI I would still recommend to use the same feedback mechanism for all kind of fallback.
Comment 10 Chris Sherlock 2023-11-21 10:34:31 UTC
This isn't just a problem in GTK. The fallback font is determined in OutputDevice::ImplGlyphFallbackLayout(), so it could actually be exposed. 

The question is - where to notify the end user what font is being used.
Comment 11 Stéphane Guillou (stragu) 2023-11-21 12:24:48 UTC
*** Bug 158296 has been marked as a duplicate of this bug. ***
Comment 12 Mike Kaganski 2023-11-21 13:20:39 UTC
FTR: XFontMappingUse Interface ( https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1awt_1_1XFontMappingUse.html ) allows to get the font substitution data.
Comment 13 Eyal Rozenberg 2023-11-24 21:43:38 UTC
(In reply to Chris Sherlock from comment #10)
> The question is - where to notify the end user what font is being used.

Well, it should probably be in more than one place, but - we already have a sort of notification that a whole font family is missing: The font family selection drop-down on the Formatting toolbar. When the family name is italicized, we know it's missing. So a tooltip when hovering over the family name is one place to do it - when the whole family is missing.

This doesn't help with single missing glyphs, though. Here are two ideas to cover that:

1. Additional information in the Style Inspector. It already shows the style and DF font family for a stretch of text or at the cursor; it should not be difficult to have a fallback-font-family in there.
2. An UNO command, which examines the selection and lists the fallbacks (and perhaps also substitutions) for all selected glyphs, in some simple dialog.
Comment 14 Eyal Rozenberg 2024-11-14 20:39:08 UTC
Adding Jonathan, in case he has an opinion on this.

What about having this information in the Style Inspector, for starters? That should be pretty innocuous, right?
Comment 15 Eyal Rozenberg 2024-11-14 20:40:07 UTC
For now, adding a link to instructions on how to determine this manually on the command-line.