Character Styes not following Paragraph Styles

First things first. Here are the versions currently in play:

OL: 7.4.2.3
Mac OS: 10.13.6

I am working on style inheritances and seem to have hit a snag.

All the paragraph styles, formats, and setup are (at this point) spot on. Indeed, if change the parent the children follow as expected.

The character styles are giving me problems, though. There is only one style in play, italic. It exists simply to dispense with direct formatting and in that regard it works as expected.

However…

If you change the font size of the enclosing paragraph the character size does NOT follow. I’ve tired everything I can think of, but nothing seems to make the character style move in tandem with the enclosing paragraph style with respects to size. It does, however, seem to respect the font itself.

I started this by defining the character style to 12pt. That might have been a mistake and forced a setting I did not intend to.

I’ve tired forcing it again to +0 pt and the does not work.

So I have two questions:

  1. Can character styles conform to the paragraph styles? Or perhaps a better was to ask that is: are character styles children of paragraph styles? The would make sense to me, for all that means :smile:
  2. Can this be made to work the way I expect. If I change the enclosing paragraph font size, can the character size be made to follow?

I should point out that we are talking about one character style here, so it is not onerous to change it manually. It would just be nice if it did it auto-magically.

TIA;
Ken

A good resource on the inner workings with Styles and the API is Python LibreOffice Programming Chapter 6. Text Styles

Let’s start by the beginning.

Paragraph styles and character styles live in two different names spaces. This means you can define an inheritance tree for paragraph styles and another one for character styles. Both sets are independent from each other.

However when you apply styles, Writer manages them like layers: the deepest one is paragraph layer, over it you have character layer and the shallowest is direct formatting.

As you expect with layers, you can see through a layer if it is “transparent”. Whenever you “touch” an attribute, this attribute becomes opaque and prevents seeing the same attribute in a deeper level.

This is where you made this attribute “opaque” or rather overriding the value in the paragraph style.

If you want to keep any paragraph style attribute, this attribute must absolutely remain untouched. When you create a style, all attributes start in a “transparent” state but the UI is unable to report this. It shows you the value resulting from inheritance. Only the Organizer tab will tell you what you have “touched”.

Then to “fix” your character style, you must first revert it to “transparent” state. For that press the Reset to Parent button. The effect of the button is limited to the displayed tab. To completely reset a style, either destroy it and rebuild it, or press the button in every tab one after the other.

Next set only the attributes you want to override with your style. All others will be given their inherited value or use the value from the lower layers (character then paragraph).

The “transparent” state, i.e. “untouched” status, is the key to your problem.

1 Like

That did it! Thank you!

Just as a side note: I never touched [Reset to Parent] because the style italic (as I built it) has no parent, so it didn’t make sense. Ooops! :smile:

Again, thank you!

Ken

A character style always has a parent, too, be it the fake style No Character Style (which is never reported in Organizer)