[XeTeX] Drop-shadows with outline fonts in XeTeX ?

Mojca Miklavec mojca.miklavec.lists at gmail.com
Wed Jun 1 23:39:53 CEST 2011


On Wed, Jun 1, 2011 at 13:44, Philip TAYLOR (Webmaster, Ret'd) wrote:
>
> So, as the signs consist solely of text, I wondered whether it
> might be possible to re-engineer them in XeTeX, but I would
> like block shadow on the words "Thai-An" (see attached).  Is
> this possible using XeTeX, and if so, how can it best be achieved ?

Dear Phil,

I'm not aware of any "drop shadow" function in PDF, so it won't be
trivial to make one (unless I'm wrong about the first point).

I came accross the following vector example of dropping shadows, but I
didn't study in details how it works and in particular I wouldn't be
sure that it is easy to export it to PDF:
    http://wiki.inkscape.org/wiki/index.php/TricksAndTips

Unless I'm mistaken by the non-existence of drop-shadow, you have the
following options:
1.) Use a large number of shadows ranging from gray to white. You can
use a package pdfrender to create outlined fonts (just the stroke for
the outline) in different colors, different widths of stroke and
slightly shifted to each other (using some recursion).
2.) Extract outline for the outer shadow, outline for inner shadow,
make triangulation and then use smooth shading in PDF to color it. I
have a program that converts a triangural mesh with colored edges into
smooth shading patterns, but you need to provide triangulation of the
shadow first, as well as make sure that your printer is able to print
that out. Mac programs (Preview, Safari) crash when opening such file
with smooth shading or even when uploading it (Adobe Acrobat opens it
properly, but other programs crash).

An example of the first approach is attached. It uses 100 shades of
gray. It is not created in XeTeX, but it should be possible to adapt
it in one way or another.

Mojca

Here's the source code:

\setupbodyfont[gentium,100pt]

\starttext

\bf \newdimen\mywidth
\def\a#1#2{\mywidth=0.07pt\multiply\mywidth by #1%
\defineeffect[a][alternative=outer,rulethickness=\mywidth]\starteffect[a]Thai-An\stopeffect}

\startMPpage
for i=0 upto 100:
	draw textext("\a{" & decimal(100-i) & "}{" & decimal(i) &"}") shifted
((100-i)*0.017pt,-(100-i)*0.007pt) withcolor (i/300)[white,black];
endfor;
draw textext("Thai-An") withcolor blue;
\stopMPpage

\stoptext
-------------- next part --------------
A non-text attachment was scrubbed...
Name: thai-an.pdf
Type: application/pdf
Size: 17986 bytes
Desc: not available
URL: <http://tug.org/pipermail/xetex/attachments/20110601/a494c6dc/attachment-0001.pdf>


More information about the XeTeX mailing list