4

This question builds upon my attempt to include custom, vectorial, LaTeX symbols inside Python plots via tikz, which (so far) is failing due to the impossibility (my inability ?) to attach proper font metric elements to the symbols.

Hence, I am now attempting to use FontForge to create an actual font for my custom symbols, which I then want/need to properly package in the hope to facilitate their installation via CTAN.

But I cannot seem to properly "bundle" the FontForge products into a LaTeX package. I have tried to follow the FontForge documentation, as well as these step-by-step explanations. There are many other FontForge-LateX related posts and questions out there, but I could find none clarifying a full (and clean) procedure to go from font creation to a fully-fledged package assembly.

What I have done so far:

  1. Creation of .pfb, .asm, .otf, .enc, and .tfm files from FontForge, with encoding set to TeX, and one test symbol (a simple circle) as the 0 glyph.

  2. Compiling the following test document, which does display my symbol just fine:

    \documentclass{article}
    
    \pdfmapline{=mysymb mysymb <mysymb.pfb}
    
    \begin{document}
    \font\test=mysymb \test 0
    \end{document}
    
  3. Creation of umysymb.fd with the following content:

    \ProvidesFile{umysymb.fd}
    \DeclareFontFamily{U}{mysymb}{}
    \DeclareFontShape{U}{mysymb}{m}{n}{<-> mysymb}{}
    

    Edit 24.08.2021: mind the u at the start of the .fd file name! See @Marcel Krüger's comment. This solves the following error message (otherwise issued when compiling the test document below):

    LaTeX Font Warning: Font shape `U/mysymb/m/n' undefined
    
  4. Creation of mysymb.sty with the following content:

    \newcommand{\mysymbol}{{\usefont{U}{mysymb}{m}{n} 0}}
    
  5. Creation of mysymb.map with the following content:

    mysymb mysymb <mysymb.pfb
    
  6. Update of the system map info via the command:

    sudo updmap-sys --enable Map=mysymb.map
    

    This solves the following error message (otherwise issued when trying to compile the test document shown at the next point):

    kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 1+0/600 --dpi 600 mysymb
    mktexpk: don't know how to create bitmap font for mysymb.
    mktexpk: perhaps mysymb is missing from the map file.
    
  7. At this point, the following test document compiles without issue, and does display my symbol:

    \documentclass{article}
    \usepackage{mysymb}
    
    \begin{document}
    Hello World. Here's a new symbol: \mysymbol
    \end{document}
    
  8. Placement of the following files with my TeX-tree in the appropriate location. In my case, my tex_loc is /usr/local/texlive/2020/texmf-dist/, but this is clearly user/OS dependent:

    cp metsymb.tfm tex_loc/fonts/tfm/public/metsymb/
    cp metsymb.afm tex_loc/fonts/afm/public/metsymb/
    cp metsymb.pfb tex_loc/fonts/type1/public/metsymb/
    cp metsymb.otf tex_loc/fonts/opentype/public/metsymb/
    cp umetsymb.fd tex_loc/tex/latex/metsymb/
    cp metsymb.sty tex_loc/tex/latex/metsymb/
    cp metsymb.map tex_loc/fonts/map/dvips/metsymb/
    cp metsymb.enc tex_loc/fonts/enc/dvips/metsymb/
    
  9. At this point, the package and associated test symbol can be seen by my Python scripts.

Open question: How do I then properly package all of these files to allow for a solid CTAN install ?

As of 24.08.2021, I have created the necessary .ins, .dtx and can successfully generate the .sty file from these.

The last remaining step is to figure out whether all of it can be placed as-is (or not) on CTAN, to be handled automatically by package managers.

2
  • 3
    mysymb.fd should be called umysymb.fd. Aug 23, 2021 at 15:54
  • Thank you for this ! With that change, I hit the same "don't know how to create bitmap font" error, which I could fix using sudo updmap-sys --enable Map=mysymb.map following this hint. I'm now moving on to the proper packaging of all these elements ...
    – fpavogt
    Aug 24, 2021 at 6:17

1 Answer 1

2

The package was recently uploaded to CTAN from its Github repository, where a dedicated Github Action was assembled to automatically create a CTAN-compatible ZIP file when a new release is being issued.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .