On 2010-11-10, Michael Joyner wrote:
> On Tue, Nov 9, 2010 at 9:02 AM, Walter <[email protected]> wrote:

>>  IMHO, the best possible solution for documents with heavy use of
>> multilingual text would seem to be a combination of this type of
>> solution (character styles with font associations), and automatic
>> unicode block-based input classification.   This would enable LyX to
>> automatically change the default, available and/or recommended styles
>> based on what kind of character was input.

> What is needed is something like
> http://www.ctan.org/tex-archive/macros/xetex/latex/fontwrap/ so that
> fonts are *autoselected* based on UNICODE range unless otherwise
> overridden.

In my view, the better approch is autoselection of the the *language*
(which you should set anyway for proper hyphenation and typography):

* have a GUI option for secondary languages and associated Unicode-range
  or script,
  
* let LyX change the text language based on the used script.
  
Of course, this auto-language feature only works for languages using
different scripts like English and Russian, but not English and German.
However, in the second case the need for a font switch is less likely.

Then, the language package (babel or polyglossia) can select the
appropriate font.

BTW: using the language package to select the font is already possible
     right now with some LaTeX-preamble code.
     
     All you have to do is setting the text language (it helps to bind
     often used languages to a key-combo).

With XeTeX, disable "babel" in Tools>Settings>Language and follow the
advise in polyglossia.pdf:

  With polyglossia it is possible to associate a specific font with any
  script or language that occurs in the document. That font should always
  be defined as \⟨script⟩font or \⟨language⟩font. For instance, if the
  default roman font defined by \setromanfont does not support Greek, then
  one can define the font used to display Greek with:
                 \newfontfamily\greekfont[⟨options⟩]{⟨font⟩}.
  See the fontspec documentation for more information.
  
  Whenever a new language is activated, polyglossia will first check
  whether a font has been defined for that language or – for languages in
  non-Latin scripts – for the script it uses. If it is not defined, it
  will use the currently active font and will attempt to turn on the
  appropriate OpenType tags for the script and language used, in case
  these are available in the font, by means of fontspec’s
  \addfontfeature. If the current font does not appear to support the
  script of that language, an error message is displayed.


Günter

Reply via email to