ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* for each script a different font
@ 2010-12-06 22:39 Peter Schorsch
  2010-12-07 13:44 ` Khaled Hosny
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Schorsch @ 2010-12-06 22:39 UTC (permalink / raw)
  To: ntg-context

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?

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: for each script a different font
  2010-12-06 22:39 for each script a different font Peter Schorsch
@ 2010-12-07 13:44 ` Khaled Hosny
  2010-12-07 15:19   ` Thomas A. Schmitz
  0 siblings, 1 reply; 4+ messages in thread
From: Khaled Hosny @ 2010-12-07 13:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: for each script a different font
  2010-12-07 13:44 ` Khaled Hosny
@ 2010-12-07 15:19   ` Thomas A. Schmitz
  2010-12-07 15:28     ` Khaled Hosny
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas A. Schmitz @ 2010-12-07 15:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users


On Dec 7, 2010, at 2:44 PM, Khaled Hosny wrote:

> Then:
> 
> \definefontsynonym [Serif][name:vollkornregular][fallbacks=arrows]
> 
> But I don't know how to use multiple fallbacks.

You can define as many fallbacks as you wish. Here's a silly example:

\definefontfallback [Foo] [name:texgyretermes-bold] [0x0031-0x0032] [force=yes,check=no]
\definefontfallback [Foo] [name:texgyreheros-italic] [0x0033-0x0034] [force=yes,check=no]
\definefontfallback [Foo] [name:texgyreadventor-bolditalic] [0x0035-0x0036] [force=yes,check=no]

\definefontsynonym[SerifPlus][Serif][fallbacks=Foo]

\definefont[MySerif][SerifPlus at 24pt]

\starttext

\MySerif 1234567890

\stoptext

That should get you going.

HTH

Thomas
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: for each script a different font
  2010-12-07 15:19   ` Thomas A. Schmitz
@ 2010-12-07 15:28     ` Khaled Hosny
  0 siblings, 0 replies; 4+ messages in thread
From: Khaled Hosny @ 2010-12-07 15:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, Dec 07, 2010 at 04:19:45PM +0100, Thomas A. Schmitz wrote:
> 
> On Dec 7, 2010, at 2:44 PM, Khaled Hosny wrote:
> 
> > Then:
> > 
> > \definefontsynonym [Serif][name:vollkornregular][fallbacks=arrows]
> > 
> > But I don't know how to use multiple fallbacks.
> 
> You can define as many fallbacks as you wish. Here's a silly example:
> 
> \definefontfallback [Foo] [name:texgyretermes-bold] [0x0031-0x0032] [force=yes,check=no]
> \definefontfallback [Foo] [name:texgyreheros-italic] [0x0033-0x0034] [force=yes,check=no]
> \definefontfallback [Foo] [name:texgyreadventor-bolditalic] [0x0035-0x0036] [force=yes,check=no]
> 
> \definefontsynonym[SerifPlus][Serif][fallbacks=Foo]
> 
> \definefont[MySerif][SerifPlus at 24pt]
> 
> \starttext
> 
> \MySerif 1234567890
> 
> \stoptext
> 
> That should get you going.

Thanks. I, naïvely, assumed I have to define several different fallbacks
and pass that do \definefontsynonym. This will simplify my font setup a
bit, but the issues in my other mail still exist.

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-12-07 15:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-06 22:39 for each script a different font Peter Schorsch
2010-12-07 13:44 ` Khaled Hosny
2010-12-07 15:19   ` Thomas A. Schmitz
2010-12-07 15:28     ` Khaled Hosny

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).