ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Khaled Hosny <khaledhosny@eglug.org>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: for each script a different font
Date: Tue, 7 Dec 2010 15:44:09 +0200	[thread overview]
Message-ID: <20101207134409.GC1971@khaled-laptop> (raw)
In-Reply-To: <idjook$5pt$1@dough.gmane.org>

On Mon, Dec 06, 2010 at 11:39:59PM +0100, Peter Schorsch wrote:
> Hi all,
> 
> is it possible to mix severel fonts (for each script one font)? Regarding to 
> some fragments of the wiki I tried:
> 
> \setupdirections[bidi=global]
> 
> \definefontfeature[cyrl][script=cyrl]
> \definefontfeature[brai][script=brai]
> \definefontfeature[arab][script=arab]
> 
> \starttypescript [serif] [vollkorn]
>   \definefontsynonym [Serif][name:vollkornregular]
>   \definefontsynonym [Serif][name:doulossil][feature=cyrl]
>   \definefontsynonym [Serif][name:scheherazade][feature=arab]
>   \defomefpmtsynonym [Serif][name:sechspunktbraille][feature=brai]
> \stoptypescript
> 
> 
> \definetypeface[fliesstext][rm][serif][vollkorn]
> \setupbodyfont[fliesstext,rm,11pt]
> 
> \starttext
> 
> Regular Еупгдфк цшкв уы more test text a ُءشةحمث and continue latin script 
> ⠇⠤⠧⠬⠀⠟⠢⠭.
> 
> \stoptext
> 
> But the last \definefontsynonym overrides the entire unicode space and not 
> only the part regarding to the related script.
> 
> Is the mechanism I tried in ConTeXt possible?

There is the fallback feature:

\definefontfallback[arabic][name:scheherazade][arabic][force=yes,features=arab]

Then:

\definefontsynonym [Serif][name:vollkornregular][fallbacks=arrows]

But I don't know how to use multiple fallbacks.

The text below is a feature request for Hans (warning, a long, boring
email)

Font fallbacks is not really suitable for this kind of usage because it
does not handle common characters (digits, punctuation, etc.) that are
used in several scripts. Unicode provide script property for each
character and a simple algorithm to handle characters with no explicit
script property:

  http://unicode.org/reports/tr24/

* each character have a script property value, which is either:
  - explicit script value, in this case no special handling is needed

  - 'inherited': these character inherit the script property of the
    preceding character. Unicode suggests that all combining marks be
    treated as having 'inherited' property even if they have an explicit
    one, the idea is that a combining mark should always have the same
    script as its base character.

  - 'common': characters used in multiple scripts. In most cases this
    can be handled by assigning it the script of preceding character,
    with the exception of paired characters like () which should take
    the script value of outer text, and both characters in a pair should
    take the same value.
  
  - 'unknown': for unassigned character codes (like PUA).


The value of using that over simple fallbacks (it need not to replace
the existing fallback mechanism), is that one wants to apply the same
font and font features for contiguous runs of text of certain script
including things like numbers or punctuation, here is one (real) use
case:

 This week I was typesetting a small Arabic book[1], I wanted to use
 'anum' feature, but since I'm using the same font for Arabic and
 English that will convert all numbers globally which is not desired.

 Also I wanted to use different feature for Arabic and English texts (as
 you can see in that book, ligature and kerning not activated in English
 parts because I was using 'script=arab' for all the text).
 
 I would have defined a special English font and manually marked all
 English parts with it, but this has two main drawbacks:

   - Editing mixed Arabic and English is a real PITA because of the
     mixed directionality, adding command switches on top of that is
     adding salt to the wound.
   - The book was actually authored in OpenOffice and converted to
     ConTeXt in a semi-automated way, so searching for all English
     passages and marking them is not that simple. I'm also thinking in
     totally automated typesetting from XML and such, where it is not
     even possible to mark text runs in a clean way.

 [1] http://www.khaledhosny.org/files/tmp/arabic-foss-l10n-manual.pdf

IMHO, such feature coupled with bidi support will make multi-script
multi-directional typesetting first class citizens in ConTeXt :)

Thanks for reading tell here :)
Regards,
 Khaled

-- 
 Khaled Hosny
 Arabic localiser and member of Arabeyes.org team
 Free font developer
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2010-12-07 13:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-06 22:39 Peter Schorsch
2010-12-07 13:44 ` Khaled Hosny [this message]
2010-12-07 15:19   ` Thomas A. Schmitz
2010-12-07 15:28     ` Khaled Hosny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101207134409.GC1971@khaled-laptop \
    --to=khaledhosny@eglug.org \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).