Bug 152537 - No obvious UI to set the document default font used e.g. in Line Numbering
Summary: No obvious UI to set the document default font used e.g. in Line Numbering
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.4.3.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Line-Numbering
  Show dependency treegraph
 
Reported: 2022-12-16 06:12 UTC by Seán Ó Séaghdha
Modified: 2023-06-06 19:48 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Screencast (1.52 MB, image/gif)
2023-01-09 17:42 UTC, Mike Kaganski
Details
A minimized FODT from a real document with non-standard default-style affecting page background (966 bytes, application/vnd.oasis.opendocument.text)
2023-04-07 20:39 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Seán Ó Séaghdha 2022-12-16 06:12:54 UTC
Description:
If you start a new document & change the Default Paragraph Style, the font apparently applied to Character Styles does not change, i.e. in the list box and dialogs they appear with the previous Default Paragraph Style font.  Mostly this is not actually applied, but for line numbers the previous font is used.  For other character styles this just leads to confusing UI.  If a font is not actually defined, then it should be shown in the dialog as ‘undefined’ not as a font that is otherwise not used in the document.

Steps to Reproduce:
1. Open new document
2. Change font in Default Paragraph Style
3. Add some lines of text
4. Enable Line Numbers

Actual Results:
Line numbers are shown in the font of the previous Default Paragraph Style

Expected Results:
Line numbers should be shown in the font defined in the current Default Paragraph Style, or the Character Style if defined.


Reproducible: Always


User Profile Reset: No

