Search-replace and opentype font features

Since v. 5.3, LibO Writer happily supports use of opentype features, using the feature tags with the fontname in one of two forms:

  • Fontname:onum=1
  • Fontname:+onum

Both of those would give you the “Oldstyle Figures” while using “Fontname”.

I seem to have run into a sort of “gotcha”. I prefer to use oldstyle figures with Cambria in my “normal” documents. However, when I want to get rid of the :+onum feature … I can’t! Regular CTRL+H search and replace is quite irregular in finding Cambria:+onum as the Format > Font search field, and the venerable AltSearch fails for me on this as well.

My workaround at the moment is to assign a different document template which does not make use of opentype features. However, it ought to be possible (I would assume) to do some kind of automated search/replace on these feature tags. Is it?

I’m using LibO Version: 6.0.3.2; Build ID: 1:6.0.3-0ubuntu1 (also equivalent on OSX); AltSearch 1.4.2-3/2017.


Update [20180516] - It seems as if this commit, for 6.2.0 series adds this functionality for LibreOffice. I’m not 100% clear on that, though, so if anyone can confirm, that would be great.

While that commit is a step in the right direction I do not see anything there which helps here.
That commit is simply adding code to read the OpenType features from the font files.
There is a later commit which adds an interface to work with OpenType features.
But that just automates adding the codes to the font name (same as now).
Does not seem to affect search functions.

IMHO, this a semantic markup issue. The numbers in “oldstyle” have a particular meaning for you, whereas other occurrences may be formatted “normal” because of a different meaning.

As a consequence I’d suggest to create a specific character style for your “oldstyle” numbers, forcing Fontname:+onum in the Font tab.

For this to be effective, the opentype feature must not be activated in any of your paragraph styles.

Now, you may object that regular Ctrl+H does not search on character style. This does not matter once the character markup has been done. You no longer need to search for your occurrences, you just change the character style et voilà.

Of course, marking up an existing document is boresome but it will lighten maintenance burden.

Since you’re a respectable guru, I won’t make the offence of adding the traditional stance about question etiquette. Cheers.

:wink: +1 for another approach to the problem … of course (like my own “workaround”) it doesn’t directly address the issue of doing search/replace on opentype features, as they have been implemented for Writer (which you realize, of course!). Hopefully we’ll get yet more clarity on this one, then.

I have no problems with searching for fonts with OpenType tags: just write the tag when you select the font to be searched!

(sorry for the Spanish screenshot!)

I tested this on 6.0.4 and it works as intended.

But… always use styles!!! :wink:


A technical point: the “=1” is for Graphite fonts, it gets ignored on OpenType fonts. On LibO, for OpenType fonts and multiple tags you can use either

Font Name:+TAG1&+TAG2

or

Font Name:TAG1&TAG2

To disable OT features you use the first notation with a “-” instead of a “+”

  • Yes, I always use styles. :wink:
  • And this works for me on the laptop I’m now using (OSX, with Collabora Vanilla LibO, v. 6.0.3.2. It was not working on my main desktop (in the office – will check again on Monday) which is running LibO 6.0.3.2 under Ubuntu.
  • Both forms of opentype tagging seem to work, and oddly, you can even mix them!