diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.text.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.text.code.tex | 188 |
1 files changed, 94 insertions, 94 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.text.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.text.code.tex index b75fcc6a562..50b9ebcba67 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.text.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.text.code.tex @@ -7,67 +7,67 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\usetikzlibrary{decorations} -\usepgflibrary{decorations.text} +\usetikzlibrary{decorations}% +\usepgflibrary{decorations.text}% % Code for the `text effects along path' decoration % Some text constants % To do: merge these with existing text constants -\def\tikz@lib@dec@te@space@text{space} -\def\tikz@lib@dec@align@left@text{left} -\def\tikz@lib@dec@align@right@text{right} -\def\tikz@lib@dec@align@center@text{center} -\def\tikz@lib@dec@te@none@text{none} +\def\tikz@lib@dec@te@space@text{space}% +\def\tikz@lib@dec@align@left@text{left}% +\def\tikz@lib@dec@align@right@text{right}% +\def\tikz@lib@dec@align@center@text{center}% +\def\tikz@lib@dec@te@none@text{none}% % Some ifs -\newif\iftikz@lib@dec@te@pathfromtext -\newif\iftikz@lib@dec@te@segmentfromwidth -\newif\iftikz@lib@dec@te@scaletexttopath -\newif\iftikz@lib@dec@te@fittexttopath -\newif\iftikz@lib@dec@te@wordsep -\newif\iftikz@lib@dec@te@finalletter +\newif\iftikz@lib@dec@te@pathfromtext% +\newif\iftikz@lib@dec@te@segmentfromwidth% +\newif\iftikz@lib@dec@te@scaletexttopath% +\newif\iftikz@lib@dec@te@fittexttopath% +\newif\iftikz@lib@dec@te@wordsep% +\newif\iftikz@lib@dec@te@finalletter% % Utility macros -% To do: integrate with exisiting pgf macros +% To do: integrate with existing pgf macros \def\tikz@lib@dec@te@addto@macro#1#2{% \expandafter\def\expandafter#1\expandafter{#1#2}% -} +}% \def\tikz@lib@dec@te@namelet#1#2{% \expandafter\expandafter\expandafter\let\expandafter\expandafter\csname\expandafter#1\expandafter\endcsname\expandafter=\csname#2\endcsname% -} +}% \def\tikz@lib@dec@te@advancecountmacro#1#2{% \pgfutil@tempcnta=#1\relax% \advance\pgfutil@tempcnta by#2\relax% \edef#1{\the\pgfutil@tempcnta}% -} +}% \def\tikz@lib@dec@te@advancedimenmacro#1#2{% \pgf@x=#1\relax% \advance\pgf@x by#2\relax% \edef#1{\the\pgf@x}% -} +}% % Macros for defining and updating text parameters \def\tikz@lib@dec@te@start@parameters#1{% \expandafter\let\csname tikz@lib@dec@te@character@#1\endcsname=\pgfutil@empty% -} +}% \def\tikz@lib@dec@te@addto@parameters#1#2{% \expandafter\tikz@lib@dec@te@addto@macro\expandafter% {\csname tikz@lib@dec@te@character@#1\endcsname}{#2}% -} +}% \def\tikz@lib@dec@te@addmacroto@parameters#1#2{% \def\tikz@lib@dec@te@marshal{\expandafter\tikz@lib@dec@te@addto@macro\expandafter% {\csname tikz@lib@dec@te@character@#1\endcsname}}% \expandafter\tikz@lib@dec@te@marshal\expandafter{\expandafter\def\expandafter#2\expandafter{#2}}% -} +}% -\def\tikz@lib@dec@te@getparameters#1{\csname tikz@lib@dec@te@character@#1\endcsname} +\def\tikz@lib@dec@te@getparameters#1{\csname tikz@lib@dec@te@character@#1\endcsname}% @@ -124,12 +124,12 @@ \fi}, word separator=space, character command/.code={% - \def\tikz@lib@dec@te@tmp{#1}% - \ifx\tikz@lib@dec@te@tmp\pgfutil@empty% - \def\tikz@lib@dec@te@charactercommand{\tikz@lib@dec@te@charactertypesetonly}% - \else% - \def\tikz@lib@dec@te@charactercommand{#1}% - \fi% + \def\tikz@lib@dec@te@tmp{#1}% + \ifx\tikz@lib@dec@te@tmp\pgfutil@empty% + \def\tikz@lib@dec@te@charactercommand{\tikz@lib@dec@te@charactertypesetonly}% + \else% + \def\tikz@lib@dec@te@charactercommand{#1}% + \fi% }, character command=, every character width/.style={/pgf/decoration/text effects/every character/.try}, @@ -146,14 +146,14 @@ repeat text/.store in=\tikz@lib@dec@te@repeattext, repeat text/.default=-1, repeat text=0, -} +}% -\def\tikz@lib@dec@te@charactertypesetonly#1{#1} +\def\tikz@lib@dec@te@charactertypesetonly#1{#1}% \tikzset{% text effects/.code={\pgfkeysalso{/pgf/decoration/text effects/.cd,#1}}, -} +}% @@ -163,7 +163,7 @@ % Prepare the decoration text % % This sets up all the character/letter/word, counts/totals -% and caluclates the default width of the characters/text +% and calculates the default width of the characters/text % (which may be modified later). % \def\tikz@lib@dec@te@preparetext{% @@ -201,13 +201,13 @@ \tikz@lib@dec@te@addto@parameters{\tikz@lib@dec@te@lastcharactercount}{\tikz@lib@dec@te@finallettertrue}% \fi \def\tikz@lib@dec@te@lettercount{0}% - \tikz@lib@dec@te@addto@parameters{\tikz@lib@dec@te@charactercount}{\tikz@lib@dec@te@wordseptrue}% + \tikz@lib@dec@te@addto@parameters{\tikz@lib@dec@te@charactercount}{\tikz@lib@dec@te@wordseptrue}% \else \ifnum\tikz@lib@dec@te@lettercount=0\relax% \tikz@lib@dec@te@advancecountmacro\tikz@lib@dec@te@wordcount{1}% \fi% \tikz@lib@dec@te@addto@parameters{\tikz@lib@dec@te@charactercount}{\tikz@lib@dec@te@finalletterfalse}% - \tikz@lib@dec@te@advancecountmacro{\tikz@lib@dec@te@lettercount}{1}% + \tikz@lib@dec@te@advancecountmacro{\tikz@lib@dec@te@lettercount}{1}% \tikz@lib@dec@te@addto@parameters{\tikz@lib@dec@te@charactercount}{\tikz@lib@dec@te@wordsepfalse}% \expandafter\let\csname tikz@lib@dec@te@word \tikz@lib@dec@te@wordcount @lettercount\endcsname=\tikz@lib@dec@te@lettercount% \fi% @@ -241,10 +241,10 @@ \expandafter\edef\csname tikz@lib@dec@te@character@\pgfmathcounter @postwidth\endcsname{\the\pgf@x}% \tikz@lib@dec@te@advancedimenmacro{\tikz@lib@dec@te@textwidth}{\tikz@lib@dec@te@characterwidth}% \repeatpgfmathloop% -} +}% % Does the category code of the space matter? -\def\tikz@lib@dec@te@spacetoken{ } +\def\tikz@lib@dec@te@spacetoken{ }% \let\tikz@lib@dec@te@wordsep=\tikz@lib@dec@te@spacetoken @@ -254,7 +254,7 @@ % Create macros \tikz@lib@dec@te@character@<n>@token containing % the nth character. % -% Total number of characters is store in +% Total number of characters is store in % \tikz@lib@dec@te@chractertotal@count % \def\tikz@lib@dec@te@scancharacters#1{% @@ -263,7 +263,7 @@ \expandafter\tikz@lib@dec@te@@scancharacters\tikz@lib@dec@te@text\tikz@lib@dec@te@scancharacters}% \def\tikz@lib@dec@te@@scancharacters{% - \futurelet\tikz@lib@dec@te@token\tikz@lib@dec@te@@@scancharacters} + \futurelet\tikz@lib@dec@te@token\tikz@lib@dec@te@@@scancharacters}% \def\tikz@lib@dec@te@@@scancharacters{% \ifx\tikz@lib@dec@te@token\tikz@lib@dec@te@scancharacters% @@ -281,31 +281,31 @@ \fi% \fi% \tikz@lib@dec@te@next% -} +}% \def\tikz@lib@dec@te@@@scancharacters@space{% \let\tikz@lib@dec@te@character=\tikz@lib@dec@te@spacetoken% \tikz@lib@dec@te@@@scancharacters@process% \pgfutil@ifnextchar x\tikz@lib@dec@te@@scancharacters\tikz@lib@dec@te@@scancharacters% -} +}% \def\tikz@lib@dec@te@@@scancharacters@bgroup#1{% \def\tikz@lib@dec@te@character{{#1}}% \tikz@lib@dec@te@@@scancharacters@process% \tikz@lib@dec@te@@scancharacters% -} +}% \def\tikz@lib@dec@te@@@scancharacters@normal#1{% \def\tikz@lib@dec@te@character{#1}% \tikz@lib@dec@te@@@scancharacters@process% \tikz@lib@dec@te@@scancharacters% -} +}% -\def\tikz@lib@dec@te@@@@scancharacters#1\tikz@lib@dec@te@scancharacters{} +\def\tikz@lib@dec@te@@@@scancharacters#1\tikz@lib@dec@te@scancharacters{}% -% Reverse the order of the scanned chracters in the text +% Reverse the order of the scanned characters in the text % (Actually reverse the ordering of the macros containing the characters) \def\tikz@lib@dec@te@reversetext{% \c@pgf@counta=\tikz@lib@dec@te@charactertotalcount% @@ -317,7 +317,7 @@ \tikz@lib@dec@te@namelet{tikz@lib@dec@te@character@\the\c@pgf@counta @token}{tikz@lib@dec@te@tmp}% \advance\c@pgf@counta by-1\relax% \repeatpgfmathloop% -} +}% % Group letters (i.e., anything that isn't the word separator) % as single characters (words). @@ -345,7 +345,7 @@ \fi% \repeatpgfmathloop% \edef\tikz@lib@dec@te@charactertotalcount{\the\c@pgf@counta}% -} +}% % Get width of node containing only the current character. @@ -362,7 +362,7 @@ \tikz@lib@dec@te@getcharacter@replacementwidth{\tikz@lib@dec@te@character}% \let\tikz@lib@dec@te@characterwidth=\tikz@lib@dec@te@character@replacementwidth% }% -} +}% % Update the character parameters with the widths. \def\tikz@lib@dec@te@addwidthstoparameters{% @@ -376,13 +376,13 @@ \tikz@lib@dec@te@addmacroto@parameters{\pgfmathcounter}{\tikz@lib@dec@te@characterprewidth}% \tikz@lib@dec@te@addmacroto@parameters{\pgfmathcounter}{\tikz@lib@dec@te@characterpostwidth}% \repeatpgfmathloop% -} +}% % Get the options to applied to a character node. \def\tikz@lib@dec@te@addoptions#1{% \expandafter\def\expandafter\tikz@lib@dec@te@options\expandafter{\tikz@lib@dec@te@options,#1}% -} +}% \def\tikz@lib@dec@te@getoptions#1{% \let\tikz@lib@dec@te@lastcharactercommand=\tikz@lib@dec@te@charactercommand% @@ -433,23 +433,23 @@ \ifx\tikz@lib@dec@te@character\tikz@lib@dec@te@wordsep% \tikz@lib@dec@te@addoptions{/pgf/decoration/text effects/every word separator/.try}% \else% - \ifnum\tikz@lib@dec@te@wordcount>0\relax% - \edef\tikz@lib@dec@te@tmp{every word/.try, word \tikz@lib@dec@te@wordcount/.try}% - \expandafter\tikz@lib@dec@te@addoptions\expandafter{\tikz@lib@dec@te@tmp}% - \ifnum\tikz@lib@dec@te@lettercount>0\relax% - \edef\tikz@lib@dec@te@tmp{every letter/.try,every \tikz@lib@dec@te@lettercount\space letter/.try}% - \expandafter\tikz@lib@dec@te@addoptions\expandafter{\tikz@lib@dec@te@tmp}% - \ifnum\tikz@lib@dec@te@lettercount=1\relax% - \edef\tikz@lib@dec@te@tmp{every first letter/.try}% - \expandafter\tikz@lib@dec@te@addoptions\expandafter{\tikz@lib@dec@te@tmp}% - \fi% - \iftikz@lib@dec@te@finalletter% - \tikz@lib@dec@te@addoptions{every final letter/.try}% - \fi% - \fi% - \fi% + \ifnum\tikz@lib@dec@te@wordcount>0\relax% + \edef\tikz@lib@dec@te@tmp{every word/.try, word \tikz@lib@dec@te@wordcount/.try}% + \expandafter\tikz@lib@dec@te@addoptions\expandafter{\tikz@lib@dec@te@tmp}% + \ifnum\tikz@lib@dec@te@lettercount>0\relax% + \edef\tikz@lib@dec@te@tmp{every letter/.try,every \tikz@lib@dec@te@lettercount\space letter/.try}% + \expandafter\tikz@lib@dec@te@addoptions\expandafter{\tikz@lib@dec@te@tmp}% + \ifnum\tikz@lib@dec@te@lettercount=1\relax% + \edef\tikz@lib@dec@te@tmp{every first letter/.try}% + \expandafter\tikz@lib@dec@te@addoptions\expandafter{\tikz@lib@dec@te@tmp}% + \fi% + \iftikz@lib@dec@te@finalletter% + \tikz@lib@dec@te@addoptions{every final letter/.try}% + \fi% + \fi% + \fi% \fi% -} +}% % Called by `late positioning' of the node % to get the width of the bounding box @@ -463,7 +463,7 @@ \advance\pgf@x by-\pgfpositionnodelaterminy\relax% \fi% \xdef\tikz@lib@dec@te@characterwidth@tmp{\the\pgf@x}% -} +}% \def\tikz@lib@dec@te@drawcharacter{% @@ -473,7 +473,7 @@ \pgfutil@ifundefined{tikz@lib@dec@te@character@replacements@\meaning\tikz@lib@dec@te@character @code}{% \expandafter\node\expandafter[\tikz@lib@dec@te@options, scale=\tikz@lib@dec@scaledcharacterwidthfactor]{\hbox{\tikz@lib@dec@te@charactercommand{\tikz@lib@dec@te@character}}};% }{\tikz@lib@dec@te@drawcharacter@replacement{\tikz@lib@dec@te@character}}% -} +}% % Replace the character #1 with a character@replacement % @@ -482,7 +482,7 @@ \expandafter\tikzset\expandafter{\tikz@lib@dec@te@options}% \csname tikz@lib@dec@te@character@replacements@\meaning#1@code\endcsname% \endpgfscope% -} +}% % Get the width of the character@replacement associated with % the character #1 @@ -497,7 +497,7 @@ \endpgfpicture}% \xdef\tikz@lib@dec@te@character@replacementwidth{\the\wd\tikz@lib@dec@te@box}% \endpgfinterruptpicture% -} +}% \def\tikz@lib@dec@scaledcharacterwidthfactor{1}% @@ -508,26 +508,26 @@ % The width of the text and characters has already been calculated. \else% \let\tikz@lib@dec@te@text=\pgfdecorationtext% - % Get the chracter tokens and the total number of characters. + % Get the character tokens and the total number of characters. \tikz@lib@dec@te@preparetext% \iftikz@lib@dec@te@scaletexttopath% % OK, *scaling* text to path is easy. % Simply divide the path length by the text width to - % obtain the scaling factor which will be applied + % obtain the scaling factor which will be applied % "at the last minute"... \pgfmathdivide{\pgfdecoratedpathlength}{\tikz@lib@dec@te@textwidth}% \let\tikz@lib@dec@scaledcharacterwidthfactor=\pgfmathresult% \expandafter\pgfkeys\expandafter{\tikz@lib@dec@te@tmp}% - % ... and recalulate the (pre and post) widths. + % ... and recalculate the (pre and post) widths. \pgfmathloop \ifnum\pgfmathcounter>\tikz@lib@dec@te@charactertotalcount% \else% \pgf@x=\csname tikz@lib@dec@te@character@\pgfmathcounter @prewidth\endcsname\relax% - \pgf@x=\tikz@lib@dec@scaledcharacterwidthfactor\pgf@x% + \pgf@x=\tikz@lib@dec@scaledcharacterwidthfactor\pgf@x% \expandafter\edef\csname tikz@lib@dec@te@character@\pgfmathcounter @prewidth\endcsname{\the\pgf@x}% % \pgf@x=\csname tikz@lib@dec@te@character@\pgfmathcounter @postwidth\endcsname\relax% - \pgf@x=\tikz@lib@dec@scaledcharacterwidthfactor\pgf@x% + \pgf@x=\tikz@lib@dec@scaledcharacterwidthfactor\pgf@x% \expandafter\edef\csname tikz@lib@dec@te@character@\pgfmathcounter @postwidth\endcsname{\the\pgf@x}% \repeatpgfmathloop% % Update parameters with thewidths. @@ -536,7 +536,7 @@ \else% \iftikz@lib@dec@te@fittexttopath% % *Fitting* text is less easy. - % The pre and post width of all except the first and last characters + % The pre and post width of all except the first and last characters % must be recalculated. % Only the post width of the first character and the pre width % of the final character are scaled as these characters should be @@ -554,18 +554,18 @@ \advance\pgf@y by-\pgf@xb% % \pgfmathdivide{\the\pgf@x}{\the\pgf@y}% - \let\tikz@lib@dec@characterwidthscale=\pgfmathresult% + \let\tikz@lib@dec@characterwidthscale=\pgfmathresult% \pgfmathloop \ifnum\pgfmathcounter>\tikz@lib@dec@te@charactertotalcount\relax% \else% \ifnum\pgfmathcounter>1\relax% \pgf@x=\csname tikz@lib@dec@te@character@\pgfmathcounter @prewidth\endcsname\relax% - \pgf@x=\tikz@lib@dec@characterwidthscale\pgf@x% + \pgf@x=\tikz@lib@dec@characterwidthscale\pgf@x% \expandafter\edef\csname tikz@lib@dec@te@character@\pgfmathcounter @prewidth\endcsname{\the\pgf@x}% \fi% \ifnum\pgfmathcounter<\tikz@lib@dec@te@charactertotalcount\relax% \pgf@x=\csname tikz@lib@dec@te@character@\pgfmathcounter @postwidth\endcsname\relax% - \pgf@x=\tikz@lib@dec@characterwidthscale\pgf@x% + \pgf@x=\tikz@lib@dec@characterwidthscale\pgf@x% \expandafter\edef\csname tikz@lib@dec@te@character@\pgfmathcounter @postwidth\endcsname{\the\pgf@x}% \fi% \repeatpgfmathloop% @@ -607,17 +607,17 @@ \fi% \fi% \fi% -} +}% % Evil hack into the decoration code. % % If the path contains single move to and the `path from text' -% key is set to true. The width of the text is calcuated here +% key is set to true. The width of the text is calculated here % and the (straight line) path automatically calculated. % \def\pgf@decorate@path@check@moveto#1{% - \expandafter\pgf@decorate@path@@check@moveto#1\pgf@decorate@stop\pgf@decorate@@stop} + \expandafter\pgf@decorate@path@@check@moveto#1\pgf@decorate@stop\pgf@decorate@@stop}% \def\pgf@decorate@token@stop{\pgf@decorate@stop}% \def\pgf@decorate@path@@check@moveto#1#2#3#4\pgf@decorate@@stop#5#6{% @@ -644,19 +644,19 @@ \tikz@lib@dec@te@pathfromtextfalse% #6% \fi% -} +}% -\pgfdeclaredecoration{text effects along path}{setup}{ +\pgfdeclaredecoration{text effects along path}{setup}{% \state{setup}[width=+0pt, next state=scan, persistent precomputation={% \tikz@lib@dec@te@state@setup@precomputation% - \def\tikz@lib@dec@te@charactercount{0}% - }]{} + \def\tikz@lib@dec@te@charactercount{0}% + }]{}% % \state{scan}[width=+0pt, next state=pre token, persistent precomputation={% \tikz@lib@dec@te@advancecountmacro\tikz@lib@dec@te@charactercount{1}% % Usual switch to final state is based on distance. - % Here we also need it to be on the number of the + % Here we also need it to be on the number of the % current character. \ifnum\tikz@lib@dec@te@charactercount>\tikz@lib@dec@te@charactertotalcount\relax% \ifnum\tikz@lib@dec@te@repeattext=0\relax% @@ -668,15 +668,15 @@ \fi% % Install parameters for this character. \csname tikz@lib@dec@te@character@\tikz@lib@dec@te@charactercount\endcsname% -}]{} +}]{}% % -\state{pre token}[width=+\tikz@lib@dec@te@characterprewidth, next state=token]{} +\state{pre token}[width=+\tikz@lib@dec@te@characterprewidth, next state=token]{}% \state{token}[width=+0pt, next state=post token] {% \tikz@lib@dec@te@drawcharacter% -} -\state{post token}[width=+\tikz@lib@dec@te@characterpostwidth, next state=scan]{} -} +}% +\state{post token}[width=+\tikz@lib@dec@te@characterpostwidth, next state=scan]{}% +}% % Parse styles for individual characters @@ -688,9 +688,9 @@ \tikz@lib@dec@te@scancharacters{% \pgfkeysalso{/pgf/decoration/text effects/character {\meaning\tikz@lib@dec@te@character}/.style={#2}}% }% -} +}% -% Parse replacment code for for individual characters +% Parse replacement code for for individual characters % #1 a string of characters (e.g., aieou{\"U}{\"a"}) % #2 the code to execute to each character. % @@ -699,6 +699,6 @@ \tikz@lib@dec@te@scancharacters{% \expandafter\def\csname tikz@lib@dec@te@character@replacements@\meaning\tikz@lib@dec@te@character @code\endcsname{#2}% }% -} +}% \endinput |