[XeTeX] Font change

Zdenek Wagner zdenek.wagner at gmail.com
Tue Dec 25 16:35:01 CET 2012


2012/12/25 Theodore M Rolle, Jr. <stercor at gmail.com>:
> Um...like this?
>
> \documentclass{article}
> \usepackage{fontspec}
> \begin{document}
> \setmainfont{Linux Biolinum}
> This is Linux Biolinum.\\
> \setmainfont{Linux Biolinum Keyboard}
> This is Linux Biolinum Keyboard.
> \end{document}
>
> I just tried it with a minimal example.  It worked.
>
Of course it works, but there are better ways, see below.

> On 12/24/2012 10:11 PM, Sasi Kumar wrote:
>> Dear friends,
>>
>> As a relatively new user of XeTeX, I have a number of doubts. But right
>> now, let me ask you two of them. I would be thankful if someone could point
>> out a good tutorial on xelatex.
>>
>> My doubts are:
>> 1. How can I change the font inside a document? For instance, let me say I
>> have a document such as this:
>>
>>     The fox and the dog
>> The quick brown fox jumped over the lazy dog. The quick brown fox jumped
>> over the lazy dog. The quick brown fox jumped over the lazy dog.
>>
\setmainfont{FreeSerif}

{\fontspec{FreeSans}  The fox and the dog} ...

Another way: you can also define \setsansfont{FreeSans} and then
\textsf{The fox and the dog} should work. It is worth to read the
fontspec documentation. The manual is quite long because the package
is very powerful.

>> I want "The fox and the dog" in the font, let us say, "FreeSans" and the
>> rest of the text in the font "FreeSerif". How do I do that?
>>
>> 2. I am creating a document in two languages, let us say, English and
>> Malayalam, with both languages appearing intermixed. Now, how do I set the
>> fonts for each language? I have a font for Malayalam, but the English text
>> does not appear very beautiful in that font, so I would like the English
>> text to appear in some other font.
>>
The best way would be to translate all the captions into Malayalam and
send them to Arthur Reutenauer to include them to the polyglossia
package. You can them define separate fonts for English and Malayalam.
The fonts will be changed automatically when the language is changed.
If you have basically an English text with a few Malayalam words, you
can take advantage of the ucharclasses package. You will then use:

\usepackage[Malayalam]{ucharclasses}
\setTransitionTo{Malayalam}{\fontspec[Script=Malayalam]{MalayalamFont}}

Now the font will be changed automatically whenever a character from
the Malayalam block is encountered.

>> Thanking for any help that may be forthcoming and wishing everyone a Merry
>> Christmas and a Very Happy 2013 and beyond.
>>
I wish the sam to all of you, my greeting card is on my web page
http://icebearsoft.euweb.cz/ and you can see the archive of the cards
from previous years.

>> Regards,
>> Sasi
>>
>>
>>
>> Dear friends,
>>
>> As a relatively new user of XeTeX, I have a number of doubts. But right
>> now, let me ask you two of them. I would be thankful if someone could
>> point out a good tutorial on xelatex.
>>
>> My doubts are:
>> 1. How can I change the font inside a document? For instance, let me say
>> I have a document such as this:
>>
>>     The fox and the dog
>> The quick brown fox jumped over the lazy dog. The quick brown fox jumped
>> over the lazy dog. The quick brown fox jumped over the lazy dog.
>>
>> I want "The fox and the dog" in the font, let us say, "FreeSans" and the
>> rest of the text in the font "FreeSerif". How do I do that?
>>
>> 2. I am creating a document in two languages, let us say, English and
>> Malayalam, with both languages appearing intermixed. Now, how do I set
>> the fonts for each language? I have a font for Malayalam, but the
>> English text does not appear very beautiful in that font, so I would
>> like the English text to appear in some other font.
>>
>> Thanking for any help that may be forthcoming and wishing everyone a
>> Merry Christmas and a Very Happy 2013 and beyond.
>>
>> Regards,
>> Sasi
>>
>> --
>> V. Sasi Kumar
>> Free Software Foundation of India
>> Please see: http://swatantryam.blogspot.com/
>>
>>
>>
>>
>> --------------------------------------------------
>> Subscriptions, Archive, and List information, etc.:
>>   http://tug.org/mailman/listinfo/xetex
>>
>
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
>   http://tug.org/mailman/listinfo/xetex



-- 
Zdeněk Wagner
http://hroch486.icpf.cas.cz/wagner/
http://icebearsoft.euweb.cz



More information about the XeTeX mailing list