zauguin / luapstricks

8 stars 0 forks source link

range check error, pst-func #32

Closed hvoss49 closed 3 years ago

hvoss49 commented 3 years ago

\psPrintValue in pst-func.

\documentclass[]{article}
\usepackage{pst-func}
\begin{document}
\psPrintValue[PSfont=Helvetica]{10 sin}%  valuewidth=10 
%\psPrintValue[PSfont=Helvetica,valuewidth=20]{10 sin}%. is ok
\end{document}

This is the important line: \psk@valuewidth string cvs In PS it doesn't really matter if the string definition is shorter than the saved string. What should we do? Leaving it as a "feature" is possible, then I'll change the documentation of pst-func that the user has to sure that the defined string length must be >= of the string.

ks.lua:1197: rangecheck
stack traceback:
    [C]: in function 'error'
    ...ive/texmf-local/tex/generic/pstricks-lua/luapstricks.lua:1197: in function 
<...ive/texmf-local/tex/generic/pstricks-lua/luapstricks.lua:1168>
    (...tail calls...)
    ...ive/texmf-local/tex/generic/pstricks-lua/luapstricks.lua:2820: in upvalue '
execute_ps'
zauguin commented 3 years ago

In PS it doesn't really matter if the string definition is shorter than the saved string.

I'm not quite sure what it is PS would accept here, if I e.g. run

(0123456789) 8 string cvs

I get /rangecheck for GhostScript too.

What should we do?

If we figure out exactly how this is supposed to work I would just tend to implement this behavior, after all enforcing string lengths is rather artificial in our implementation anyway. (Interaction with substrings might be odd though)

hvoss49 commented 3 years ago

Ah, I moved the error messages to /dev/null and didn't realised it. Then we should do nothing!

zauguin commented 3 years ago

Ah, I moved the error messages to /dev/null and didn't realised it. Then we should do nothing!

Maybe somewhat related to ignored error messages: pstricks.tex contains (in the \newpsfontdot commands for B+, B| and Basterisk) references to the font NimbusRomNo9L-Bold. On my system the bold version of NimbusRomNo9L is called NimbusRomNo9L-Medi, so the -Bold name leads to a warning

Substituting font Helvetica-Bold for NimbusRomNo9L-Bold.

Is this a bug in pstricks.tex, did the fontnames change at some point or is my system just weird?

hvoss49 commented 3 years ago

