Bug 140384 - CHARACTER STYLE: Relative font doesn't work, if style has no parent style
Summary: CHARACTER STYLE: Relative font doesn't work, if style has no parent style
Status: RESOLVED DUPLICATE of bug 108498
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.4.7.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on: 101783
Blocks: Font-Size
  Show dependency treegraph
 
Reported: 2021-02-13 00:15 UTC by pjw
Modified: 2023-11-08 09:33 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Characters resized by percentage (18.79 KB, application/octet-stream)
2022-10-06 15:57 UTC, David
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pjw 2021-02-13 00:15:21 UTC
Description:
When defining a Character Style, one can specify a % as the size. This is documented to be relative to the parent style.

If the character style has not parent (most of mine don't), then the "parent style" should be derived from the Paragraph style. Instead it seems to be derived from another style (not sure which one).

This may not be a strict interpretation of 'parent', but it makes both intuitive and logical sense.

This could be seen as wither a bug report (there should be no parent to inherit from) or an enhancement request (use paragraph style as parent when no parent given). It's probably both: a bug report, with a suggested solution.

eg. if I define "Attention" style to be "Bold,110%", and apply it to a word in a Heading, then it should be relative to the heading font size. If I apply it in a Text Body, the size change should be relative to the Text Body font size.

Steps to Reproduce:
1. Define a new character style with no parent
2. Set font size to 120%
3. Define a paragraph style with 20pt font
4. Define a paragraph style with 10pt font
5. Write some text in each of this paragraph styles
6. Apply the character style to a word in each of those paragraphs
7. Notice that the styled word is now the same size in each paragraph.

Actual Results:
The styled word is now the same size in each paragraph.

Expected Results:
the styled word should derive it's size from the paragraph style.


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.0.3.1 (x64)
Build ID: d7547858d014d4cf69878db179d326fc3483e082
CPU threads: 12; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: en-AU (en_AU); UI: en-US
Calc: CL

This is a behaviour that has existed a long time and seems to be by design. The buggy edge case presented hers (no parent) presents an opportunity to provide a substantial enhancement to a feature.
Comment 1 Dieter 2021-03-01 07:44:46 UTC
(In reply to pjw from comment #0)
> Steps to Reproduce:
> 1. Define a new character style with no parent

It's not possible for me to define a new character style without a parent. I recieve an error massage. Since I couldn't see, that any character style has a parent, I tested with actual character styles of writer.

I assume, that percentage is related to settings in Tools => Options => LibreOffice Writer => Basic Fonts

Could you please test this with the latest version of LibreOffice from https://www.libreoffice.org/download/libreoffice-fresh/ or with a master build from http://dev-builds.libreoffice.org/daily/master/current.html? You can install master alongside the standard version.
=> NEEDINFO

Tested with
Version: 7.2.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 28555fc345ac2ccdda0e4e0f3c812c646befe68b
CPU threads: 4; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL

If it is related to those settings, an update of help page might be useful:
[1] https://help.libreoffice.org/7.2/en-GB/text/shared/optionen/01040300.html?System=WIN&DbPAR=WRITER&HID=modules/swriter/ui/optfonttabpage/OptFontTabPage#bm_id3154894
[2] https://help.libreoffice.org/7.2/en-GB/text/shared/01/05020100.html?&DbPAR=WRITER&System=WIN

Related to bug 41360 and bug 101783
Comment 2 pjw 2021-03-01 08:39:00 UTC
> It's not possible for me to define a new character style 
> without a parent

Yes it is. Create a new style with any parent, save it, then edit it and scroll the parent drop-down to '-None-'.

The error message you see on a new style is probably a new bug because I have A LOT of styles with no parent.

> I assume, that percentage is related to settings in 
> Tools => Options => LibreOffice Writer => Basic Fonts

No. Type 120% in the font size for the new style.

In light of the above, you may need to review your investigation and steps  1-7 I listed in the original report, with the modification to Step 1:

Step 1: Define a new character style with no parent BY CREATING A NEW STYLE, SAVING IT, THEN EDITING IT AND SELECTING "-None" IN THE "Inherit From" DROPDOWN OF THE NEW STYLE.

(sorry, I don't know how to make stuff here bold, so CAPS will have to do)

Please not that I made no claim about an error message
Comment 3 Dieter 2021-03-11 16:37:31 UTC
I confirm the described behaviour with

Version: 7.1.1.2 (x64) / LibreOffice Community
Build ID: fe0b08f4af1bacafe4c7ecc87ce55bb426164676
CPU threads: 4; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL

But I can't assess, if this is a bug or not, because there's a lack of information about the meaning of percentage in font size [1].

In bug 101783 comment 0 I could read "If you look in the standards for the correct behavior, then notice, that in section "20.183 fo:font-size" it is explicitly said, that for percent the parent style is used as reference" 

Regina, do you know something about the expected result, if there is no parent style?
cc: Regina Henschel


[1] https://help.libreoffice.org/7.1/en-GB/text/shared/01/05020100.html?System=WIN&DbPAR=WRITER&HID=cui/ui/charnamepage/CharNamePage#bm_id3148919
Comment 4 Regina Henschel 2021-03-11 18:08:00 UTC
(In reply to Dieter from comment #3)
> Regina, do you know something about the expected result, if there is no
> parent style?

No, the standard has no rule for it.

The percentage in font-size in character styles is broken anyway. It should take as basic value the font-size given in its parent character-style. But instead it uses as basic value the font-size specified in the element <style:default-style> of family 'paragraph' in file styles.xml in the odt-package. The value there is set by LibreOffice without a possibility to change it by the user other than changing it in the file text. It seems LibreOffice takes the value, that was set in Tools > Options, when the file was first saved. It is likely, that we have a bug report of this faulty behavior.

Neither the values in 'Default Paragraph Style' nor the values in 'Basic Fonts' in Tools > Options are connected to this <style:default-style> element. They are connected to a <style:style> element with style:name="Standard".

My view is, that LibreOffice should take the same way through the hierarchy (as described in the standard) to determine the basic value as it would go, if no font size was set in the character style.

Perhaps ask Michael Stahl about his view. He is Writer expert and member in the ODF TC.
Comment 5 Dieter 2021-03-12 07:42:50 UTC
(In reply to Regina Henschel from comment #4)
> No, the standard has no rule for it.

So should we treat it as enhancement and change status to NEW, shall we treat it as a duplicate of bug 101783 or is it a WONTFIX, because there is no defined standard in odf-specifications?
Comment 6 pjw 2021-03-12 07:48:34 UTC
My 0.02c worth: It's not a supicate of bug 101783 because that relates to the parent/child problem in character styles.

IMO, based on the above comments, I'd say it's an enhancement based around and undefined behaviour in the standard.
Comment 7 Dieter 2021-03-13 16:51:09 UTC
Since bug 101783 is a bug and not en enhancement, let's treat the problem described here also as a bug. Bug 101783 should be resolved first so we can see what impact this has on a character style with no parent style
=> NEW

Regina, feel free to change status, if I'm wrong.
Comment 8 David 2022-10-06 15:57:38 UTC
Created attachment 182879 [details]
Characters resized by percentage

I agree that when defining a character style size by a percentage, the point size of the style should be taken from the current paragraph style and not from the point size set in Options. See the attached document for how this looks in various sized paragraphs. All sizes in the resized characters are the same regardless of the font size in the current paragraph. This is a definite bug from a user's perspective.
Comment 9 Mike Kaganski 2023-11-08 09:33:15 UTC

*** This bug has been marked as a duplicate of bug 108498 ***