Will Robertson wrote:
> It sort of depends how you want to write the code for the test. Here's a
> proof of concept that might do what you need:
> 
> \documentclass{article}
> \usepackage{fontspec}
> 
> \makeatletter
> \newcommand\IsFont[4][]{%
>  \begingroup
>    \let\curr...@family\f@family
>    \fontspec[#1]{#2}
>    \ifx\curr...@family\zf@family
>      \global\l...@tempa\@firstoftwo
>    \else
>      \global\l...@tempa\@secondoftwo
>    \fi
>  \endgroup
>  \...@tempa{#3}{#4}
> }
> \makeatother
> 
> \begin{document}
> \newfontfamily\foo{Times New Roman}
> \setmainfont{Helvetica}
> test: \IsFont{Times New Roman}{Times}{not Times}
> \par\foo
> test: \IsFont{Times New Roman}{Times}{not Times}
> \end{document}
> 
> 
> I've considered adding such code to fontspec before. But this interface
> is not very reliable -- font options must be exactly the same for two
> fonts to be "equal". See how you go, though.
> 
> Will

Thanks for this, Will. This is exactly the kind of thing I wanted. I
could use it to create a usable command that will 'fix' all subsequent
instances of the font. If it's designed as a command for an end user,
then the user can specify the exact set options.

I think that this might be easier than defining a new fontspec option to
fix a font, which would require redefining fontspec.

Thanks,

Gareth.


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

Reply via email to