Skip to content
Back to formatted view

Raw Message

Message-ID: <4EA7D901.40308@yeah.net>
Date: 2011-10-26T09:55:13Z
From: Jinsong Zhao
Subject: set different font family for strings in mtext or text?

Hi there,

Is it possible to set different font family for strings in mtext or text?

For example, on windows platform with windows() device:

plot(1:10, type = "n")
text(5,5, "Chinese (English)") #Chinese for Chinese characters

it will give the correct Chinese and English characters with two 
different font family, i.e., English character in default sans family, 
and Chinese character in the system default font family (it seems that 
the Chinese font family can not be set or changed).

However, when using pdf() or postscript(), if setting the font family to 
"Times", then error message will appear:
conversion failure on '...' in 'mbcsToSbcs': dot substituted for...

When set the family "song" (a CJK font family), the English character 
will be displayed in that CJK font family.

I hope to know, is there a mechanism that can be used to set different 
font family for one string, e.g., if one character can not be find in 
the default font family, then search for another font family?

Any suggestions or comments will be really appreciated?

Regards,
Jinsong