Skip to main content
Aratype
Known Participant
October 17, 2022
Answered

How to define a default font per language?

  • October 17, 2022
  • 2 replies
  • 967 views

I need to define a default font when I write in Arabicscript and other default font when I write in any Western Europe language script in the same sentence.

Is it easy to do that in InD like in Word?

Thanking you in advance.

AraType

This topic has been closed for replies.
Correct answer Barb Binder

Hi @Aratype:

 

You can set up a base paragraph style for each (and eventually child styles of each) in the Paragraph styles panel. Once you create both of the styles, you simply choose the correct style before you start typing (or after) to set the font and the language for spellcheck and hyphenation. When the languages changes mid-paragraph, you can do the same thing with character styles

 

~Barb

2 replies

Joel Cherney
Community Expert
Community Expert
October 18, 2022

I wouldn't say that it's as easy as is it in Word, but it's fairly easy. Word doesn't force you to use styles, but the easiest way to do this in ID requires fairly diligent use of paragraph styles. 

 

My default paragraph style for mostly Arabic text with occasional English words in it would have a font specified with Arabic support (e.g. Adobe Arabic, which I actually don't like or use but we both have access to it, right? 🙂 😞

 

 

But then I could make a character style for only Latin script letters (that probably has a Latin-script font and English langauge (applied), and apply it with a GREP style:

 

 

So, you can specify exactly which characters you want it to apply to with the regular expression in the "To Text:" field. The expression there only affects A through Z, but you might want one that also handles numerals, or quotation marks, or whatever.

 

There are plenty of ways to specify exactly which characters get your character style applied, including specifying ranges of Unicode values. If you don't know regular expressions, you can just come back to this thread with a request and I, or one of the many other forums regulars who use regex, can figure out how to write a query for you that captures all of your Latin-script without being too greedy.

 

You could do it in the other direction as well - a default English paragraph style that applied Arabic font, right-to-left behavior, and Arabic language to all text that was set in Arabic glyphs. If that is what you want, let me know and I'll post some more examples.

 

 

Aratype
AratypeAuthor
Known Participant
October 19, 2022

Many thanks, I believe this is the solution. However, when I applied it I got erors in the text:

In my GREP instructions, I put:

Joel Cherney
Community Expert
Community Expert
October 19, 2022

The text in your sample is set in STIX Two Test. That's because the English character style is applied to the whole paragraph. If you turn it off, your regex works as intended, I think. 


No, actually your regex doesn't capture everything, does it? I don't know how it affects your match to have both \d and [[:digit:]] in there. Honestly, I think you might want a few different regexes to really capture the effect you want:

 

1) one regex to capture the punctuation you want set in STIX Two Text. Does "all special characters" really include Arabic punctuation like the RTL comma? [[:punct:]] captures that comma, and you really do want that set in Adobe Arabic, I'd imagine. So you should probably just specify each symbol you want to show up in STIX Two Text that you want to behave in an RTL way; and,

 

2) another regex to capture all of your digits and Latin script, which you want to mark as STIX Two Text and left-to-right character behavior and English language. I think that [\l\u\d]+ works fine here, but if you really want to be specific, the syntax for specifying Unicode values would look something like this: [\x{0030}-\x{0100}]+

 

 

 

Barb Binder
Community Expert
Barb BinderCommunity ExpertCorrect answer
Community Expert
October 17, 2022

Hi @Aratype:

 

You can set up a base paragraph style for each (and eventually child styles of each) in the Paragraph styles panel. Once you create both of the styles, you simply choose the correct style before you start typing (or after) to set the font and the language for spellcheck and hyphenation. When the languages changes mid-paragraph, you can do the same thing with character styles

 

~Barb

~Barb at Rocky Mountain Training
Aratype
AratypeAuthor
Known Participant
October 19, 2022

Thank you very much. I would like to analize your solution too in the light of GREP.