[Libreoffice-bugs] [Bug 140818] Default Character Style should be named "No Character Style" and all builtin character styles should inherit from "No Character Style", and "- None -" should be removed from Inherit From dropdown list

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Sat Mar 6 20:47:14 UTC 2021


https://bugs.documentfoundation.org/show_bug.cgi?id=140818

--- Comment #6 from Regina Henschel <rb.henschel at t-online.de> ---
Created attachment 170276
  --> https://bugs.documentfoundation.org/attachment.cgi?id=170276&action=edit
Document to examine character styles

(In reply to sdc.blanco from comment #5)
> But how would you describe what happens when "Inherit From" is "None".

It follows the algorithm described in the ODF standard.
https://docs.oasis-open.org/office/OpenDocument/v1.3/cs02/part3-schema/OpenDocument-v1.3-cs02-part3-schema.html#element-style_style

Example Border color and style: Examine style RedBoldAndBorder in the attached
file, look in section Contains in the Organizer tab.

<quote>
The determination of the value of a formatting property begins with any style
that is specified by an element. If the formatting property is present in that
style, its value is used.</quote>

So the text range to which this style is applied (the word "dummy" in line E,
F, G, and H) has a red, dashed border at its bottom.

Example font color: Examine style RedBoldAndBorder: The style contains nothing
about font color.

<quote>
If that style does not specify a value for that formatting property and it has
a parent style, the value of the formatting element is taken from the parent
style, if present.</quote>

Example font color continue: The parent (which is in 'inherit from') is style
RedBold. Looking there in the Organizer tab we see 'light red' and so that is
taken as font color.

Example font size: Neither RedBoldAndBorder nor RedBold contain values for the
font size.

<quote>
If the parent style does not have a value for the formatting property, the
search for the formatting property value continues up parent styles until
either the formatting property has been found or a style is found with no
parent style.
</quote>

Example font size continue: RedBold has no parent (its 'inherit from' is
'None'). So we cannot go further up in the ancestor hierarchy.

But the standard has further rules:
<quote>
For styles with family text which are applied to elements which are contained
in a paragraph element 6.1.1, the search continues within the paragraph style
that is applied to the paragraph element, and continues in its parent styles.
</quote>

Example font size continue: Take the text range in line G, which
RedBoldAndBorder applied, for example. It is in a paragraph with paragraph
style "Preformatted Text". We examine "Preformatted Text" and find "10pt" in
the 'Contains' section. So this text has font size "10pt". Now take the text
range in line E. That paragraph has style "Heading 1". We examine it and find
font size "130%". The percent value refers to the size in the parent style,
which is "Heading". And there you find "14pt". So the text has 18.2pt
(=14pt*1.3) font size.

So when a character style has in its 'inherit from' style the value 'None', it
has no character style parents. If a property has no value specified directly
in the character style, then the search continues in the paragraph style. So in
this case the text range "dummy" has font size "10pt" in line G, and has font
size 18.2pt in line E, although in both cases the character style
RedBoldAndBorder is applied. Same for lines A, B, C and D where RedBold is
applied.

And this examples shows you, why it is useful to permit, that a character style
has no parent character style. That allows, that properties for which values
are not directly defined, take their values from the environment in which the
character style is used.

> 
> My guess:
> 
>    When "Inherit From" is "None" then values specified in "Contained" are
> removed.

No, see style RedBold. It has "None" but still defines values for the font
color.

I have constructed RedBold and RedBoldAndBorder so that RedBold is the parent
of RedBoldAndBorder. You can test, that the inheritance really works. Set the
font color in RedBold to Blue. Now all "dummy" texts are blue, because style
RedBoldAndBorder inherits the font color from RedBold. But border color is
still red, because that is directly defined in style RedBoldAndBorder.

It is indeed a challenge, to describe this behavior in tooltips and to use
adequate labels.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210306/6dd6c584/attachment-0001.htm>


More information about the Libreoffice-bugs mailing list