Additional Info:
The UI for Character Styles should also show the actual font that will be used and dialogs should accurately report that a font has not been defined for a style, not default to some font that may have once been applied.
Comment 1 Mike Kaganski 2022-12-16 07:03:42 UTC Comment hidden (obsolete)
Comment 2 Seán Ó Séaghdha 2022-12-16 07:06:55 UTC
The ‘duplicate’ bug does not mention the wrong font being used for line numbers.
Comment 3 Mike Kaganski 2022-12-16 07:33:53 UTC
(In reply to Seán Ó Séaghdha from comment #2)
> The ‘duplicate’ bug does not mention the wrong font being used for line
> numbers.

Character styles do *not* depend on the Default Paragraph Style. Instead, when they do not define a property (directly or through inheritance), the used property value is taken from the *actual* paragraph properties where the character style is applied (be it a direct paragraph-level formatting, or *any* paragraph style used there).

And in the *Line Numbering* very special case, the character style is *not* applied to any paragraph in the text, with some paragraph-level properties. Instead, it is used in a special area (generated aside from the text), and thus it depends on a *global default*, not defined through styles in any document. In LibreOffice, the global default is defined through Options->Writer->Basic Fonts. That setting page, unfortunately, has a *separate* effect of *also* defining the Default Paragraph Style (and other styles) font, but that is the unfortunate and is tracked elsewhere.

This is not a bug. A possible improvement could add an explicit font definition to this specific character style, because of its special usage, so that user would not face some global defaults.
Comment 4 Mike Kaganski 2022-12-16 07:40:38 UTC
(In reply to Mike Kaganski from comment #3)
> thus it depends on a *global default*, not defined through styles in any
> document.

Or rather, defined by a special <style:default-style style:family="paragraph"> setting in documents, that is not exposed in the UI other than by the mentioned Options->Writer->Basic Fonts, which combines setting the *three* things: global application default used for new documents, 'style:default-style' for current document, and also "Default Paragraph Style" of the current document.
Comment 5 Seán Ó Séaghdha 2022-12-16 07:44:14 UTC
It may not be a bug in the strict sense of a malfunction, but it certainly looks and functions like a bug to the end user.  Having mysterious external defaults just makes Writer look unpredictable.
Comment 6 Mike Kaganski 2022-12-16 08:22:11 UTC
(In reply to Seán Ó Séaghdha from comment #5)
Having mysterious external defaults just makes Writer look unpredictable.

Sure.
If you want to make this issue focused on that aspect, it's OK. However, it depends on Options dialog defining some document-specific settings (bug 43786, bug 105751, bug 144814, bug 151918); and also it needs some consideration how exactly to expose that special set of 'style:default-style' elements in the UI. That needs some UX consideration; actually, I had never thought if we should add a top-level entry for all out styles, which would represent those elements and serve as the true inheritance root.

I set it to NEW, and ask for UX feedback; please note that this implies that we have some "really default paragraph style" entry above the existing "Default Paragraph Style", representing the two ODF elements 'style:default-style style:family="paragraph"' and 'style:style style:name="Standard" style:family="paragraph"', respectively.
Comment 7 Mike Kaganski 2022-12-16 08:26:36 UTC
(In reply to Mike Kaganski from comment #6)
> I set it to NEW, and ask for UX feedback; please note that this implies that
> we have some "really default paragraph style" entry above the existing
> "Default Paragraph Style"

Or we really should have all such defaults gathered in a separate Document Properties dialog, where such "really default styles" could be put as a special case, with the properties in the Options only defining global default for new documents.
Comment 8 Eyal Rozenberg 2022-12-16 14:24:04 UTC Comment hidden (obsolete)
Comment 9 Mike Kaganski 2022-12-16 14:43:32 UTC
(In reply to Eyal Rozenberg from comment #8)
> 3. ...
> 
> 4. ...
> 
> 5. ...
> 
> 6. ...

I don't see how the size is so important for this issue, which was initially filed with an incorrect user assumption that LN settings depend on Default Paragraph Style (no), and then grew to the need to *introduce* an UI for the actual source of those settings. And in fact, all this is not really related to the LN; this feature just happen to highlight the problem of no UI for the really default (paragraph/frame/whatever) settings, which are stored in the document as special "default-styles", but are inaccessible for user, except for *some* pieces in the most awkward place.
Comment 10 Eyal Rozenberg 2022-12-16 15:30:07 UTC
(In reply to Mike Kaganski from comment #9)
> I don't see how the size is so important for this issue

You're right, I was subconsciously focused on the size issue because of #0, #6)"
   href="show_bug.cgi?id=152548">bug 152548.

> And in fact, all this is not really related
> to the LN; this feature just happen to highlight the problem of no UI for
> the really default (paragraph/frame/whatever) settings, which are stored in
> the document as special "default-styles", but are inaccessible for user,
> except for *some* pieces in the most awkward place.

Hmm. Well, my focus was on setting the font used in LN specifically - and in the current document, not the default for future documents. Do you think I should make that into a separate bug?
Comment 11 Mike Kaganski 2022-12-16 16:31:00 UTC
(In reply to Eyal Rozenberg from comment #10)
> Hmm. Well, my focus was on setting the font used in LN specifically - and in
> the current document, not the default for future documents. Do you think I
> should make that into a separate bug?

If you think there's an issue here, then yes, please do (I myself feel it's OK, because the special treatment of one single style property used for this function does not make the idea of character style for the feature totally wrong/inconsistent/otherwise bad; numerous other properties are perfectly applicable, and the special treatment is rather a LN feature specific - but it's just my personal opinion).
Comment 12 Seán Ó Séaghdha 2022-12-17 06:17:04 UTC
I’m curious now about how this situation came about.  What is the use case for having separate styles ('style:default-style style:family="paragraph"' and 'style:style style:name="Standard" style:family="paragraph"')?

Is this just because styles in the interface require a name?  But since it’s not the name that’s shown anyway...

How is having these separate styles actually useful? (ignoring for the moment the complexity of collapsing them)
Comment 13 Mike Kaganski 2022-12-17 06:52:57 UTC
(In reply to Seán Ó Séaghdha from comment #12)
> I’m curious now about how this situation came about.  What is the use case
> for having separate styles ('style:default-style style:family="paragraph"'
> and 'style:style style:name="Standard" style:family="paragraph"')?

'style:style style:name="Standard" style:family="paragraph"' is a normal paragraph style. It may be used as an ancestor in inheritance hierarchy; but it is not a required hierarchy root. Any paragraph style may be set to not inherit from *any style*, and become a root of own inheritance hierarchy (creating a "forest" of paragraph style hierarchy trees).

From the file format point of view, the need to store the defaults applicable to *any* style of a given family (paragraph/text/...) that does not define a property in its inheritance tree requires such 'style:default-style' elements. They *allow* (but do not force) to create files that do not depend on user settings and/or program versions (which may change the defaults).

The documentation for style:default-style is at
https://docs.oasis-open.org/office/OpenDocument/v1.3/OpenDocument-v1.3-part3-schema.html#element-style_default-style.
Comment 14 Heiko Tietze 2023-01-09 12:40:54 UTC
(In reply to Mike Kaganski from comment #4)
> Or rather, defined by a special <style:default-style
> style:family="paragraph"> setting in documents...

(In reply to Mike Kaganski from comment #6)
> I set it to NEW, and ask for UX feedback...

needsUXEval requires CC ux-advice@...

To recap STR:
1. Tools > Options > Writer > Basic Fonts: Default = something ridiculous
2. Some text, line number on => line numbers follow the paragraph default
3. Change Default Paragraph Style back to Liberation Sans, or the like => line numbering follows (I read the discussion as if it doesn't)

What am I doing differently?

Version: 7.4.3.2 / LibreOffice Community
Build ID: 40(Build:2)
CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (en_US.UTF-8); UI: en-US
7.4.3-4
Calc: threaded
Comment 15 Mike Kaganski 2023-01-09 13:10:33 UTC
(In reply to Heiko Tietze from comment #14)
> To recap STR:
> 1. Tools > Options > Writer > Basic Fonts: Default = something ridiculous
> 2. Some text, line number on => line numbers follow the paragraph default
> 3. Change Default Paragraph Style back to Liberation Sans, or the like =>
> line numbering follows (I read the discussion as if it doesn't)
> 
> What am I doing differently?

No idea, because you chose not to explain how you performed #3.
Comment 16 Heiko Tietze 2023-01-09 13:44:43 UTC
(In reply to Mike Kaganski from comment #15)
> (In reply to Heiko Tietze from comment #14)
> > 3. Change Default Paragraph Style back to Liberation Sans, or the like =>
> > line numbering follows (I read the discussion as if it doesn't)
> No idea, because you chose not to explain how you performed #3.

Stylist > right click > font... does it matter?
Comment 17 Mike Kaganski 2023-01-09 17:42:02 UTC
Created attachment 184545 [details]
Screencast

(In reply to Heiko Tietze from comment #16)
> Stylist > right click > font... does it matter?

Yes is does; and doing that through stylist (F11) exactly *shows* the issue of line numbering *not* following the font change. It would follow the change, *if* you used Tools > Options > Writer > Basic Fonts: Default again for #3.

So are you really sure you don't repro in your comment 14, when #3 uses your comment 16?
Comment 18 Regina Henschel 2023-01-09 19:27:51 UTC
The numbers used in "Line Numbering" are styled by the character style "Line Numbering". To change the font alter that style or select a different one and set the font there.

The line numbering dialog has a drop-down list to determine the to be used character style. That is similar to the list style dialog where you can determine the character style for the list numbering. So I thought that would be obvious, but apparently not.

Most (all?) of the predefined character styles do not set a font. That way the font defined in the paragraph where a portion of text is located is used when the character style is applied to that portion of text.

"Line Numbering" is different as the numbers are not inside a paragraph. But do we want line numbering to follow the paragraph of the same line, for example? That would result in different character styles in the column of line numbers when e.g. a block quote has a different font than the surrounding text, or when headings have a different font than the basic text. So I think, that would be no good solution.
Comment 19 Eyal Rozenberg 2023-01-09 20:55:03 UTC
(In reply to Regina Henschel from comment #18)
> "Line Numbering" is different as the numbers are not inside a paragraph. But
> do we want line numbering to follow the paragraph of the same line, for
> example? That would result in different character styles in the column of
> line numbers when e.g. a block quote has a different font than the
> surrounding text, or when headings have a different font than the basic
> text. So I think, that would be no good solution.

I agree. If there are different paragraphs with different font families, I don't want to see the LN font family change in the middle of the page.

But then, I also don't like to see the LN font _size_ change on the same page; I would expect to be able to choose whether LN font, including size, is made uniform over a full section. However... it seems that can't happen right now. But maybe that is a separate issue.
Comment 20 Heiko Tietze 2023-01-10 07:52:03 UTC
(In reply to Mike Kaganski from comment #17)
> Created attachment 184545 [details]

I think I was fooled by the fact that changing the Default PS affects Tools > Options > Basic Fonts.
Interestingly all/most CS keep the initial Default PS font, although it has no effect in most cases. Obviously not in case of Line Numbering.

It seems that we have a deeper problem - CS should follow / not modify the actual Default PS (instead of being initialized once), and a NAB situation for the line numbering - use Default PS and allow modification via CS "Line Numbering" (with another minor issue that this CS is not listed with applied styles).
Comment 21 Mike Kaganski 2023-01-10 10:53:37 UTC
Please let us split several problems apart, and avoid confusing situation of mixed discussions of different problems.

1. There is a problem of document properties (namely, various 'style:default-style') that specify various defaults used in many places, and are inaccessible for user (comment 4).
2. There is a problem of inconsistent behavior for controlling *one* aspect of *one* of those defaults (namely, font of paragraph's default-style) (much of related discussion in bug 152550).
3. There is a problem of inconsistent placement of the UI for #2 (also bug 152550 comment 6; also there is a generic bug 144814).
4. There is a problem (?) of the *size* of the line numbering (comment 19 seems to imply that it may change in the middle of a page, or at all?).
5. There is a problem (?) of discoverability of font control using the character style (comment 18 seems to imply that OP had problems related to that, while IMO the whole original problem is more like expectation that the default comes from Standard paragraph style, not from the hidden #1; also comment 20).
Comment 22 Regina Henschel 2023-01-10 12:16:31 UTC
(In reply to Mike Kaganski from comment #21)
> Please let us split several problems apart, and avoid confusing situation of
> mixed discussions of different problems.

I have written bug 152962 to extend the help about styling the numbers of a line numbering.
Comment 23 Mike Kaganski 2023-04-07 20:39:08 UTC
Created attachment 186537 [details]
A minimized FODT from a real document with non-standard default-style affecting page background

The attachment contains a minimal reproducer of the same problem. Namely, in https://forumooo.ru/index.php?topic=9750, a document appeared with page background set, but not active in the text body and header/footer, despite all the properties of page, paragraphs, and characters (style and direct) do not set the white background.

The problem is this:

  <style:default-style style:family="paragraph">
   <style:paragraph-properties fo:background-color="#ffffff"/>
  </style:default-style>

It defines the background, and it has *no* UI at all. User has no way to "fix" the document (or to set up such an effect themselves, if desired).

I don't know where the problematic document came from. Maybe it is generated by another ODF generator. But the lack of UI for the wide range of settings available in those style:default-style elements is bad.
Comment 24 Eyal Rozenberg 2023-06-06 19:48:26 UTC
Note my related comment in 153623, which is: This default font should not be used for font dialogs in Character Styles which don't define their own override font.