Bug 108498 - Character styles not working against the underlying paragraph style
Summary: Character styles not working against the underlying paragraph style
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.3.3.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 140384 (view as bug list)
Depends on:
Blocks: Writer-Styles-Character
  Show dependency treegraph
 
Reported: 2017-06-13 03:42 UTC by Kenneth Hanson
Modified: 2023-11-08 09:34 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
sample doc (9.10 KB, application/vnd.oasis.opendocument.text)
2017-06-14 21:54 UTC, Yousuf Philips (jay) (retired)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kenneth Hanson 2017-06-13 03:42:07 UTC
It is my understanding that that character styles inherit from the default paragraph style. To see this, make a character style called "Small" with font size set to 80%, and apply it to some default text and a heading -- both will be the same size, 80% of the default style font size.

However, changes to default paragraph style seem not to propagate to character styles. For example, change the font size, say from 12pt to 20pt, and then create a "Small" character style as above and apply it. The result will be 10.8pt, not 18pt. Changing the order of these steps doesn't seem to make a difference. While creating or modifying any character style, the font size shown is also the old one (12 pt), which makes it pretty clear that something is not being updated.

Remembering some weirdness between paragraph styles and Basic Fonts menu that I experienced in the past, I tried manipulating the "default" font size from there. Sure enough, the changes are reflected in both the default paragraph and character styles, and the font size shown in the character style menus.

There are some complications, though. First, existing character styles with relative font sizes still aren't updated. This suggests that there may be an additional problem, like the relative font size being stored as an absolute one (though it still displays as a relative size in the interface).

Second, I recall times when after modifying the default paragraph style, subsequent changes through Basic Fonts had no effect. That is, until clicking, Default, Okay, then changing the font there once again. I can't replicate this at the moment, though.
Comment 1 Yousuf Philips (jay) (retired) 2017-06-14 21:52:24 UTC
Seems right that the percentage value defined in the character style should work against the value set that the paragraph style. But lets get an expert opinion.

Cor, Regina, Stuart: What's your take?
Comment 2 Yousuf Philips (jay) (retired) 2017-06-14 21:54:41 UTC
Created attachment 134036 [details]
sample doc
Comment 3 Kenneth Hanson 2017-06-14 23:41:29 UTC
I definitely think that (working against the current paragraph style, not the default) makes more sense. But I that's a separate issue, because right now it's not even working based off the default paragraph style, but something else, based on my tests.
Comment 4 Regina Henschel 2017-06-21 00:48:06 UTC
It should be based on its parent style.

It is in ODF 20.183fo:font-size
"In contrast to XSL, percentage values can be used within common styles only and are based on the font height of the parent style rather than to the font height of the attributes neighborhood. Absolute font heights and relative font heights are not supported."

So with the current fo:font-size it is not possible to base the character font-size on the paragraph in which the character is, which gets this style applied.

The percent values is written to file and the percent value is calculated, when the style is defined in the beginning. But the text in the document is not updated, when the font-size of the parent character style is changed.

If you revisit the character Font dialog page and click on OK without any changes, then the text in the document is updated.
Comment 5 Kenneth Hanson 2017-06-21 01:44:37 UTC
Alright, so we've confirmed that character styles do not inherit from the surrounding paragraph style. (Perhaps the title of this bug should be changed back.)

I was able to update such a character style in the way you described, but ONLY when changing the font size through the Basic Fonts menu. This explains the difference in effect due to order of operations that I described.

But this method of updating, even if intentional, is terribly confusing. Shouldn't percentage font sizes update automatically here just the same as elsewhere??

Also, changing the default paragraph font still has no effect, either on percentage font sizes or on the default size displayed before modifications.

So back to my original question: is the "parent style" of all character styles the default paragraph style, or is it something else? I tried modifying the default paragraph style again and pressing the "Standard" button, which returned it to the setting in the Basic Fonts menu. This strongly suggests that both the paragraph and character styles are based on some third source which is only modifiable from the Basic Fonts menu.
Comment 6 Kenneth Hanson 2017-06-21 01:52:13 UTC
One more addition related to Regina's comment. I tried making a nested hierarchy of character styles, one with a manual font size (to put aside the issue regarding the behavior of defaults), a child style with 80% font size, and a 3rd level child also with 80% font size. Both the second and third level children had the same font size, 80% of the first level.

So it looks to me that not even the part of the spec about inheriting from the parent style is being implemented properly for character styles. In contrast, nested percentage font sizes worked as expected for paragraph styles. Perhaps this is a separate bug.
Comment 7 Yousuf Philips (jay) (retired) 2017-06-24 15:20:22 UTC
(In reply to Regina Henschel from comment #4)
> So with the current fo:font-size it is not possible to base the character
> font-size on the paragraph in which the character is, which gets this style
> applied.

Closing this based on this.

> The percent values is written to file and the percent value is calculated,
> when the style is defined in the beginning. But the text in the document is
> not updated, when the font-size of the parent character style is changed.
> 
> If you revisit the character Font dialog page and click on OK without any
> changes, then the text in the document is updated.

I wasnt able to reproduce this, so please file a bug report with your steps.

(In reply to Kenneth Hanson from comment #5)
> Alright, so we've confirmed that character styles do not inherit from the
> surrounding paragraph style. (Perhaps the title of this bug should be
> changed back.)

Changing the bug title will only confuse the issue more, so please file a new bug with the issues you are having.

> So back to my original question: is the "parent style" of all character
> styles the default paragraph style, or is it something else?

No it isnt the default paragraph style as character styles dont inherit from paragraph styles. Also there isnt a parent style used for all character styles similar to how it is done with paragraph styles. Character styles simply have the attributes that are assigned in them and other stuff will be inherited from the paragraph style they are applied on top of.
Comment 8 Mike Kaganski 2023-11-08 09:33:15 UTC
*** Bug 140384 has been marked as a duplicate of this bug. ***