2

Consider

\documentclass[12pt]{book}
\usepackage{pstricks,psvectorian}

\RequirePackage[copies]{contour}%
\begin{document}

\contourlength{1pt}

\newcommand*{\outline}[1]{\color{white}\contour{black}{\Huge#1}}%
% Compiles with XELATEX

\thispagestyle{empty}

\begin{pspicture}(-5,-5)(4,4)%
\psframe[fillcolor=red!65!black,fillstyle=solid](-5,-5)(5,12) 
\psframe[linecolor=red!65!black](-5,-5)(5,12)

\rput(0,3){\outline{How to Outline Feather}}

\rput[tr]{-15}(2,.5){\psvectorian[width=4.1cm,color=white]{94}}
\end{pspicture}%
\end{document}

which produces

enter image description here

Compiling with Xelatex--- I have been able to outline words (\contour doesn't seem to work), but I have not been able to figure out how I might apply a similar outlining technique to a psvectorian image---in this case, a feather.

Does anyone know of a way to do this, while compiling the code with xelatex?

2
  • 2
    Have you try direct \outline{\psvectorian[width=4.1cm,color=white]{94}}, the output seems good to me.
    – Tom
    Jun 14, 2022 at 0:54
  • @Tom Thank you. I had not tried that before; but doing so now, with opening and closing braces about the command seems to work very nicely. Moreover, it is applicable to other psvectorian images as well. Perhaps you will post your suggestion as an answer.
    – DDS
    Jun 14, 2022 at 1:46

1 Answer 1

1

Just a draft.

I have to provide a new PostScript header (mypst.pro) which forks the definition of feather (no. 94) and replaces original fill path operation with gsave <setting color> stroke grestore fill (first stroke then fill) to give an outline effect.

I don't know why setting \psset{linecolor=...,fillcolor=...,...} in \mypsvectorian doesn't work. Thus <setting color> is hard-coded by 0 setgray in mypst.pro, by now.

% !TeX TS-program = xelatex
\begin{filecontents}[noheader,force]{mypst.pro}
% adapt from psvectorian.pro, /vec94
/my@vectorianDict 1 dict def
%
my@vectorianDict begin
/vec94 {
1 setlinejoin
%\pst@setColor
newpath
23.9866 13.2414 moveto
22.9696 13.417 22.7701 12.4519 23.1963 12.1138 curveto
23.6232 11.775 25.5035 12.1008 25.5035 12.1008 curveto
25.5035 12.1008 25.0009 13.0659 23.9866 13.2414 curveto
29.9165 15.7112 moveto
28.7253 15.8861 28.5621 15.1593 29.0129 14.7837 curveto
29.4657 14.408 32.1991 14.4831 32.1991 14.4831 curveto
32.1991 14.4831 31.107 15.535 29.9165 15.7112 curveto
35.8717 18.3702 moveto
34.8055 18.1188 34.6928 17.4788 36.1852 17.291 curveto
37.6769 17.1025 39.7717 17.3416 39.7717 17.3416 curveto
38.5184 18.0553 36.9372 18.6195 35.8717 18.3702 curveto
44.3219 21.6534 moveto
43.5952 21.6281 43.2564 21.0278 43.9968 20.7512 curveto
44.7365 20.4752 46.2146 20.801 46.2146 20.801 curveto
46.2146 20.801 45.05 21.6794 44.3219 21.6534 curveto
49.5012 24.0863 moveto
50.09 23.9859 51.2812 24.475 51.2812 24.475 curveto
49.351 25.1272 48.9111 24.1867 49.5012 24.0863 curveto
45.1388 24.826 moveto
45.6381 24.865 46.203 25.968 46.203 25.968 curveto
45.0377 25.6286 44.6348 24.7885 45.1388 24.826 curveto
38.2158 22.4812 moveto
38.8565 22.7196 39.532 23.9982 39.532 23.9982 curveto
37.8408 23.3213 37.5765 22.2435 38.2158 22.4812 curveto
31.2586 20.0996 moveto
31.8474 20.3379 32.249 21.6534 32.249 21.6534 curveto
31.0578 21.0148 30.6692 19.8612 31.2586 20.0996 curveto
23.5966 16.5267 moveto
23.8479 16.2747 24.2864 16.6647 24.2864 16.6647 curveto
24.9633 17.3163 25.2399 18.5198 25.2399 18.5198 curveto
24.0105 17.8552 23.3459 16.7767 23.5966 16.5267 curveto
1.2012 0.648 moveto
3.1062 0.6849 lineto
3.1062 0.6849 7.1817 5.1047 12.9716 7.847 curveto
18.7615 10.59 25.1217 9.142 25.9987 11.4273 curveto
25.9987 11.4273 22.9136 11.1227 22.723 12.4949 curveto
22.5324 13.8657 25.0084 13.9046 25.8082 12.1507 curveto
25.8082 12.1507 31.5598 11.885 32.1315 13.8657 curveto
32.1315 13.8657 28.2841 13.9033 28.5122 15.2372 curveto
28.7404 16.5704 30.7225 16.2269 32.4751 14.5514 curveto
32.4751 14.5514 39.3312 14.7044 39.7498 16.7241 curveto
39.7498 16.7241 34.6846 16.6094 34.7973 17.7896 curveto
34.9127 18.9719 38.6843 19.1235 40.1317 17.3327 curveto
40.1317 17.3327 47.6339 18.5512 46.7965 20.228 curveto
46.7965 20.228 43.3288 20.0374 43.2926 21.1043 curveto
43.253 22.1705 45.3116 22.208 46.72 20.8755 curveto
46.72 20.8755 53.5768 21.9048 52.3952 24.2277 curveto
52.3952 24.2277 49.3496 23.5037 48.9678 24.0754 curveto
48.5874 24.6464 49.8059 25.4844 51.8255 24.5706 curveto
51.8255 24.5706 54.1485 25.0664 56.0903 25.9796 curveto
58.0341 26.8942 58.3264 27.2097 58.1031 27.8805 curveto
58.1031 27.8805 53.8411 26.955 47.8845 24.9749 curveto
41.93 22.9949 38.6249 21.829 31.9983 18.9227 curveto
25.3717 16.0179 15.4899 10.6043 10.6671 7.5868 curveto
5.8457 4.5699 1.2012 0.648 1.2012 0.648 curveto
10.6849 7.9993 moveto
10.6849 7.9993 20.4759 14.0945 29.8072 18.3224 curveto
39.1413 22.5509 44.0159 24.074 49.7676 25.8266 curveto
55.5206 27.5786 58.0717 27.9986 58.0717 27.9986 curveto
58.0717 27.9986 58.0341 29.0655 55.9011 28.8374 curveto
53.768 28.6085 50.8727 26.7419 50.8727 26.7419 curveto
51.9403 27.6933 51.9403 28.4938 51.9403 28.4938 curveto
47.5581 27.3511 46.6442 26.246 45.9981 25.2939 curveto
45.3485 24.3424 44.8547 24.4948 44.8547 24.4948 curveto
44.3588 24.8369 44.8158 25.7508 46.0343 26.1702 curveto
47.2541 26.5882 47.1783 28.0744 47.1783 28.0744 curveto
45.8061 26.7419 43.2926 25.675 41.693 25.1033 curveto
40.0927 24.531 39.9022 24.1512 39.9022 24.1512 curveto
38.7977 21.8276 37.1209 21.7511 37.7302 22.8931 curveto
38.3401 24.0371 39.674 24.2666 39.674 24.2666 curveto
40.2833 24.8752 40.5114 26.3601 40.5114 26.3601 curveto
40.5114 26.3601 39.4835 24.8363 36.7405 23.8835 curveto
33.9982 22.932 32.7039 22.1705 32.7039 22.1705 curveto
32.2831 20.4561 31.484 19.6932 30.9506 19.8844 curveto
30.4165 20.0743 30.9895 21.1801 31.9027 21.7128 curveto
32.8173 22.247 32.7797 23.9224 32.7797 23.9224 curveto
32.7797 23.9224 30.9123 21.7128 28.5518 20.495 curveto
26.1893 19.2752 25.5425 18.5512 25.5425 18.5512 curveto
24.7044 15.7331 22.9511 15.8847 23.3698 17.0281 curveto
23.7892 18.1701 25.2747 18.8175 25.2747 18.8175 curveto
25.8833 19.7697 25.7317 20.9888 25.7317 20.9888 curveto
24.9687 19.6174 22.9894 18.0177 20.4001 16.3027 curveto
17.8094 14.5897 16.2473 12.456 16.2473 12.456 curveto
16.1326 14.3616 lineto
14.1901 11.0087 10.6849 7.9993 10.6849 7.9993 curveto
16.5527 16.4181 moveto
16.9707 13.9804 lineto
16.9707 13.9804 18.6468 15.9612 21.8084 18.0177 curveto
24.9687 20.0757 25.8471 21.8652 25.8471 21.8652 curveto
25.8471 21.8652 26.2275 21.2559 25.9229 19.4657 curveto
25.9229 19.4657 28.6645 21.1043 30.2635 22.1705 curveto
31.8651 23.2373 33.2742 25.1423 33.2742 25.1423 curveto
32.9313 22.7039 lineto
32.9313 22.7039 35.1409 24.0371 37.6926 24.9517 curveto
40.245 25.8662 41.1207 28.0369 41.1207 28.0369 curveto
40.5879 25.1798 lineto
40.5879 25.1798 45.6156 27.2371 47.5212 28.8756 curveto
47.2534 27.1612 lineto
47.2534 27.1612 49.6535 28.4569 52.6247 29.295 curveto
52.167 27.9993 lineto
52.167 27.9993 56.8518 30.0565 58.3005 28.4938 curveto
59.7478 26.9324 54.8335 24.7987 52.5468 24.2284 curveto
52.5468 24.2284 53.462 23.7318 52.0905 22.3235 curveto
50.7197 20.9144 47.0239 20.495 47.0239 20.495 curveto
47.0239 20.495 47.9781 19.0477 45.2351 17.8661 curveto
42.4921 16.6852 39.9022 16.7999 39.9022 16.7999 curveto
39.9022 16.7999 40.1317 14.8561 37.3129 14.1703 curveto
34.4927 13.4853 32.3221 13.8281 32.3221 13.8281 curveto
32.3221 13.8281 32.3979 12.4949 30.5688 11.8098 curveto
28.7404 11.1234 26.1886 11.3529 26.1886 11.3529 curveto
26.1886 11.3529 25.9987 9.6385 21.5796 9.1809 curveto
17.1619 8.724 15.1805 8.1127 10.648 5.7139 curveto
6.1142 3.3138 2.9142 0.1522 2.9142 0.1522 curveto
-0.0186 -0.0384 lineto
-0.0186 -0.0384 -0.0179 0.3052 4.2489 3.5044 curveto
8.5136 6.7043 14.9899 10.9718 16.5527 16.4181 curveto
gsave
  0 setgray % <<< hard-coded stroke color
  stroke
grestore
  fill
} def
%
end
\end{filecontents}

\documentclass[12pt]{book}
\usepackage{pstricks,psvectorian}

\usepackage[copies]{contour}%

\usepackage{xpatch}

\makeatletter
% new command \mypsvectorian which will eventually use the patched vectorian
\newcommand*\mypsvectorian[2][]{%
\bgroup%
  \def\@psvectorianWidth{}%
  \def\@psvectorianHeight{}%
  \psset[psvectorian]{scale=1,opacity=1,color=\psvectorianDefaultColor,flip=false,mirror=false}{}%
  \ifx\relax#1\relax\else\psset[psvectorian]{#1}\fi%
  \psset{linecolor=\@psvectorianColor,fillcolor=cyan,opacity=\@psvectorianOpacity}%
  \@psvectorianBox{\@psvectorianmirror{\@psvectorianflip{\@mypsvectorianDraw{#2}}}}%
\egroup%
}%

\def\@mypsvectorianDraw#1{%dessin du motif
  \@psvectorianWidhtHeight{#1}%
  \psset{unit=1bp}%
  \begin{pspicture}(0,0)(\@psvectorianX,\@psvectorianY)%
    \begin@SpecialObj
    \addto@pscode{
      my@vectorianDict begin 
      /fill \tx@setTransparency /fill load def 
      vec#1 
      end
    }
    \end@SpecialObj
  \end{pspicture}%
}%

% or, equivalently
%\NewCommandCopy{\mypsvectorian}{\psvectorian}
%\NewCommandCopy{\@mypsvectorianDraw}{\@psvectorianDraw}
%
%\xpatchcmd\mypsvectorian
%  {\@psvectorianDraw}
%  {\@mypsvectorianDraw}
%  {}{\PatchFailed}
%
%\xpatchcmd\@mypsvectorianDraw
%  {tx@vectorianDict}
%  {my@vectorianDict}
%  {}{\PatchFailed}
\makeatother

% load patched postscript header file
\pstheader{mypst.pro}

\begin{document}
\contourlength{1pt}
\newcommand*{\outline}[1]{\color{white}\contour{black}{\Huge#1}}%
\thispagestyle{empty}

\begin{pspicture}(-5,-5)(4,4)
  \psframe[fillcolor=red!65!black,fillstyle=solid](-5,-5)(5,12) 
  \psframe[linecolor=red!65!black](-5,-5)(5,12)
  
  \rput(0,3){\outline{How to Outline Feather}}
  
  \psset{linewidth=.03}
  \rput[tr]{-15}(2,.5){\mypsvectorian[width=4.1cm,color=white]{94}}
\end{pspicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .