[XeTeX] \beginL and colour

Jonathan Kew jonathan_kew at sil.org
Mon Nov 15 15:27:25 CET 2004


On 15 Nov 2004, at 8:56 am, Hans Hagen wrote:

>> Note that it should be possible to implement arbitrary text color 
>> changes by using \fontname to retrieve the current font name, adding 
>> a "color=...." attribute, and setting a new font. In this case, the 
>> color is associated directly with the actual text characters, so it 
>> will work properly despite the reordering.
>
> what rules apply for the font spec then?

See the XeTeX-notes file, and other samples. To summarize (somewhat 
informally),

	\font\cs = "FONTNAME(: ATTRIBUTE(; ATTRIBUTE)*)?" at SIZE

where FONTNAME is the "display name" of the font, as shown by FontBook 
(for example), and ATTRIBUTE can be any of several things:
	script=XXXX
	language=XXXX
		select script (shaping engine) and language system for OpenType
	+XXXX
	-XXXX
		enable or disable individual OpenType feature tag
	FEATURE=SETTING
	!FEATURE=SETTING
		enable specific AAT feature/selector by name
	color=RRGGBB
	color=RRGGBBAA
		set a color, with optional alpha channel
	AXIS=VALUE
		set value for a variation axis

So for example,
	\font\redrm="Hoefler Text:Ligatures=Optional Ligatures;color=FF0000" 
at 12pt
and so on.

Incidentally, I'm wondering if I should loosen up the font name parsing 
to allow colon and semicolon to be interchangeable, so that you could 
always add ":ATTRIBUTE" at the end of an existing font spec, without 
having to worry whether this is the first attribute being added to a 
raw font name.

HTH,  Jonathan



More information about the XeTeX mailing list