On Mon, Aug 30, 2010 at 08:22:53AM +0100, Jonathan Kew wrote:

> On 30 Aug 2010, at 05:56, Wilfred van Rooijen wrote:
> 
> > The (more dificult) solution could be to make a shell script which will run 
> > the compilation of the xelatex source and detect whether or not the run was 
> > succesfull - if not, change the input file to the other font and retry.
> 
> I'm surprised no-one has suggested the straightforward, pure-xetex approach: 
> something along these lines (untested).....
> 
>   \def\myfont{"Myriad Pro"}
>   \def\myfallback{"Arial"}
>   \count255=\interactionmode
>   \batchmode
>   \font\foo=\myfont\space at 10pt
>   \ifx\foo\nullfont
>     \font\foo = \myfallback\space at 10pt
>     \ifx\foo\nullfont
>       \errorstopmode
>       \errmessage{no suitable font found}
>     \else
>       \let\myfont=\myfallback
>     \fi
>   \fi
>   \interactionmode=\count255
>   % and now proceed to use \myfont.....

* It takes lots of time if the font cannot be found.
* kpsathea complains "Invalid fontname `Myriad Pro', contains ' '
* The error code is set because of the error message, if the
  font cannot be found.

Yours sincerely
  Heiko Oberdiek


--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex

Reply via email to