Grep styles

Tagged: , ,

Viewing 2 reply threads
  • Author
    Posts
    • #92030

      I have a few documents that have legal lines for 4 different countries (Japan, China, Macau, and Arabic) The legal line is composed for the most part of english and then the japanese characters, chinese characters etc. For example: ????????????TM and © My company. All rights reserved.

      I have followed the tutorial for dual fonts using GREP styles. For each country, I’ve made 4 different character styles. Each with its own designated font. The text box on the document is linked to a paragraph style that contains the English font that I would like to use (Arial). I’m using unicode ranges for each language. For example, china CJK ranges is 4E00–9FD5

      My GREP styles is as follows:

      Apply Style: Macau
      To Text: [\x{4E00}-\x{9FD5}\x{3000}-\x{303F}]+

      Apply Style: China
      To Text: [\x{3000}-\x{efff}\x{4E00}-\x{9FD5}\x{3300}-\x{33FF}][^.,;:?!\d]+

      Apply Style: Japan
      To Text: [\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{FF00}-\x{FFEF}\x{3000}-\x{303F}\x{4E00}-\x{9FD5}]+

      Apply Style: Arabic
      To Text:[\x{0600}-\x{06FF}\x{0750}-\x{077F}][^.,;:?!\d]+

      The above GREP style works well for Japanese documents but it doesn’t work for the Chinese or Macau documents. If I change the order of the GREP styles in order for the Chinese or Macau files to work, then the japanese document stops working. My dilemma is that I can’t have different documents for each country and load their own grep style since the documents share with each other contents.

      I was wondering if there’s a specific GREP styles order that I should follow or am I missing something so fundamental for it work properly across all 4 languages.

    • #92032
      David Blatner
      Keymaster

      It looks like each one includes some of the same unicode values.
      It would be like saying “if it’s a–m then do this, but if it’s h-q then do that.”

      For example, China goes from 3000 to efff, but Japan goes from 3040 to 309F. Well, everything from 3040 to 309F is inside the China range.

    • #92034

      Exactly right. Since CJK is a unified unicode range for japan, china and korea I can’t do much. For me is interesting how modifying the GREP style order will make the next country fail.

      If i place china style on top and japan style at the bottom then the chinese document will not work but the japanese will. If its for China, then the China style has to be at the bottom of the order. If its for Japan, then the Japan style has to be at the bottom of the order. Same thing for Macau.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.
>