Bug 157743 - find and replace using font size formatting finds wrong text
Summary: find and replace using font size formatting finds wrong text
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Find-Search
  Show dependency treegraph
 
Reported: 2023-10-13 15:51 UTC by Tracey
Modified: 2023-11-15 16:35 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
sample of bad/wrong search results (446.01 KB, application/x-7z-compressed)
2023-10-13 15:51 UTC, Tracey
Details
find-replace bug sample (2.26 MB, application/x-7z-compressed)
2023-10-14 15:48 UTC, Tracey
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tracey 2023-10-13 15:51:18 UTC
Created attachment 190197 [details]
sample of bad/wrong search results

When [find/replace] searching for font style size finds wrong text.
See attached samples.

Thanks, Tracey
When searching for a word or phrase, it highlights the word or phrase it finds.
Comment 1 raal 2023-10-13 17:14:55 UTC
Hello, please attach sample file and steps how to reproduce the bug. Thank you.
Comment 2 Tracey 2023-10-14 15:48:52 UTC
Created attachment 190214 [details]
find-replace bug sample

Issue : LibreOffice find-replace font-style feature corrupts the text-fonts
My desire was to:
Change from: LibreOffice Sans Regular 12point
Change to: LibreOffice Serif Italic 12point

Find-Replace actually changes 14point text when it should not and fails to change 12point text when it should (normal mode or safe mode).

LibreOffice find-replace: 11,853 times and corrupts the text-fonts (see attached)
Thanks, Tracey
When I export the ODT document from LibreOffice as DOC:
opening/changing/saving the DOC in Word2000 find-replace: 21,632 times does NOT corrupt the text-fonts
opening/changing/saving the DOC in Word2002 find-replace: 21,632 times does NOT corrupt the text-fonts
However, when saving an ODT document with LibreOffice as a DOC or an RTF, the column-section names get corrupted (but that is another issue).
Comment 3 Buovjaga 2023-10-25 12:09:58 UTC
Simple step after opening the ODT is to search for format font size: 12 pt. I confirm it is finding text formatted as 14 pt and I could not figure out why. I also examined content.xml and styles.xml, but no luck. Seen already in the oldest of linux 43all repository. To be sure, I will ask devs if there is some issue in the file.

In general, it is better to use styles instead of direct formatting, so you don't have to deal with such mass replacements. See for example https://books.libreoffice.org/en/WG76/WG7608-IntroStyles.html
Comment 4 Buovjaga 2023-10-25 12:16:06 UTC
Testers can also use attachment 190196 [details] from bug 157727.
Comment 5 Tracey 2023-10-25 16:27:01 UTC
Yes, Styles are one of the NEXT on my list of things to understand how to use them (plus how to format a document properly: I am not a savvy document creator).

But still, find and replace does not corrupt a document.
Thanks, Tracey
Comment 6 Tracey 2023-10-25 16:35:25 UTC
The scary thing is when the document is corrupted, but it is not discovered until it is too late.

FWIW, Tracey
Comment 7 Stéphane Guillou (stragu) 2023-10-27 16:33:33 UTC
Reproduced in:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: fd69b546ad36452560cb11ccb28e78632d65f045
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

With smaller sample ODT attachment 190443 [details], searching for 12 pt font (Western).

Also in OOo 3.3, so inherited.

Some things I noticed:
- "Find all" will highlight _no_ 12 pt text whatsoever
- If I also use 12 pt in the Asian font part (which requires "Asian" to be ticked in Tools > Options > Languages), "Find all" will highlight some 12 pt text (but not all).
- If I only use the Asian font part, "Find all" will highlight the remaining 12 pt text.

Seems related to:
* Bug 60458 - Find with Format carries unwanted Asian Typography option values by itself
* Bug 84467 - Searching for font size does not always work
* Bug 135857 - FIND & REPLACE DIALOG: Wrong results when searching for format (after apply and unapply Font Effects)

There might be some duplication in there but I'm not able to untangle it.
Comment 8 Tracey 2023-11-01 15:52:02 UTC
(In reply to Tracey from comment #5)
> Yes, Styles are one of the NEXT on my list of things to understand how to
> use them (plus how to format a document properly: I am not a savvy document
> creator).
> 
> But still, find and replace does not corrupt a document.
> Thanks, Tracey

I made a type-o, it should read:
But still, find and replace SHOULD not corrupt a document.