Yes, the names changed from time to time ... :-( I'll have look at it.

hvoss49 commented 3 years ago

In my case I have both -Medi and -Bold and all works. Using Times-Bold also works.

Times-Bold                           Type 1            Standard         no  no  no       7  0
FLQXWD+NimbusRomNo9L-Regu            Type 1C           WinAnsi          yes yes no       8  0
\documentclass[border=5mm]{standalone}
\usepackage{pstricks-add}
\begin{document}
\begin{pspicture}(1,1)
  \psdot[dotstyle=B+,dotsize=5pt](0.5,0.75)
  \psdot[dotstyle=+,dotsize=5pt](0.25,0.75)
  \psdot[dotstyle=asterisk,dotsize=5pt](0.5,0.25)
  \psdot[dotstyle=Basterisk,dotsize=5pt](0.5,0.5)
\end{pspicture}
\end{document}
hvoss49 commented 3 years ago

Running lualatex:

bash-3.2$ pdffonts psdot.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
RAUQQQ+LMRoman12-Bold                CID Type 0C       Identity-H       yes yes yes      8  0
SGWJRZ+LMRoman10-Italic              CID Type 0C       Identity-H       yes yes yes      9  0
YRMKJY+LMMono10-Regular              CID Type 0C       Identity-H       yes yes yes     10  0
PXZEUH+StandardSymL                  Type 1            Builtin          yes yes no      11  0
JAXWCD+TeXGyreTermes-Regular         CID Type 0C       Identity-H       yes yes yes     12  0
LFNVJX+TeXGyreTermes-Bold            CID Type 0C       Identity-H       yes yes yes     13  0
IMNBBA+TeXGyreHeros-Regular          CID Type 0C       Identity-H       yes yes yes     14  0
RAGCKX+TeXGyreHeros-Bold             CID Type 0C       Identity-H       yes yes yes     15  0

running latex->drips->ps2pdf with \usepackage[gsfonts]{pstricks}

bash-3.2$ pdffonts psdot.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
FLQXWD+NimbusRomNo9L-Regu            Type 1C           WinAnsi          yes yes no      19  0
AMODTX+NimbusRomNo9L-Bold            Type 1C           WinAnsi          yes yes no      21  0
PBPXFI+StandardSymL                  Type 1C           Custom           yes yes no      17  0
WLTGLZ+CMTT10                        Type 1C           WinAnsi          yes yes no      11  0
HENYDW+CMTI10                        Type 1C           WinAnsi          yes yes no       9  0
PAHCBS+CMBX12                        Type 1C           WinAnsi          yes yes no       7  0
WKFATO+NimbusSanL-Bold               Type 1C           WinAnsi          yes yes no      41  0
PIXPZJ+NimbusSanL-Regu               Type 1C           WinAnsi          yes yes no      39  0
[none]                               Type 3            Custom           yes no  no      14  0

running latex->drips->ps2pdf with \usepackage{pstricks}

bash-3.2$ pdffonts psdot.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
SPBXBL+Times-Bold                    Type 1C           WinAnsi          yes yes no      21  0
HKBSKS+Times-Roman                   Type 1C           WinAnsi          yes yes no      19  0
YORZGP+Symbol                        Type 1C           Custom           yes yes no      17  0
WLTGLZ+CMTT10                        Type 1C           WinAnsi          yes yes no      11  0
HENYDW+CMTI10                        Type 1C           WinAnsi          yes yes no       9  0
PAHCBS+CMBX12                        Type 1C           WinAnsi          yes yes no       7  0
NVMPFW+Helvetica-Bold                Type 1C           WinAnsi          yes yes no      41  0
BJDOOO+Helvetica                     Type 1C           WinAnsi          yes yes no      39  0
[none]                               Type 3            Custom           yes no  no      14  0
pablgonz commented 3 years ago

@hvoss49 This is related to #28 . If my search is correct, that package defines \psPrintValue

zauguin commented 3 years ago

running latex->drips->ps2pdf with \usepackage[gsfonts]{pstricks}

bash-3.2$ pdffonts psdot.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
FLQXWD+NimbusRomNo9L-Regu            Type 1C           WinAnsi          yes yes no      19  0
AMODTX+NimbusRomNo9L-Bold            Type 1C           WinAnsi          yes yes no      21  0
PBPXFI+StandardSymL                  Type 1C           Custom           yes yes no      17  0
WLTGLZ+CMTT10                        Type 1C           WinAnsi          yes yes no      11  0
HENYDW+CMTI10                        Type 1C           WinAnsi          yes yes no       9  0
PAHCBS+CMBX12                        Type 1C           WinAnsi          yes yes no       7  0
WKFATO+NimbusSanL-Bold               Type 1C           WinAnsi          yes yes no      41  0
PIXPZJ+NimbusSanL-Regu               Type 1C           WinAnsi          yes yes no      39  0
[none]                               Type 3            Custom           yes no  no      14  0

running latex->drips->ps2pdf with \usepackage{pstricks}

bash-3.2$ pdffonts psdot.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
SPBXBL+Times-Bold                    Type 1C           WinAnsi          yes yes no      21  0
HKBSKS+Times-Roman                   Type 1C           WinAnsi          yes yes no      19  0
YORZGP+Symbol                        Type 1C           Custom           yes yes no      17  0
WLTGLZ+CMTT10                        Type 1C           WinAnsi          yes yes no      11  0
HENYDW+CMTI10                        Type 1C           WinAnsi          yes yes no       9  0
PAHCBS+CMBX12                        Type 1C           WinAnsi          yes yes no       7  0
NVMPFW+Helvetica-Bold                Type 1C           WinAnsi          yes yes no      41  0
BJDOOO+Helvetica                     Type 1C           WinAnsi          yes yes no      39  0
[none]                               Type 3            Custom           yes no  no      14  0

I get similar output (since GhostScript sets the PDF fontname to the requested fontname and not to the name of the actually used font) but the actually used font for NimbusRomNo9L-Bold is still NimbusSans-Bold (especially it's a sans serif font) This of course doesn't really matter for this symbol since that's basically the same symbol anyway.

So basically my question is: If you compile with latex->dvips->ps2pdf the document

\documentclass{article}
\usepackage{pstricks}
\begin{document}
\begin{pspicture}(3,2)
  \psgrid[gridfont=NimbusRomNo9L-Regu]
\end{pspicture}

\begin{pspicture}(3,2)
  \psgrid[gridfont=NimbusRomNo9L-Medi]
\end{pspicture}

\begin{pspicture}(3,2)
  \psgrid[gridfont=NimbusRomNo9L-Bold]
\end{pspicture}
\end{document}

are the numbers on the third grid in a sans serif or a serif font? If it is a serif font, is it the same as the previous one?

Since for me it looks like

image and this doesn't look like a bold version of a serif font.

hvoss49 commented 3 years ago

that is a sans serif font. You do not have the NimbusRomNo9L-Bold installed, the reason why you get a sans serif font as a replacement. On my system it is the other way round: I have not the NimbusRomNo9L-Medi but the bold font. So my last grid looks like it should:

Bildschirmfoto 2021-08-31 um 20 58 43
hvoss49 commented 3 years ago

With the PostScript font names everything is fine:

\documentclass{article}
\usepackage{pstricks}
\begin{document}
\begin{pspicture}(3,2)
  \psgrid[gridfont=Times-Roman]
\end{pspicture}

\bigskip
\begin{pspicture}(3,2)
  \psgrid[gridfont=Helvetica-Bold]
\end{pspicture}

\bigskip
\begin{pspicture}(3,2)
  \psgrid[gridfont=Times-Bold]
\end{pspicture}
\end{document}
Bildschirmfoto 2021-08-31 um 21 00 48
pablgonz commented 3 years ago

Query (related), I came across this before (win10/fedora).... Where do I download the NimbusRomNo9L- fonts from?

I have downloaded the package from (https://github.com/ArtifexSoftware/urw-base35-fonts/releases) and they do not have the same names, and I get a little confused :(

Will the names that can be passed to PSfont be the same as gridfont using lualatex?