Bug 130930 - Ability to remove one specific direct formatting
Summary: Ability to remove one specific direct formatting
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
: 103343 (view as bug list)
Depends on:
Blocks: Clear-Formatting Character
  Show dependency treegraph
Reported: 2020-02-25 15:16 UTC by Frederic Parrenin
Modified: 2023-05-30 20:14 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:

.odt file to illustrate the problem. (8.53 KB, application/vnd.oasis.opendocument.text)
2020-02-25 15:16 UTC, Frederic Parrenin
screenshot (152.28 KB, image/png)
2023-05-30 20:14 UTC, BogdanB

Note You need to log in before you can comment on or make changes to this bug.
Description Frederic Parrenin 2020-02-25 15:16:40 UTC
Created attachment 158183 [details]
.odt file to illustrate the problem.

The attached document has a default font 'Liberation Serif' but some characters also have the 'Times New Roman' font super-imposed.
The question is "how to remove this super-imposed 'Times New Roman' font?"
The only way I found was to use 'Remove direct formatting' with CTRL-M, but this also remove other formatting like bold, grey shading or superscript.
So you have to re-apply these formatting afterwards.

My suggestion is therefore to allow to remove one specific direct formatting.
Comment 1 V Stuart Foote 2020-02-25 16:55:06 UTC
Trivial to do using Find & Replace dialog setting a 'Format' value for the Direct Formatting needing a change. Set the replacement with 'Format' value to match the default font & size.

Carefull to only find/replace the formatting, use the Find Next/Previous to be sure you are matching the targets correctly.
Comment 2 V Stuart Foote 2020-02-25 17:00:28 UTC
QA, this was an enhancement--so status instead => WORKSFORME
Comment 3 Frederic Parrenin 2020-02-25 17:26:08 UTC
I disagree this solves the problem.
It only _replaces_ the font property, but it does not remove it.
To realize it, after you have replaced your font formatting, just replace the font in the default style with another one (e.g. Comic Sans MS).
You will see that the font you have replaced do not follow the new style but follow the font style you have used for replacing.
Moreover, imagine you have a lot of different fonts to replace with the default font. You have to do the exercise for each font. And you have to scan all your document to see which fonts are used in there. If there was a way to remove a font property, you could select all your text with CTRL-A and you do that in e few seconds.
Comment 4 V Stuart Foote 2020-02-25 17:39:21 UTC
No, you asked for means to remove a single DF. That exists now in GUI (or you can edit the XML content of the ODF directly).

If you have that much work to do to clean up Direct Formatting (DF), it is much better to copy and paste as unformatted text, picking up the assigned paragraph style for the target. And apply text DF or better Character style. 

Issues of trying to identify all DF applied to a selection, a paragraph, or to a full document make it very unlikely targeted removal of DF could be implemented effectively.

And this would be an immediate => WF
Comment 5 Frederic Parrenin 2020-02-25 17:47:15 UTC
I am sorry but I am not sure I understand you.
You says:

"No, you asked for means to remove a single DF. That exists now in GUI (or you can edit the XML content of the ODF directly)."

Where does it exist in GUI?
For me, "Find and Replace" replaces a direct formatting, but it does not remove it.
I agree there is a bit work to understand what is the best UI to do it and to implement it. But for me this is a needed feature.
Comment 6 V Stuart Foote 2020-02-25 19:25:32 UTC
To unconfirmed. For UX-advise

I have not issue directly editing the XML (content.xml, styles.xml) from an ODF archive (easier in Flat ODF .fodt).

As noted, the Find/Replace dialog 'Format' will do a replacement 1-1 of font/effect/size-- but there is no replacement Format to revert the found selection's span to a non-DF span.

Would need a 'Format' replace action to actually clear the DF applied to the found span, merging it into the current Paragraph's run. And if the style:name/style:family 'T' direct formatting becomes unused, to clear it from the content XML.

So, guess there is potential to implement.
Comment 7 Frederic Parrenin 2020-02-25 19:54:09 UTC
Thank you for your understanding.
Comment 8 Heiko Tietze 2020-02-26 09:40:13 UTC
(In reply to V Stuart Foote from comment #6)
> So, guess there is potential to implement.

Question is rather if we want to support single DF removal. The recommended workflow is still to clean up per Remove Direct Formatting and to use character styles (where we have the same problem, see bug 89826).

Guess the issue is mostly related to font names. Why not remove the DF when it fits the PS/CS? Without any UI. Don't we have a request on this?
Comment 9 Frederic Parrenin 2020-02-26 09:48:37 UTC
> The recommended workflow is still to clean up per Remove Direct Formatting and to use character styles

Yes, thank you for bringing this workaround solution.
Comment 10 V Stuart Foote 2020-02-26 14:25:55 UTC
The 'Format' mode of Find & Replace... dialog seems a reasonable location to accomplish this.

It currently provides a means to find Direct Formatting recorded to text style:name / style:family (the 'T' code) applied to text runs of paragraphs.

It currently provides direct replacement to change the DF of the text run.

What is missing is ability for replacement 'Format' to be 'unformatted', and to simply clear that DF. And to allow the text run to pick up the style assigned to the paragraph (the applied 'P' code).

Same approach, using the Format mode for Find & Replace, might also solve bug 89826 - Allow removal/reset of individual style attributes.
Comment 11 Eyal Rozenberg 2020-02-27 00:19:41 UTC
I'm not sure it's a good idea to provide this feature. It may be too much of an encouragement of using complex manual formatting. Frederic, you can just change the font manually to whatever you like. Why should LO "legitimize" a non-style combination of manual formatting? ... or create a style from your multiple manual formatting, and revert to that.
Comment 12 Frederic Parrenin 2020-02-27 10:09:08 UTC
Yes, I agree a way to solve my problem is to use styles instead of any direct formatting.
On the other hand, when you have a big document that uses direct formattings, and you don't want to change all of that to styles, it might be a quicker solution to remove a particular direct formatting.
It happens to me in particular with fonts, it often happens that my document mixes different fonts and that I want to clean that.
It is possible right now to remove all direct formatting, so why not allowing to remove a specific one?
Comment 13 Mike Kaganski 2020-02-27 10:31:00 UTC
I believe that implementing the proposal published by design team about fine-grained formatting display/control would automatically solve this...
Comment 14 Heiko Tietze 2021-06-21 10:02:54 UTC
We should implement this per context menu item "Remove" on the Styles Inspector, see bug 135110.

Could be an interesting easy hack. What do you think, Mike?
Comment 15 Mike Kaganski 2021-06-21 10:35:20 UTC Comment hidden (me-too)
Comment 16 Heiko Tietze 2021-06-21 11:22:24 UTC Comment hidden (off-topic)
Comment 17 Aron Budea 2022-05-08 03:44:06 UTC
*** Bug 103343 has been marked as a duplicate of this bug. ***
Comment 18 Cor Nouws 2022-05-10 07:20:29 UTC
(In reply to Heiko Tietze from comment #14)
> We should implement this per context menu item "Remove" on the Styles
> Inspector, see bug 135110.

Or a dropdown on the toolbar for Clear formatting
Comment 19 Cor Nouws 2022-05-10 07:21:52 UTC
one could also ask: why Writer only?
(yes, code wise it will probably be 3 different tasks)
Comment 20 BogdanB 2023-05-30 20:14:15 UTC
Created attachment 187613 [details]

The new tool, Paragraph Spotlight, Character Spotlight and "Spotlight Character Direct Formatting" can help you to see where is a direct formatting applied.
See screenshot.