-
Notifications
You must be signed in to change notification settings - Fork 23
/
pgfornament-han.sty
70 lines (62 loc) · 2.17 KB
/
pgfornament-han.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
% pgfornament-han.sty v0.33 2019/08/10
% Authors: pgf and LaTeX code by LIM LianTze
% based on CAD drawing by ZHANG Chennan
\ProvidesPackage{pgfornament-han}
\RequirePackage{xpatch}
\RequirePackage{pgfornament}
\def\pgfornamenthan{\pgfutil@ifnextchar[{\pgf@ornamenthan}{\pgf@ornamenthan[]}}%
\let\pgf@ornamenthan\pgf@ornament
\xpatchcmd{\pgf@ornamenthan}{\@pgfornamentDim}{\@pgfornamenthanDim}{}{}
\xpatchcmd{\pgf@ornamenthan}{\@pgfornamentDim}{\@pgfornamenthanDim}{}{}
\xpatchcmd{\pgf@ornamenthan}{\pgf@@ornament}{\pgf@@ornamenthan}{}{}
\def\pgfOrnamentsHanObject{pgflibraryhan.code.tex}
\input{\pgfOrnamentsHanObject}%
\let\pgf@@ornamenthan\pgf@@ornament
\pretocmd{\pgf@@ornamenthan}{%
\def\OrnamentsFamily{han}%
}{}{}
\patchcmd{\pgf@@ornamenthan}
{\OrnamentsFamily#1.pgf}
{\OrnamentsFamily/\OrnamentsFamily#1.pgf}{}{}
\tikzset{%
ornamenthan/.style={%
to path={%
\pgfextra{%
\tikz@scan@one@point\pgfutil@firstofone(\tikztostart)\relax
\pgf@xa=\pgf@x
\pgf@ya=\pgf@y
\tikz@scan@one@point\pgfutil@firstofone(\tikztotarget)\relax
\pgf@xb=\pgf@x
\pgf@yb=\pgf@y
\advance\pgf@xa by-\pgf@xb
\advance\pgf@ya by-\pgf@yb
\pgfmathveclen{\pgf@xa}{\pgf@ya}%
\global\let\ornamentlen\pgfmathresult}
-- node [pos=\ornamenttopos,options,
anchor=\ornamenttoanchor]{%
\pgfornamenthan[width = \ornamentlen,
symmetry=\ornamenttosymmetry]{#1}}
(\tikztotarget)\tikztonodes %end pgfextra
}% end to path
}% end style
}
\patchcmd{\pgf@@ornamenthan}
{\begingroup}
{\begingroup\def\ubb{\pgfusepath{use as bounding box}}}
{}{}
% \def\pgf@@ornamenthan#1{%
% \begingroup
% \def\i{\pgfusepath{clip}}%
% \def\k{\pgfusepath{stroke}}%
% \let\o\pgfpathclose
% \let\s\pgfusepathqfillstroke
% \def\p ##1##2{\pgfqpoint{##1bp}{##2bp}}%
% \def\m ##1 ##2 {\pgfpathmoveto{\p{##1}{##2}}}%
% \def\l ##1 ##2 {\pgfpathlineto{\p{##1}{##2}}}%
% \def\r ##1 ##2 ##3 ##4 {\pgfpathrectangle{\p{##1}{##2}}{\p{##3}{##4}}}%
% \def\c ##1 ##2 ##3 ##4 ##5 ##6 {%
% \pgfpathcurveto{\p{##1}{##2}}{\p{##3}{##4}}{\p{##5}{##6}}}%
% \@@input han#1.pgf
% %\@nameuse{pgf@@am@#1}%
% \endgroup}%
\endinput