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
___