Understanding Character styles "Default Style" and relative font sizes

The root of the hierarchy of Paragraph styles, on which all Paragraph styles are based, is "Default Style". There is also a /Character/ style "Default Style", which /cannot/ be either modified or chosen as the basis of other Character styles; its sole function seems to be, when invoked, to de-select any other character style, to the return the selected string to the character attributes specified in the Paragraph style governing the paragraph(s) housing that string. [That summary is a result of years of use as well as study of the Help (which is silent in this regard) and the Writer Guides from 2.0 to 6.0. If, after all that, I have missed something essential, I would welcome correction. OTOH, if a proposition so elementary to understanding Writer -- the meaning of the Character style "Default Style" -- is really this simple, I wish the documentation would be more explicit in this regard.]

A Paragraph style has attributes of paragraph structure and character style. [This fact, probably done for MS Word compatibility, is likely responsible for much if not most of the awkwardness of styles. When formatting directly from the main menu, one is sent directly to a character-only or paragraph-structure-only dialog box. It would be helpful/simpler if Paragraph and Character styles were that cleanly separated functionally.] For paragraph structure, the Paragraph style has these tabs:
   *Indents & Spacing*
   *Tabs*

For both Paragraph styles and Character styles, the character attributes are grouped as:
   *Font*: Font (typeface), Style (attributes Bold and Italic) and Size (absolute or relative);
   *Font Effects*: Font Color, Text Decoration (various types of over/through/under lines), Effects (Case and Relief variations)
   *Position*: (Position (super/normal/sub script), Rotation (0~360), Scaling (%) Spacing (absolute), Kerning (on/off)
   *Highlighting* (character color background)

Both Paragraph and Character styles include a *Borders* tab, but this apparent commonality if misleading because the Border scopes are different: around the selected text string in the case of the Character style, around the paragraph(s) in the case of the Paragraph style.

In most cases the Paragraph and Character styles seem to coexist with the rules above -- essentially, that the Character style modifies the character attributes of the Paragraph style -- but something different happens with relative font size: the character size is some percentage, but of what? - apparently /not/ of the character size specified in the relevant Paragraph style, or even in the Paragraph Default Style. All percentages seem to be based on a 12pt font, regardless of the font size specified in the Paragraph style.

Can someone tell me what is going on here? Is my understanding of the principles correct?

Also: can someone explain "text-to-text alignment" (Paragraph style Alignment tab)?

John

But one problem (of several) with this understanding is that it doesn't really seem to work that way, either. If a Character style modifies the character attributes of the Paragraph style,

Hi John,

All
percentages seem to be based on a 12pt font, regardless of the font size
specified in the Paragraph style.

12pt is the defined font size of the paragraph "Default Style". You have
to look in the style dialog in tab "Organizer" → "Inherit from". You
could change "Default Style" of the paragraph for changing the size for
all depending font sizes.

"Addressee" depends directly to the font size of "Default Style". So the
font size will be changed if the font size of "Default Style" has been
changed.

"Heading", for example, sets the inherits from Default Style. It is
overwritten there by font size 14pt. "Heading 1" is inherit from
"Heading". It takes this 14pt and will set it to 130%.

All is based on the default styles: Paragraphs for the whole paragraph
styles, fonts to the whole character styles.

Default character style only deletes all the changes of the character
styles you made in a special tab. For example the character style
"Emphasis": There is only set Font > Italic. You could only set it back
to "change nothing" by choosing in tab "Font" → "Standard".

Hope it helps. My English is a littel bit confusing for other people.

Regards

Robert

Hi John,

Also: can someone explain "text-to-text alignment" (Paragraph style
Alignment tab)?

Try this:
Write some Text with Default Style. Copy it for getting some paragraphs.
Now set the paragraph
Text to Text → Alignment → Top.
Mark a word in the paragraph and switch the size of this to 18pt.

All this con be made directly, without any changing of the styles.

Regards

Robert

Nonsense! Your English is clear and concise and it's a pity that some of
the so-called native English speakers on this list don't emulate it.

Hi Robert,

Thanks so much for answering, but I think you misunderstood the question, which is essentially about the behavior of *Character* styles, not Paragraph styles. I'm sorry if that was not clear. To help correct, I will insert the proper context in the snippet you quoted below, and begin by quoting a little more from the original post, for what I hope will be adequate context:

In most cases the Paragraph and Character styles seem to coexist with the rules above -- essentially, that the Character style modifies the character attributes of the Paragraph style -- but something different happens with relative font size: the character size is some percentage, but of what? - apparently /not/ of the character size specified in the relevant Paragraph style, or even in the Paragraph Default Style. All percentages seem to be based on a 12pt font, regardless of the font size specified in the Paragraph style.

With that fuller context, let's proceed:

All percentages [of the *Character* style] seem to be based on a 12pt
font, regardless of the font size specified in the Paragraph style.

12pt is the defined font size of the paragraph "Default Style". You have
to look in the style dialog in tab "Organizer" → "Inherit from". You
could change "Default Style" of the paragraph for changing the size for
all depending font sizes.

"Addressee" depends directly to the font size of "Default Style". So the
font size will be changed if the font size of "Default Style" has been
changed.

"Heading", for example, sets the inherits from Default Style. It is
overwritten there by font size 14pt. "Heading 1" is inherit from
"Heading". It takes this 14pt and will set it to 130%.

You see, all your examples were of the cascading of relative sizes within a cascade of linked Paragraph styles: each child style modifies its direct parent style. I thought the original post demonstrated that I understand how that works, and was surprised only by how Character styles -- which apparently exist to modify the character attributes of the Paragraph style -- differ in that regard. As you have used examples to communicate the principle [just not the principle I intended], let me do likewise:

Take the Character style "Emphasis". Change the font size from absolute (by default, 12pt) to relative (say, 150%). Apply that style to a string of text in some paragraph (say, Paragraph style "Text Body"). To what is that 150% related? If you change the font size of the Paragraph style (say, increase "Text Body" from 12pt to 20pt), note that the size of the text in "Emphasis" /does not change/. So in what way does the Character style modify the character attributes of the Paragraph style?

All is based on the default styles: Paragraphs for the whole paragraph
styles, fonts to the whole character styles.

I'm sorry, this part of your answer I did not understand. I /think/ you refer to the hierarchical linking of attributes within Paragraph styles -- and Character styles may similarly be hierarchically linked, but not based on the /Character/ style "Default Style". All that, I knew, but it's possible you were saying something more. [I must admit I had to think more about the significance of those 19 words than about the rest of your reply, trying to determine if I was missing something.] So if you were saying something more than I understood, would you please help me understand your intent?

Default character style only deletes all the changes of the character
styles you made in a special tab. For example the character style
"Emphasis": There is only set Font > Italic. You could only set it back
to "change nothing" by choosing in tab "Font" → "Standard".

Yes. I think I expressed it thus --

There is also a /Character/ style "Default Style", which /cannot/ be either modified or chosen as the basis of other Character styles; its sole function seems to be, when invoked, to de-select any other character style, to the return the selected string to the character attributes specified in the Paragraph style governing the paragraph(s) housing that string.

-- and that this function of the Character style "Default Style" (to remove any other character style) is complemented by the ability you mention, to reset any other Character style to adopt the attributes of the underlying Paragraph style. Again, about that there is no question. [Though again, as I mentioned in the original post, so much of that apparent complication stems from the decision to include character attributes in the Paragraph styles, which I think is done for MS compatibility.]

Hope it helps. My English is a littel bit confusing for other people.

Uberhaupt nicht. Ich werde Ihre Geduld mit meinem Deutsch nicht missbrachen. Ich schatze dass Sie meinem Muttersprache schreiben. Ich weiss den zusatlichen Aufwand. Manchmal denke ich, dass jeder in seiner bekanntesten Sprache sprechen und schreiben, um sich einfachsten auf die Ideen zu konzentrieren. Ich schatze es einfach, wenn jemand daruber hinausgeht.

Grusse, und kind regards,
John

Hi Robert,

...
Also: can someone explain "text-to-text alignment" (Paragraph style
Alignment tab)?

Try this:
Write some Text with Default Style. Copy it for getting some paragraphs.
Now set the paragraph
Text to Text → Alignment → Top.
Mark a word in the paragraph and switch the size of this to 18pt.

Ah, so it's just for the question of alignment of different character sizes? I should have thought that would be easy to incorporate in the Help or Guide. [But then, the volunteers who provide such help can't think of everything. (If there is one simple change I would make to the Guide, though, it would be the elementary step of providing the PDF with bookmarks. The lack of bookmarks is such a disadvantage, and so easily overcome, that I download the ODT Guide and generate the PDF from that. I'm surprised that after giving so much effort on content, the Guide producers neglect such an important step.)]

Kind regards,
John

Hi John,

one hint:
Tools → Options → LibreOffice Writer → Basic Fonts
will set the size of the Default Character Style (and some other styles)
I have tried it with Character Style Emphasis. Set it to 150% - it was
set to 150% of the Default Character Style and sets all to 18pt. Then I
changed the Basic Font to 14pt and the Character Style Emphasis changes
to 21pt after a refresh.

And another hint: If you are missing a description write it down.
I have been asked a longer time ago if I couldn't write down something
about Base. So I wrote the German Base-Handbuch for LO. The fist Book
had 300 pages. The version, which should be published for LO 7.0, will
have more than 600 pages.
Then I saw there is missing a description about XML-Form-Documents. I
tested all and wrote it down.

I the German Mailinglist we had seen the same problems with character
styles, paragraph styles and so on. It would be great to have a separate
description.

Regards

Robert

Hi John,

What you see is clearly a bug. Even two.

First is a bug of character styles' relative size.

The relative size must evaluate first relative to its inheritance: i.e., if
the character style B (with a relative size) inherits from character style
A, then it needs to apply the relative size to the size defined in that
parent style A (if any). If the size in A is defined, and is absolute, then
the result is an absolute size independent from any paragraph settings;
e.g., if A defines 14 pt, and B defines 150%, then text styled B must be 14
pt * 150% = 21 pt. This case now works correctly.

But if A does not define a size; or if it also defines a relative size -
then the resulting character style as a whole defines a relative size (in
case A has 40%, and B has 150%, the resulting relative size is 40% * 150% =
60%). Then the multiplier must apply to the size defined in the text run's
superordinate. It might be another text run (the ODS defines that character
styles may nest - so this character style may be applied to some part of
text having another character style, and then the size of that superordinate
text run must be the base to which the multiplier must apply). Or it might
be the paragraph - and now the paragraph should define the base for applying
the percentage. And here we have the bug #1.

The other bug is that there's a possibility to define Default Paragraph
Style (or any paragraph style that doesn't inherit) to have a relative size.
That is definitely a bug, since there's nothing in any standard, or in any
setting, that would tell then which is the basis to which the relative size
is applied. And LO behaves erratically then: say, set default paragraph
style to 6 pt; see how everything becomes small, and default is 6 pt. Now
set default paragraph style to 150%; see how everything increases, and
paragraphs of default style are 9%. So it looks like it applied the ratio to
the old value - but the paragraph style's properties still show the relative
size, not 9 pt which it should! This is the bug #2.

It all needs bug reports (one for each bug).

A note: there's no UI for nesting character styles, and so my description
about nesting them can't be tested without direct editing of ODF. See
https://bugs.documentfoundation.org/show_bug.cgi?id=115311.

John, (and Mike,)

I take a different approach to relative size. I needed to keep the relative
size separate from the font size, so I use relative size in
superscript/subscript. It's limited in it's functionality though (only
allows shrinking.) but it serves it's purpose.

That is, I set alternate, unmatching fonts to scale by using the position
tab and 'superscript' or 'subscript' with a "raise/lower" of 1%, then the
relative shrink in the relative size. This results in the scaling value
recorded in the style, not factored into 'font size'.

But it only partially works. Both the Raise/lower and 'relative size' in
the Position tab are unnecessarily limited. Instead of 1-100%,
'raise/lower' should be single number -1000 to +1000. and be a multiplier,
not a percent. (or maybe a percent.) and relative size should be .1% -
10000% If someone is reading this and coding. please consider implementing
a change where "position tab removes the "super/normal/sub" radio buttons
and replaces them with just the variables "raise/lower" and "relative
size". Percent scaling belongs in that spot, not as an instant math typed
into the font size.

That is (here's the technical complaint) I consider it a bug that
<style:text-position> only allows values 1-100 for both of it's values. It
should allow values -1000 to +1000 for the position, and fractional (.01 or
.001) to large (1000 or 10000) for relative size. The "super" and "sub"
should be deprecated or separated. Other than a possible divide by zero,
there's not much risk here. And they are both multipliers, not divisors...
so proper code should already be avoiding the divide by zero.

This provides
1. the ability to set a scaled text without shifting the baseline (even 1%
is sometimes annoyingly noticeable.))
2. the ability to grow text as well as shrink text with the "position" tab
(<style:text-position>).
3. the ability to maintain separate "text scale" vs "font size" so that
upstream changes to the stylesheet roll into all cases properly.

Hi Mike,

(Sent from: http://document-foundation-mail-archive.969070.n3.nabble.com/Users-f1639498.html)
...
What you see is clearly a bug. Even two.

First is a bug of character styles' relative size.

The relative size must evaluate first relative to its inheritance: i.e., if
the character style B (with a relative size) inherits from character style
A, then it needs to apply the relative size to the size defined in that
parent style A (if any). If the size in A is defined, and is absolute, then
the result is an absolute size independent from any paragraph settings;
e.g., if A defines 14 pt, and B defines 150%, then text styled B must be 14
pt * 150% = 21 pt. This case now works correctly.

Yes. No problem there.

But if A does not define a size; or if it also defines a relative size -
then the resulting character style as a whole defines a relative size (in
case A has 40%, and B has 150%, the resulting relative size is 40% * 150% =
60%). Then the multiplier must apply to the size defined in the text run's
superordinate. It might be another text run (the ODS defines that character
styles may nest - so this character style may be applied to some part of
text having another character style, and then the size of that superordinate
text run must be the base to which the multiplier must apply). Or it might
be the paragraph - and now the paragraph should define the base for applying
the percentage. And here we have the bug #1.

So I thought: The Paragraph style supplies the superordinate -- or, in the case of nested Character styles within a paragraph, the Paragraph style as modified by the longer-run Character style provides the superordinate for any additional Character style applied to a subset of the longer run. So your understanding is the same as mine: that the Character style /should/ modify the character attributes of the Paragraph style -- or any subsequent superordinate. [More on this later.]

Having confirmed that Writer does not, in fact, work that way, I suspected a problem with my understanding, while you conclude that there is a bug (#1). More and more I'm inclined to think you are right (because nothing else makes sense to me). As I noted to Robert, his alternate theory of operation would explain why my understanding does not work, but it also does not make sense.

Before filing a bug, I wanted to assure that I have understood correctly what should happen -- and then, when we get it right, I would like to write it for the Guide, to clarify a point that should be basic to the operation of Writer. [However, precisely because this is so basic, I worry that a resolution may not be a simple fix, and could take years to realize. More on this later.]

The other bug is that there's a possibility to define Default Paragraph
Style (or any paragraph style that doesn't inherit) to have a relative size.

How about Robert's suggestion: Tools → Options → LibreOffice Writer → Basic Fonts ?

That *does* set an absolute size basis.

But that /seems/ to present another basic problem, which I infer is bothering you; it is this: Since everything (Paragraph styles) descends from "Default Style", then Why have other style sizes {"Heading", "List", "Caption", "Index"} on that page? I /think/ [again, this is my inference, not something I have seen], Basic Fonts is intended just to provide an initial config, /to be discarded as soon as the user expresses a different intent/.

For example, "Heading" is based on "Text Body", which is based on "Default Style". Normally "Text Body" takes its font size (12pt) from "Default Style", while (in a new document) "Heading" has a different size, taken from that Basic Fonts page. However, if you assign "Heading" a relative size (say, 150%), /then/ it reverts to basing the 150% on "Text Body", /not/ the Basic Fonts page. So it goes from taking its size from the Basic Fonts page to taking its size from the inheritance rules (just as it does if you hit the "Standard" button). But what is unique about "Default Style" among the styles listed in Basic Fonts, is that the user can never express that "different intent" that invokes a different rule of inheritance, because the inheritance rule is moot for "Default Style". That, I think, is at the root of what bothers you here.

I wish it were not so, that inheritance rules change (if they must change at all) without *explicit* choice of the user, but I think that is ultimately a consequence of more basic style philosophy. [More on this later.]

IAC, all of this is just for *Paragraph* styles; as noted earlier in this thread, *Character* styles follow different rules, which one discovers only from experience -- and that is the problem: Lack of explicit clarity about style inheritance rules is a weakness which can lead to bugs. [More on this later.]

That [ability to specify a relative font size in Paragraph style "Default Style"] is definitely a bug, since there's nothing in any standard, or in any setting, that would tell then which is the basis
to which the relative size is applied. And LO behaves erratically
then: say, set default paragraph style to 6 pt; see how everything
becomes small, and default is 6 pt. Now set default paragraph style
to 150%; see how everything increases, and paragraphs of default
style are 9%. So it looks like it applied the ratio to the old value
- but the paragraph style's properties still show the relative size,
not 9 pt which it should! This is the bug #2.

I found different behavior: When I set the font size of Paragraph style "Default Style" to 6pt, everything reflected that, as you say. However, when I set "Default Style" to 150%, its absolute font size became 18pt (150% x 12pt on Basic Fonts page). So, with the understanding above, this seems to work as designed. The problem, again, is whether "as designed" is in fact the most useful approach. That brings us to this:

A note: there's no UI for nesting character styles, and so my description
about nesting them can't be tested without direct editing of ODF. See
https://bugs.documentfoundation.org/show_bug.cgi?id=115311.

That was a thought-provoking discussion, limited only by the language of style categories used for the discussion -- and therein IMHO lies the weakness [this is the "later" referenced several times above]:

At the beginning of this thread, I mentioned parenthetically my belief that much of the styles complication derives from the incorporation in Paragraph styles of character attributes, to be modified later by character attributes in Character styles. Defining character attributes in a Paragraph style invites complications, and maybe bugs. [Consider how many bug reports (like the one you cite, and the ones /it/ cites) and other words (like this thread) have been spilled over topics arising out of that relationship. Yes, I understand that Microsoft may have started it (with Word), but, to say no more, that thought does not allay my concern on this design practice.]

However, even that is a special case of bundling attributes in "Paragraph" and "Character" styles, when what we really want in essence is the visual presentation of semantic meta-ideas (about object class, or emotion, or other unspoken/unworded attributes) in text. In the beginning is the word, not the paragraph. In the beginning is the idea, which the word, then the text, then the paragraph and other structures, exist to serve. At bottom, I think we want:
  (a) nested styles to serve multiple orthogonal semantic objectives.
  (b) style inheritance to reflect the internal connectedness of different classes of semantic objectives.

Unfortunately, this is way too big a topic, maybe for this forum, and certainly for this post which is already too long. I will try to write something more comprehensive, separately. Meanwhile, I think we have concluded that there is (at least?) one bug here, and I will report it. Thanks for your excellent thoughts.

Best regards,
John

John,

The point I was trying to make is that you are discussing a named box in
libreoffice, but then all the discussion is about putting a percent number
into "Size" field of the Font tab. This is confusing. "Relative Font
Size" is in use. I've been working around it not being able to go above
100%. This thread suggested it's possible that the box named "Relative
font size" now accepts a number over 100% (as it should.)

[image: image.png]