zauguin / luapstricks

8 stars 0 forks source link

Support for `linestyle=symbol` and `symbolFont` #12

Closed pablgonz closed 3 years ago

pablgonz commented 3 years ago

Hi, along the lines of using fonts, I have tried to compile this:

% arara: latex
% arara: dvips
% arara: ps2pdf: { options : [ -dALLOWPSTRANSPARENCY ] }
% arara: clean: { extensions : [ aux, log, dvi, ps ] }
\RequirePackage{pdfmanagement-testphase}
\DeclareDocumentMetadata{}
\documentclass{article}
\usepackage{pstricks}
\usepackage{pstricks-add}
\pagestyle{empty}
\setlength{\parindent}{0pt}
\addtolength{\hoffset}{-1.5cm}
% short
\newcommand{\BSS}[1]{\textbf{\textbackslash{#1}}}
\newcommand{\AC}[1]{\{#1\}}
\newcommand{\BS}[1]{$\backslash$#1}
\begin{document}

\section*{Drawing with symbols}

\psset{fillstyle=none,linewidth=1pt,linecolor=blue}

\psset{unit=.75cm}
\begin{tabular}{|c|c|c|c|}\hline
\multicolumn{4}{|c|}{\BS{}psline[{\color{red} linestyle=}\textcolor{red}{symbol}](-2,0)(2,0)} \\
\hline
\begin{pspicture}(-2.5,-.5)(2.5,2.5)
  \psline[linestyle=dotted,linecolor=red](-2,0)(1,0)(2,2)
  \psline[linestyle=symbol](-2,0)(1,0)(2,2)
\end{pspicture}
&
\begin{pspicture}(-2.5,-.5)(2.5,2.5)
  \psline[linestyle=dotted,linecolor=red](-2,0)(1,0)(2,2)
  \psline[linestyle=symbol,symbolStep=.5](-2,0)(1,0)(2,2)
\end{pspicture}
&
\begin{pspicture}(-2.5,-.5)(2.5,2.5)
  \psline[linestyle=dotted,linecolor=red](-2,0)(1,0)(2,2)
  \psline[linestyle=symbol,symbolWidth=.5cm](-2,0)(1,0)(2,2)
\end{pspicture}
&
\begin{pspicture}(-2.5,-.5)(2.5,2.5)
  \psline[linestyle=dotted,linecolor=red](-2,0)(1,0)(2,2)
  \psline[linestyle=symbol,rotateSymbol=true](-2,0)(1,0)(2,2)
\end{pspicture} \\
\hline
By default: & \textcolor{red}{symbolStep}=.5 & \textcolor{red}{symbolWidth}=.5cm &  \textcolor{red}{rotateSymbol}=true \\
& {\color{blue} By default: 20pt} & {\color{blue} By default: 10pt } & {\color{blue} By default: false}\\
\hline
\end{tabular}
\bigskip

\begin{tabular}{|c|c|c|c|}\hline

\multicolumn{4}{|c|}{ \BS{pscurve[linestyle=symbol,\textcolor{red}{symbolFont}{\color{red} =PSTricksDotFont}](-2,1)(0,-1)(2,1.5)} }\\
\hline
\begin{pspicture}(-2.5,-2)(2.5,2)
  \pscurve[linestyle=dotted,linecolor=red](-2,1)(0,-1)(2,1.5)
  \pscurve[linestyle=symbol,symbolFont=PSTricksDotFont](-2,1)(0,-1)(2,1.5)
\end{pspicture}
&
\begin{pspicture}(-2.5,-2)(2.5,2)
  \pscurve[linestyle=dotted,linecolor=red](-2,1)(0,-1)(2,1.5)
  \pscurve[linestyle=symbol,symbolFont=PSTricksDotFont,symbolWidth=1](-2,1)(0,-1)(2,1.5)
\end{pspicture}
&
\begin{pspicture}(-2.5,-2)(2.5,2)
  \pscurve[linestyle=dotted,linecolor=red](-2,1)(0,-1)(2,1.5)
  \pscurve[linestyle=symbol,symbolFont=PSTricksDotFont,rotateSymbol=true](-2,1)(0,-1)(2,1.5)
\end{pspicture}
&
\begin{pspicture}(-2.5,-2)(2.5,2)
  \pscurve[linestyle=dotted,linecolor=red](-2,1)(0,-1)(2,1.5)
  \pscurve[linestyle=symbol,symbolFont=PSTricksDotFont,rotateSymbol=true,startAngle=45](-2,1)(0,-1)(2,1.5)
\end{pspicture} \\
\hline
{\color{blue} By default:} & \color{red}{symbolWidth} =1cm & \color{red}{rotateSymbol} =true &  rotateSymbol=true \\
&
{\color{blue} By default: 10pt} & {\color{blue} By default: false }&  \textcolor{red}{startAngle=45} \\
\hline
\end{tabular}

\bigskip

\begin{tabular}{|c|c|c|c|}\hline
\multicolumn{2}{|c|}{ symbolFont=Dingbats (By default) } &
\multicolumn{2}{|c|}{ symbolFont=PSTricksDotFont } \\
\hline
\begin{pspicture}(-2.5,-.5)(2.5,2.5)
  \psline[linestyle=dotted,linecolor=red](-2,0)(1,0)(2,2)
  \psline[linestyle=symbol,symbol=u,symbolFont=Dingbats](-2,0)(1,0)(2,2)
\end{pspicture}
&
\begin{pspicture}(-2.5,-.5)(2.5,2.5)
  \psline[linestyle=dotted,linecolor=red](-2,0)(1,0)(2,2)
  \psline[linestyle=symbol,symbol=120,symbolFont=Dingbats](-2,0)(1,0)(2,2)
\end{pspicture}
&
\begin{pspicture}(-2.5,-.5)(2.5,2.5)
  \psline[linestyle=dotted,linecolor=red](-2,0)(1,0)(2,2)
  \psline[linestyle=symbol,symbol=u,symbolFont=PSTricksDotFont](-2,0)(1,0)(2,2)
\end{pspicture}
&
\begin{pspicture}(-2.5,-.5)(2.5,2.5)
  \psline[linestyle=dotted,linecolor=red](-2,0)(1,0)(2,2)
  \psline[linestyle=symbol,symbol=120,symbolFont=PSTricksDotFont](-2,0)(1,0)(2,2)
\end{pspicture} \\
\hline
\textcolor{red}{symbol}=u & symbol=120 & symbol=u & symbol=120 \\
\hline
\end{tabular}

\end{document}

I get:

[1{/usr/local/texlive/2021/texmf-var/fonts/map/pdftex/updmap/pdftex.map}./luaps
tricks.lua:752: ./luapstricks.lua:460: Unknown name "setflat"
stack traceback:
    [C]: in function 'error'
    ./luapstricks.lua:752: in function <./luapstricks.lua:743>
    (...tail calls...)
    ./luapstricks.lua:2545: in function <./luapstricks.lua:2543>
    (...tail calls...)
    ./luapstricks.lua:2545: in upvalue 'execute_ps'
    ./luapstricks.lua:2606: in function <./luapstricks.lua:2603>
    [C]: in function 'vf.node'
    ./luapstricks.lua:2596: in function <./luapstricks.lua:2587>.
<inserted text> BAD

l.114 \end{document}

? 

Captura de pantalla -2021-08-28 09-41-04

zauguin commented 3 years ago

Should be fixed with the latest version.

hvoss49 commented 3 years ago

Should be fixed with the latest version.

Did you a commit? Because I get still the error ...

pablgonz commented 3 years ago

@zauguin It works, but the output is different than expected.

Captura de pantalla -lua

zauguin commented 3 years ago

Should be fixed with the latest version.

Did you a commit? Because I get still the error ...

Works for me... Did you install the new file after updating?

zauguin commented 3 years ago

@pablgonz Please try again with the current version.

hvoss49 commented 3 years ago

ok, my fault. I tried in the morning the build file which installs a local copy. Now it's also ok.

pablgonz commented 3 years ago

@zauguin Works OK now :)