Discussion:
[XeTeX] Stroking a TeX rule in XeTeX
Philip Taylor (RHUoL)
2018-03-21 12:53:01 UTC
Permalink
The following code applies a 3 pt blue stroke to red-filled glyphs, but
has the undesirable side-effect of changing the colour of TeX rules to
the stroke colour.  Is it possible, does anyone know, to control the
stroke and fill colour of TeX rules (a) independently, and (b)
orthogonally to that of TeX glyphs ?

Philip Taylor

--------

% !TeX Program=XeTeX

\magnification 4096

\hsize = 210 true mm
\vsize = 297 true mm

\pdfpagewidth = \hsize
\pdfpageheight = \vsize

\advance \hoffset by -1 true in
\advance \voffset by -1 true in

\font \tenrm = "Calibri Bold"

\let \Hrule = \hrule
\let \Vrule = \vrule

\def \hrule {\Hrule height 4 true pt depth 4 true pt}
\def \vrule {\Vrule width 8 true pt}

\topskip 0 pt plus 1 fill

\special{pdf:bcolor [1.0  0.0 0.0] [0.0 0.0 1.0]} % first defines fill
colour, second stroke colour
\special{pdf:literal direct 0.3 w 2 Tr} stroke width followed by
rendering mode

\centerline
    {%
        \vbox spread 1 pc
            \bgroup
                \hsize = 0,210 \hsize
                \hrule
                \vss
                \hbox to \hsize {\vrule \hss Hello\hss \vrule}
                \vss
                \hrule
            \egroup
    }

\end



--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/xetex
Zdenek Wagner
2018-03-21 13:07:03 UTC
Permalink
Yes, both in pdftex in xetex the stroke colour and fill colour are
independent. You can even change the rendering mode of text and print glyph
outlines in one colour with a specified line width and fill them with
another colour. It is shown in my article:
Zdeněk Wagner: Tisk obrysu písma v PDF
which is available here: http://bulletin.cstug.cz/bul2013-1.shtml
It is written in Czech but I hope you can find the code.


Zdeněk Wagner
http://ttsm.icpf.cas.cz/team/wagner.shtml
http://icebearsoft.euweb.cz
Post by Philip Taylor (RHUoL)
The following code applies a 3 pt blue stroke to red-filled glyphs, but
has the undesirable side-effect of changing the colour of TeX rules to the
stroke colour. Is it possible, does anyone know, to control the stroke and
fill colour of TeX rules (a) independently, and (b) orthogonally to that of
TeX glyphs ?
Philip Taylor
--------
% !TeX Program=XeTeX
\magnification 4096
\hsize = 210 true mm
\vsize = 297 true mm
\pdfpagewidth = \hsize
\pdfpageheight = \vsize
\advance \hoffset by -1 true in
\advance \voffset by -1 true in
\font \tenrm = "Calibri Bold"
\let \Hrule = \hrule
\let \Vrule = \vrule
\def \hrule {\Hrule height 4 true pt depth 4 true pt}
\def \vrule {\Vrule width 8 true pt}
\topskip 0 pt plus 1 fill
\special{pdf:bcolor [1.0 0.0 0.0] [0.0 0.0 1.0]} % first defines fill
colour, second stroke colour
\special{pdf:literal direct 0.3 w 2 Tr} stroke width followed by rendering
mode
\centerline
{%
\vbox spread 1 pc
\bgroup
\hsize = 0,210 \hsize
\hrule
\vss
\hbox to \hsize {\vrule \hss Hello\hss \vrule}
\vss
\hrule
\egroup
}
\end
--------------------------------------------------
http://tug.org/mailman/listinfo/xetex
Philip Taylor (RHUoL)
2018-03-21 13:34:12 UTC
Permalink
--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/xetex

Loading...