[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libreoffice-users] What is different about Character styles "<size>%" attribute?


Hi John,

John Kaufmann schrieb am 04-Jun-20 um 20:50:
Though I resent the inevitable complications caused by the MS-workalike practice of Paragraph styles containing Font specifications,

I like to have a central place to set font properties. The character specific settings in the paragraph style work as default for all cases a portion of text has no own character style assigned.

I had
always thought of Character styles as a way to at least mitigate the problem, by defining attributes with respect to the Paragraph style to which they are applied.

No, character styles have no reference to a paragraph styles.

As the LibreOffice Writer 6.0 Guide puts it on
page 204:

Character styles provide exceptions to the formatting in a paragraph style. They are applied to groups of characters, rather than whole paragraphs. They are mainly used when you want to change the appearance or attributes of parts of a paragraph without affecting other parts. ...

One key (as I understand it) is in the phrase "provide exceptions". "Exceptions" can be attributes that either:
    (1)  modify the Paragraph style's Font specification (like bold or italic), or
    (2) replace the Paragraph style's Font specification (like a new Font specification).

Yes, using a character style means, that no longer a default attribute value from paragraph is used, but the attribute from the character style is active.


Unfortunately, (1) and (2) are semantically inconsistent (a necessary consequence of Paragraph styles containing Font specifications),

??

and
inconsistent with respect to font design because so many font families contain bold and italic variants that are separate font faces.

Then you need to select the corresponding font.

But the
designers have done a good job of allowing users to ignore those fine points...

??


... right up to the problem of the Font tab's "Size <size>/%" attribute.  By specifying a %-size, it appears to modify, rather than replace, the Paragraph style's Font specification.

Not at all. The % in font size in a _character_ style refers to a parent _character_ style. There exist bugs
https://bugs.documentfoundation.org/show_bug.cgi?id=108498
https://bugs.documentfoundation.org/show_bug.cgi?id=127702

Except that it does
not: <size>% modifies some other fixed font size not in the Paragraph style (and specifying "100%" will always revert to a fixed size).

Yes, wrong handling of 100% is a known problem
https://bugs.documentfoundation.org/show_bug.cgi?id=41360
Use 101% or 99%.


So, for example, in a Character style that specifies two attributes -- like adding /Italic/ and making a relative size change (like 90%) -- the /Italic/ modifies the Paragraph Font, but the <size>% modifies something else.  This means that if I go back to the Paragraph style and modify the base Font face, then part of the Character style (/Italic/) will immediately reflect the new font face, and part (<size>%) will not.

See above mentioned bugs.


Put another way: the Paragraph style is the parent for only part of the Character style;

The paragraph style is not a "parent" to the character style, but provides default values for those attributes, which are not set in the parent hierarchy of character styles. First the character style parents are search for a property value and only if no value was found the paragraph parent hierarchy is searched through.
The description of the hierarchy and the search algorithm is in
https://docs.oasis-open.org/office/OpenDocument/v1.3/cs01/part3-schema/OpenDocument-v1.3-cs01-part3-schema.html#element-style_style

something else is the parent for the %-size attribute.
One solution appears to be to create a tree of Character styles with a complete Font specification at the root style;

Then you would need to apply this root character style to content of all paragraphs to prevent LibreOffice from using defaults.

then every other
Character style based on that root can modify with the <size>% attribute. Unfortunately, that only seems to work until the document is saved, then reopened -- and then the <size>% attribute (and /only that/ attribute) is no longer attached to the base Character style, but reverts to modifying some other fixed font size.

In case the parent character style has set a fixed font size, that should not happen. I see the wrong size after reload too, that is a bug.

  Is there a clean way
to handle this?

No. There are currently too many bugs in LibreOffice in regard to font size.


[Note: While researching this problem, I found a great discussion <https://ask.libreoffice.org/en/question/60567/writer-usage-of-percent-character-sizes-how-does-it-work/> between ajlittoz and Regina Henschel on this from four years ago. It was [closed] with an answer but no clean resolution.  As I read the spec (<https://docs.oasis-open.org/office/OpenDocument/v1.3/cs01/part3-schema/OpenDocument-v1.3-cs01-part3-schema.html#__RefHeading__1419806_253892949> or earlier <https://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1419806_253892949> -- there is no change in this regard), the question is just which entity is the "parent" of the attribute -- and I don't understand why different attributes of a Character style have different parents.]

% is special, because you need a basis value and this is not included in the size attribute itself. And the specification is very clear, what has to be used as basis value:
<quote>
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.
</quote>
https://docs.oasis-open.org/office/OpenDocument/v1.3/cs01/part3-schema/OpenDocument-v1.3-cs01-part3-schema.html#property-fo_font-size
['common styles' are user defined styles in contrast to 'automatic styles' which are generated by direct formatting].

Kind regards
Regina





--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy

Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.