[XeTeX] Changing Font Styles for a defined font
Jonathan Kew
jonathan at jfkew.plus.com
Mon Feb 2 22:16:22 CET 2009
On 2 Feb 2009, at 20:59, Andy Black wrote:
> Hello.
Hi Andy,
>
> I'm working on writing an XSLT that will take an XML-based document
> mark-up package and format it via XeLaTeX.
>
> The XML document has language elements which include font information
> (such as font-family, font-style, font-size, and font-weight). I've
> learned that by using the fontspec package, I can define fonts such as
>
> \font\LangTuzFont="Charis SIL/I" at 10pt
That's not fontspec, that's a "raw" XeTeX \font command.
>
> This works just fine to display some text within a table, say, such
> as this:
>
> &\LangTuzFont{Duu}&
It looks like you're misunderstanding what \LangTuzFont means here.
It's not a command taking an argument, it's a declaration that changes
the current font. So the braces here are not causing your font to
apply to just that word; they're merely providing a (useless) extra
level of grouping.
As it happens, each table cell is a local group in its own right, so
the scope of your font switch was indeed limited, but not in the way
you may have thought!
If this wasn't within a cell, you'd probably want braces around the
whole thing: {\LangTuzFont Duu}.
>
> What the XML mark-up allows, however, and what I have not been able to
> figure out how to do in XeLaTeX so far, is to modify some aspect of
> the
> font such as
>
> &\LangTuzFont{Duu-\bfseries{gu}}&
>
> where I want the result (Duu-gu) to all be in the Charis SIL font with
> italic, with the "-gu" portion to also be bold (as well as Charis SIL
> italic). (The idea is to draw the reader's attention to the bold
> part.)
>
> What I am getting is the "Duu" part in Charis SIL italic, but the "-
> gu"
> part is bold in the default font of the document.
>
> Could someone please tell me how to get what I want?
It sounds like you really do want to be using fontspec, and *not*
plain XeTeX font definitions. Read (or re-read) the fontspec
documentation, and in particular, look for the \newfontfamily command.
\newfontfamily{\LangTuzFamily}{Charis SIL}
will define a new font family, akin to \rmfamily, \sffamily, etc. This
will respect the usual LaTeX commands for shape, series, and size. So
you might have something like
... & \LangTuzFamily \textit{Duu-\textbf{gu}}& ...etc...
within your table.
JK
More information about the XeTeX
mailing list