How can I use Replace All to change the font size of a selected term in a document?

Then you might find This is the Guide… to be a useful resource.

1 Like

You have a complex document: it is bilingual and, more, uses an Asian script. This requires you markup your text with styles (paragraph and character styles at least) so that Writer is aware of language changes.

This means you must create a consistent set of styles and apply them to the document. Warning! A common pitfall is to name styles for their visual effects. This is wrong. Styles should be chosen for their semantic significance (Devanagari vs. English, emphasis, definition, explanation, comment, note, …). You assign typographical attributes in a second step. With such a scheme and consistent systematic use, you can tune Devanagari sequences independent from English sequences.

I suggest you stop working on your present document to learn styles and practice on scratch documents. This is not a loss of time, even if you have a deadline. You’ll be much more effective and efficient afterwards.

Remarks:

  • Enable Complex Text Layout (Hindi variant) in Tools>Options, Language Settings>Languages
  • Don’t use Default Paragraph Style for any text in the document; this style, which is the ancestor of all others, is reserved for setting common attributes shared by all styles; standard style for discourse is Text Body
  • Prohibit direct formatting, use exclusively styles; this is the only way to manage long complex document and avoid formatting hell
  • Don’t vertically space with empty paragraph; vertical space is a property of paragraph styles as part of the significance of the paragraph
  • Don’t try to align horizontally with spaces; it won’t never be perfect and is highly sensitive to formatting change in the same line
    Your sample text seems to be tabular; use a table
1 Like

Thank you…I Wonder why when I use Replace All, and specify the font size of the characters to be replaced, and the size of those to replace them with, that nothing changes…? I’m not sure how the “Character Styles” functions relate to the problem.

Or simply use Find All button to have all instances selected, and use normal controls (preferably style sidebar, but also possible to use toolbar direct formatting controls).

No one could see things happening on your system. You could provide a sample document, mention your version, and provide exact steps (clicks, keystrokes, etc.) that you use, so that others could literally follow locally and see the problem, to return with an advise.

ReplaceSize

1 Like

To find all Hindi text, Find All

([\u0900-\u097F]+[:space:]{1})*[\u0900-\u097F]+

with [x] Regular expressions.

EDIT: Replace All with Format 11 pt don’t works for me (7.2.7.2 on Windows 10.0).


Could it be this, because paragraph style is Default?

2 Likes

Close FIND&REPLACE (selection of Hindi characters remains as active) and then apply 11p or other size… (hard formatting).

Yes, I did it that way.
If I add Light Red font color, the color is applied when Replace All, but not the 11 pt font size.

[\u0900-\u097F] may be more expressively represented as either [:script=Devanagari:], or \p{script=Devanagari}.

{1} is redundant: it requires exactly one occurrence of the space (native syntax of ICU regex is \s, [:space:] is a Posix-like alternative); and when you use a (meta)character without any occurrence modifiers, it will match exactly once (though why? Maybe \s+ is more appropriate? It’s a frequent thing to see several spaces in a row).

The regex will not match the whole text anyway (it will break on punctuation, numbers, non-Devanagari text…), and will require a global replacement, or a repetitive replacement. So maybe this form would be enough: \p{script=Devanagari}+\s*

Had you set the size for Western text (only shown by default in locales not using complex scripts), or had you enabled CTL under Options|Language Settings|Languages , and defined the size in the respective CTL section?

2 Likes

IT turns out that program doesn’t recognize the difference in font sizes when it comes to Devanagari characters. For example, you can specifically search for only 50 pt Devanagari characters, or only for 2 pt characters, and it will bring up all of them in the document, irrespective of size, for example, they are all 12 pt. So this is why it cant find and replace all of a certain size with a specified new size, like you can with regular letters. I should have tested this before making the post. Obvious really. Sorry for wasting everyone’s time. But thank you for all replies.

It does. I just tested with your sample file.
Just do as @mikekaganski wrote: “enabled CTL under Options|Language Settings|Languages”.
image

See the outcome:

And specifically in the Format dialogue where cursor is. That is where to change the size for Devanagari

Okay Ill try.

Wait…I didnt tick “Diacritic-sensitive”…I ticked “diacritic-sensitive” and now it seems to have worked properly. THank you everyone for the help…it looks a lot better now.

1 Like

It half-worked worked…unfortunately in the process a lot of the formatting for those characters glitched out in the following type of way (See attached; the bottom line is what it was, and the top line what it turns into). As you can see, half of each character (the main syllable) has been replaced with 11 pt font size, while the other half (the extra diacritics) haven’t been changed, making a big mess. If you replace it manually, it changes the whole thing, but not doing it with the Replace All function.
sample2.odt (10.2 KB)

General remark: this no solution to your problem and should not have been posted an an “answer”. Doing so confuses users and may prevent the occurrence of a true answer.


I have no idea about which exact regular expression you applied to your text, so just guessing about a possible cause. It is possible that the font size was applied only on the base character while the combining diacritical marks kept their original size. You end up with a weird composite character where components have not the same font size. It is then possible that the font renderer gets completely confused and considers you have a bare base character followed by orphan (= no base character) diacritical marks, which is an invalid Unicode sequence.

After having analysed the codepoint sequence (with Alt+X) and having found nothing suspicious, apart the discrpancy in size, I reconstructed the first line with Alt+X and it ended up identical to second line.

I had a deeper look at your sample. It is plagued with direct formatting. I can’t tell if you enabled Complex Text Layout in Tools>Options, Language Settings>Languages because it does not transfer reliably to other computers. But once enabled and direct formatting removed, the style machinery works as expected.

In this sample, you only use Default Paragraph Style. Consequently I went to the Font tab. With CTL enabled, you can make a difference between Western scripts and Hindi text. I set Hindi text at 6pt, 18 pt or 24pt and immediately on OK all the document is updated.

I highly recommend you follow a strict styling policy. Direct formatting is not at all your friend and has never been. The more complex your document, the more rigorous you must be. Mixing Western and Asian text is a complex task.

I inadvertently clicked “suggest an answer” obviously it wasnt the answer. This is the first time ever on this site and There doesnt seem to be a way for deleting accidental posts. Is there such a function? If so I would have deleted the post that accidentally ended up as “Answer”. As you can see, I have no found the solution, it was exactly as explained and instructed by the kind people above.

Thanks for your comments about the difference between styling and direct formatting I’ll bear that in mind for next time. I wasn’t even really aware there is a difference, being a rank amateur with technical things in general.

You can turn a comment into an answer, clicking first on the ellipsis icon (…) under a comment then on the tool icon to reveal Move to answers. Unfortunately there is no reverse command to turn an answer into a comment. This must be done by copying manually to a comment and deleting the non-answer afterwards. I don’t know what happens to comments on non-answer when you delete it.

Then you might find This is the Guide… to be a useful resource.