zauguin / luapstricks

8 stars 0 forks source link

Question about StandardSymbolsPS font mapping #13

Closed pablgonz closed 3 years ago

pablgonz commented 3 years ago

I have a small doubt regarding the mapping of the StandardSymbolsPS.otf.

I have installed the font from (https://github.com/ArtifexSoftware/urw-base35-fonts/blob/master/fonts/StandardSymbolsPS.otf)

$  luaotfload-tool --find="StandardSymbolsPS" --inspect
luaotfload | resolve : Font "StandardSymbolsPS" found!
luaotfload | resolve : Resolved file name "/usr/share/fonts/StandardSymbolsPS.otf"

** 1 Standard Symbols PS *******************************************************

            ascender: 778
        averagewidth: 500
         boundingbox: <table>
                       1: -180
                       2: -293
                       3: 1090
                       4: 1010
           capheight: 673
      defaultvheight: 0
           descender: -222
              family: Standard Symbols PS
            fontname: StandardSymbolsPS
            fullname: Standard Symbols PS
         italicangle: 0.0
          monospaced: false
        panoseweight: normal
         panosewidth: normal
           pfmweight: 400
            pfmwidth: 5
       platformnames: <table>
                 windows: <table>
                      family: Standard Symbols PS
                    fullname: Standard Symbols PS
              postscriptname: StandardSymbolsPS
                   subfamily: Regular
           subfamily: Regular
        subfontindex: -1
               units: 1000
             version: Version 2.00
              weight: regular
               width: normal
             xheight: 500

== 1.1 General Information =====================================================

           font name: Standard Symbols PS
        font version: Version 2.00
               width: normal
       average width: 500
        panose width: normal
    weight indicator: regular
    numerical weight: 400
       panose weight: normal
         design size: <none>
     design size min: <none>
     design size max: <none>
        units per em: 1000
     ascender height: 778
    descender height: -222
      capital height: 673

== 1.2 Features ================================================================
font defines neither gsub nor gpos features

But when executing this test:

\documentclass[10pt]{article}
\usepackage{pstricks}
\pagestyle{empty}
\begin{document}
% dots from StandardSymbolsPS.otf
\begin{pspicture}[showgrid](3,3)
  \psdots[linecolor=blue,dotstyle=x](1,1)
  \psdots[dotstyle=oplus](0.5,0.5)
  \psdots[dotstyle=otimes](1.5,1.5)
  \psdots[linecolor=red](2,2)
\end{pspicture}
\end{document}

I always get a Type 1:

name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
SVXRAH+TeXGyreHeros-Regular          CID Type 0C       Identity-H       yes yes yes      4  0
PXZEUH+StandardSymL                  Type 1            Builtin          yes yes no       5  0

I have asked Paulo to do the test on his system (also fedora 34) and the result is the same and I have tried to do the test on win10 and the same thing happens.

Any idea?

hvoss49 commented 3 years ago

That is hardcoded in luapstricks.lua: usyr is the StandardSymL font. Changing it to

  ['StandardSymbolsPS'] = 'kpse:StandardSymbolsPS.otf',
--  ['StandardSymbolsPS'] = 'usyr',
  ['Dingbats'] = 'uzdr',

loads the otf font. But this works only if the font is present.

------------------------------------ ----------------- ---------------- --- --- --- ---------
SVXRAH+TeXGyreHeros-Regular          CID Type 0C       Identity-H       yes yes yes      4  0
VZYYAP+StandardSymbolsPS             CID Type 0C       Identity-H       yes yes yes      5  0
pablgonz commented 3 years ago

Oh, I get it, you can have something like this: "If .otf found useelse use type1?"

@hvoss49 Any reason why latex>dvips>ps2pdf points to Symbol (which is not embedded) instead of StandardSymL (type1) which is embedded by default?

zauguin commented 3 years ago

That is hardcoded in luapstricks.lua: usyr is the StandardSymL font. Changing it to

  ['StandardSymbolsPS'] = 'kpse:StandardSymbolsPS.otf',
--  ['StandardSymbolsPS'] = 'usyr',
  ['Dingbats'] = 'uzdr',

loads the otf font.

It should be enough to just remove the StandardSymbolPS line altogether, then the font should be looked up and found by font name. It still requires the OTF font to be present though.

you can have something like this: "If .otf found useelse use type1?"

It's possible, but it's relatively slow (Looking for a font which is installed is fast since it can be cached, looking for a font which is not installed is much slower since it requires searching in all relevant places for the font.) and it makes problems much harder to analyze and harder to make reproducible: If a font is silently replaced by a slightly different one some systems than documents which rely on specific aspects of the font might not work on other systems without useful errors (since the font is still "found", it's just a completely different one) (It's not even safe to install additional fonts since these might break documents which expect the fallback etc.).

pablgonz commented 3 years ago

I see, this is more complicated than I thought in my mind. The issue is that if you remove the replacement line it will point to Symbol (which is in all systems) instead of pointing to StandardSymL (type1) which would be more suitable (from my point of view).

hvoss49 commented 3 years ago

Oh, I get it, you can have something like this: "If .otf found useelse use type1?"

@hvoss49 Any reason why latex>dvips>ps2pdf points to Symbol (which is not embedded) instead of StandardSymL (type1) which is embedded by default?

Symbol is a standard PS font and on all PS printer available, no reason to embed the font. If you still want it embedded, then use

ps2pdf -dPDFSETTINGS=/prepress  ... 

Some GhostScript installations do not provide the GhostScript fonts, then Symbol is always used.

hvoss49 commented 3 years ago

I see, this is more complicated than I thought in my mind. The issue is that if you remove the replacement line it will point to Symbol (which is in all systems) instead of pointing to StandardSymL (type1) which would be more suitable (from my point of view).

That doesn't matter if Symbol, the PS font, or StandaedSymL, the URW equivalent font, is used!

pablgonz commented 3 years ago

@hvoss49 You're right, but I don't really like having a non-embedded font :(

hvoss49 commented 3 years ago

Read my other comment with the -dPDFSETTINGS=/prepress ...

pablgonz commented 3 years ago

Oh...I had completely forgotten...yet another line to add :D

pablgonz commented 3 years ago

@hvoss49 @zauguin To close this point, what is the position?

Leave it as it is (which works nice) or force the user to install the .otf font (which is not installed by default in win10 by gs and fedora for example).

hvoss49 commented 3 years ago

Leave it as it is ...