Hi Heiko, and others

On 30/11/2011, at 8:56 PM, Heiko Oberdiek wrote:

> 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.

In the experimental version of pdfTeX with support for Tagged PDF,
we need a similar kind of variant to \pdfliteral .
It is called 'enclose'.

Here is how, in the coding of the corresponding pdftex.web 
the various options are read, following an occurrence 
of \pdfliteral :

@ @<Implement \.{\\pdfliteral}@>=
begin
    check_pdfoutput("\pdfliteral", true);
    new_whatsit(pdf_literal_node, write_node_size);
    if scan_keyword("direct") then
        pdf_literal_mode(tail) := direct_always
    else if scan_keyword("page") then
        pdf_literal_mode(tail) := direct_page
    else if scan_keyword("enclose") then
        pdf_literal_mode(tail) := enclose
    else
        pdf_literal_mode(tail) := set_origin;
    scan_pdf_ext_toks;
    pdf_literal_data(tail) := def_ref;
end

and here is the documentation on those options:

@# {data structure for \.{\\pdfliteral}; node size = 2}
@d pdf_literal_data(#)     == link(#+1) {data}
@d pdf_literal_mode(#)     == info(#+1) {mode of resetting the text matrix
                              while writing data to the page stream}
@# {modes of setting the current transformation matrix (CTM)}
@d set_origin              == 0 {end text (ET) if needed, set CTM to current 
point}
@d direct_page             == 1 {end text (ET) if needed, but don't change the 
CTM}
@d direct_always           == 2 {don't end text, don't change the CTM}
@d scan_special            == 3 {look into special text}
@d enclose                 == 4 {like |direct_always|, but end current string 
and sync pos}


The 'enclose' option is used to position the 'BDC' and 'EMC'
as closely around the text snippets as can be achieved,
without breaking the BT ... ET.
This seems to be the same kind of requirement here.

It would be nice if any extension to literal specials in  xdvipdfmx
used the same keywords for similar functionality.

> 
> Yours sincerely
>  Heiko Oberdiek


Hope this helps,

        Ross

------------------------------------------------------------------------
Ross Moore                                       [email protected] 
Mathematics Department                           office: E7A-419      
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
------------------------------------------------------------------------






--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex

Reply via email to