• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Grep expression to change font of Hebrew characters only

Engaged ,
Feb 19, 2019 Feb 19, 2019

Copy link to clipboard

Copied

Due to the discussion in the thread here: https://forums.adobe.com/thread/2596476

I was wondering if there is a Grep expression that could be used to apply a character style to Hebrew characters only (based on their position in the font map) to allow changing of the font of just those characters? I'm pretty good at find/replace but really don't know anything about using Grep. If Grep could do something like this it would save me a tremendous amount of time as I normally use English fonts that do not contain a Hebrew character set and need to apply a character style to each bit of Hebrew (which is interspersed within the English) to change it to a font with Hebrew characters.

I would think this might be possible with Grep. If anyone knows how, please let us know.

Views

3.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Mentor , Feb 19, 2019 Feb 19, 2019

Like Chad, I don't know a single word (or even letter, for that matter) in Hebrew, but here's my exercise, just for fun. I went from the opposite: find all non-Latin text and punctuation/spaces after it. 3 regexes to include in para style:

[^A-Za-z\h[:punct:]]+

[^A-Za-z[:punct:]]\K\h

[^A-Za-z]\K[[:punct:]]\h

​Hebrew.gif

Votes

Translate

Translate
Community Expert ,
Feb 19, 2019 Feb 19, 2019

Copy link to clipboard

Copied

You should be able to. You'll need to have a paragraph style applied to the Hebrew text. Then within the paragraph style, you can apply a character style using a GREP style that would look something like below. My character style is just highlighting the characters. I can't read Hebrew so I have no idea what it says. Hopefully this helps though. Just create a GREP expression for each character you want to change.

Forums_grep.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 19, 2019 Feb 19, 2019

Copy link to clipboard

Copied

Thanks, but that would be kind of tedious to change 1 character at a time. Is there a way to use Grep to change a range of characters based on their ASCII number or position in the character map of the font? If possible, that would allow all of the characters that need to be in a Hebrew font to be changed at once. I think that what you've suggested could even be done with the regular find/replace dialog.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Feb 19, 2019 Feb 19, 2019

Copy link to clipboard

Copied

Like Chad, I don't know a single word (or even letter, for that matter) in Hebrew, but here's my exercise, just for fun. I went from the opposite: find all non-Latin text and punctuation/spaces after it. 3 regexes to include in para style:

[^A-Za-z\h[:punct:]]+

[^A-Za-z[:punct:]]\K\h

[^A-Za-z]\K[[:punct:]]\h

​Hebrew.gif

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 19, 2019 Feb 19, 2019

Copy link to clipboard

Copied

Thanks winterm, very interesting. When I tried it with using style mapping for my body text on import, it did not work. The Hebrew characters showed the correct character style but with an override making them a different font.

However, when I imported the text removing styles and formatting and then selecting all text and applying the body text paragraph style, it was perfect. Since I usually do it that way (because there are often so many styles in the Word document that I have no use for), this works great.

Thank you so much. This will save me a huge amount of time!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Feb 19, 2019 Feb 19, 2019

Copy link to clipboard

Copied

You're welcome. BTW, if you have *correct* typeface defined in your char style, you can easily remove those overrides with simple Find/Change. Just in Text tab, with Find and Change fields left blank, in Find Format and Change Format fields point to the same char style, and you're done.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 19, 2019 Feb 19, 2019

Copy link to clipboard

Copied

Thanks. I did realize I could do that with find/replace, but since I normal place the files (they come from many different sources) without formatting, that isn't even necessary.

I am hoping though that you could give me a few more lines of Grep to insert. Hebrew often uses single and double quotes for abbreviations. When the Word text is placed, ID treats these a typographers quotes which are not normally part of a Hebrew character set. Is it possible to make Grep expressions to change these to dumb (straight) quotes? I would need it for both single and double quotes?

Thanks again.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Feb 19, 2019 Feb 19, 2019

Copy link to clipboard

Copied

Didn't you try to do it in Preferences > Type > Type Options section? Uncheck Use Typographers Quotes.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 19, 2019 Feb 19, 2019

Copy link to clipboard

Copied

Problem is that I need the typographer's quotes for the English text so I can't turn them off for the whole document.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 19, 2019 Feb 19, 2019

Copy link to clipboard

Copied

I can do it with find and replace, but I need to do it 4 times, twice for each single typographer's quote to straight and twice for each double.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Feb 19, 2019 Feb 19, 2019

Copy link to clipboard

Copied

These are different glyphs, and GREP as a part of para style doesn't change content, it just applies formatting. You will need to use F/C, one way or another.

Four times, really?

In Find What menu: Quotation Marks > Any Double Quotation Marks

In Change to menu: Quotation Marks > Straight Double Quotation Marks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 19, 2019 Feb 19, 2019

Copy link to clipboard

Copied

Good point. I had not thought of that route. I was just typing the characters into the find/replace boxes. That will do the job well.

Thanks again.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 19, 2019 Feb 19, 2019

Copy link to clipboard

Copied

