[XeTeX] Diacritics in color

Heiko Oberdiek heiko.oberdiek at googlemail.com
Wed Nov 30 10:56:54 CET 2011


On Wed, Nov 30, 2011 at 05:10:07AM +0200, Khaled Hosny wrote:

> > A\textcolor{red}{^^^^0308}\\ % (3)

> It seems Charis SIL composes accented glyphs, try Gentium Basic instead
> (GenBasR.ttf).

Thanks, the result is correct, the box contents after luacolor's
processing is:

  ....\EU2/GentiumBasic(0)/m/n/100 A
  ....\pdfliteral direct"1 0 0 rg 1 0 0 RG"
  ....\EU2/GentiumBasic(0)/m/n/100 Ì

The part in the PDF with/without color:

  % without color:
  1 0 0 1 72 590.679 Tm [<0024>]TJ
  1 0 0 1 126.191 606.246 Tm [<0301>]TJ

  % with color:
  1 0 0 1 72 491.053 Tm [<0024>]TJ
  1 0 0 rg 1 0 0 RG
  1 0 0 1 126.191 506.619 Tm [<0301>]TJ

In case of XeTeX:

  .\EU1/GentiumBasic(0)/m/n/100 A
  .\special{color push rgb 1 0 0}
  .\EU1/GentiumBasic(0)/m/n/100 Ì210
  .\special{color pop}

The PDF stuff:

  % without color:
  0 -99.63 Td[<0024>]TJ
  54.19 15.57 Td[<0301>]TJ

  % with color:
  -54.19 -115.2 Td[<0024>]TJ
  ET 1 0 0 RG 1 0 0 rg BT /F1 99.626 Tf
  59.3 -278.84 Td[<0301>]TJ

  % with color via \special{pdf:code ...}:
  0 -378.46 Td[<0024>]TJ
  ET 1 0 0 rg 1 0 0 RG BT /F1 99.626 Tf
  59.3 -378.46 Td[<0301>]TJ

It seems that in XeTeX the color cannot be inserted without
breaking the PDF text sections (BT...ET). \special{pdf:literal direct ...}
(or short \special{pdf:code ...}) is not equivalent to
\pdfliteral direct{...} but rather to \pdfliteral page{...}
that ends a text section in the PDF output.

If someone want's this issue fixed, make a feature request
for XeTeX/xdvipdfmx to provide a real "\pdfliteral direct"/
"direct mode for colors" without breaking text sections.

Yours sincerely
  Heiko Oberdiek


More information about the XeTeX mailing list