winterm, one question. While the Grep expressions properly format the Hebrew text according to the character style that I have defined, they do not apply the character style. The text is left with no character style. For many reasons it is preferable for the text to have a character style. Obviously, I can do a find/replace for that font to change it to the character style, but I had thought the Grep would do that. Am I correctly understanding what the Grep does (just applying the font determined by the character style but not actually assigning the style to that text)?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Feb 20, 2019 Feb 20, 2019

Copy link to clipboard

Copied

Yes, char style(s) GREP applies won't show up in Char Styles panel. It's just the way GREP as a part of para style works. Formatting that GREP applies is live and monitored all the way. That's why on under powered machine one can face some lags working with big heavy grepped text amounts. If you don't like it for whatever reason (not obvious to me, except possible earlier mentioned lags), you can do one of a two:

1. Use *traditional* Find/Change to apply char style directly.

2. Use a script to turn already existing GREP styles to Char styles.

In both ways you'll end up with *traditionally* applied Char style, and loose some flexibility offered by GREP style.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 20, 2019 Feb 20, 2019

Copy link to clipboard

Copied

winterm  wrote

Yes, char style(s) GREP applies won't show up in Char Styles panel. It's just the way GREP as a part of para style works. Formatting that GREP applies is live and monitored all the way. That's why on under powered machine one can face some lags working with big heavy grepped text amounts. If you don't like it for whatever reason (not obvious to me, except possible earlier mentioned lags), you can do one of a two:

1. Use *traditional* Find/Change to apply char style directly.

2. Use a script to turn already existing GREP styles to Char styles.

In both ways you'll end up with *traditionally* applied Char style, and loose some flexibility offered by GREP style.

Thanks. I do not need to work large amounts of text for these types of jobs, so I think that your method works well. If I need to have a defined character style for some reason, I will use find/replace to apply it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 19, 2019 Feb 19, 2019

Copy link to clipboard

Copied

technically, hebrew doesn't use the standard straight single/double quotes -- it uses two specific characters (geresh/gershayim) found in TYPE -> Special ME Characters.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 20, 2019 Feb 20, 2019

Copy link to clipboard

Copied

akiva_atwood  wrote

technically, hebrew doesn't use the standard straight single/double quotes -- it uses two specific characters (geresh/gershayim) found in TYPE -> Special ME Characters.

I was aware that Hebrew really uses those characters and not quotes, but I didn't know that ID had a provision for them. I see it is even available through the find/replace dialog. That is helpful. Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Feb 21, 2019 Feb 21, 2019

Copy link to clipboard

Copied

For what it's worth, \p{Lo} is a Grep unicode-based character class that matches all non-latin characters.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 21, 2019 Feb 21, 2019

Copy link to clipboard

Copied

vinny38  wrote

For what it's worth, \p{Lo} is a Grep unicode-based character class that matches all non-latin characters.

Cool. Where did you find this expression?

Regards,
Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Feb 21, 2019 Feb 21, 2019

Copy link to clipboard

Copied

Cool. Where did you find this expression?

In Peter Kahrel's "GREP in InDesign" Bible.

Question is: where did he find it?

Maybe on Regular-Expressions.info which is a reference site.

FYI, found on this site:

"\p{Lo} or \p{Other_Letter}: a letter or ideograph that does not have lowercase and uppercase variants."

Which is the case in Hebrew (although I don't know nothing about it either^^)

Regards

Vinny

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 21, 2019 Feb 21, 2019

Copy link to clipboard

Copied

vinny38  wrote

Cool. Where did you find this expression?

In https://forums.adobe.com/people/Peter+Kahrel 's "GREP in InDesign" Bible.

Question is: where did he find it?

Maybe on Regular-Expressions.info which is a reference site.

FYI, found on this site:

"\p{Lo} or \p{Other_Letter}: a letter or ideograph that does not have lowercase and uppercase variants."

Which is the case in Hebrew (although I don't know nothing about it either^^)

Regards

Vinny

Wow, another method. I'll test out this one too and see if any of the expressions work better than others. Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Feb 21, 2019 Feb 21, 2019

Copy link to clipboard

Copied

Well, it was mostly an "for-your-information" comment...

Because it doesn't deal with the punctuation issue.

I suppose you should keep following TaW's advises on the matter... He knows Hebrew 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 21, 2019 Feb 21, 2019

Copy link to clipboard

Copied

LATEST

With scripting you can get 99% of it right...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 21, 2019 Feb 21, 2019

Copy link to clipboard

Copied

vinny38  wrote

For what it's worth, \p{Lo} is a Grep unicode-based character class that matches all non-latin characters.

I will try this out later today and will report back then.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Feb 20, 2019 Feb 20, 2019

Copy link to clipboard

Copied

I haven't read the entire thread, but from my extensive experience typesetting predominantly English books with interspersed Hebrew, the best way to apply a character style to the Hebrew is to search for all text that has its language set to Hebrew!

The reason is that luckily enough most authors write in Word, and when the keyboard is switched, in Word, to Hebrew, Word is smart enough to mark that text as Hebrew language. And this comes through into InDesign, so 90% of the time all Hebrew is properly marked as being Hebrew in InDesign.

Note, though, that for this to work you must first save an docx documents as the older .doc format in Word. The import filter in InDesign for .docx documents isn't as robust as the earlier .doc import filter, and only the older one imports language markings properly.

Just my 2 cents...

Ariel

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines