Updating Your Own Font

2,905

Well, I was manually deleting this directory: C:\texlive\2013\texmf-var\luatex-cache\

This same procedure is accomplished with the commandline (thanks Ulrik):

luaotfload-tool --cache=erase

Then, if your font name is different (or you added a new one), you need to do this:

texhash

However, the commenters to my question are right. It is better not to use a tex system folder. In Windows it is funny to call it a system folder since it only matters to tex. BUT I moved my fonts to C:\texlive\texmf-local\fonts\truetype\public and ran those commands and everything worked like it should. I can see from the compilation log that the fonts were pulled from the new location.

So this tex user directory is better, but the commands are the same:

luaotfload-tool --cache=erase
texhash
Share:
2,905

Related videos on Youtube

bgmCoder
Author by

bgmCoder

Updated on March 14, 2020

Comments

  • bgmCoder
    bgmCoder over 3 years

    In my scenario I am using my own custom font. It is an OpenType font - not a tex-packaged one either, just one I've made in FontCreator (Windows 7). Now, I want to use this font with lualatex, so I put a copy of myfont.otf here C:\texlive\2013\texmf-dist\fonts\truetype\public and it gets picked up.

    My problem: If I update myfont.otf and replace the copy in that folder with a new one, it doesn't get used because lualatex is using the one in its cache, as is reflected in this log entry:

    luaotfload | load: auto-selecting default features for script: dflt(load luc: C:/texlive/2013/texmf-var/luatex-cache/generic/fonts/otf/myfont.luc)
    

    Now, so far the only way I have found to get my font used (after I've replaced it) is to:

    1. Delete lualatex's cache directories at C:\texlive\2013\texmf-var\luatex-cache\, %USERPROFILE%\.texlive2013\texmf-var and C:\texlive\texmf-var\lualatex-cache
    2. Then run texhash
    3. Then run udpmap

    When I compile the next tex file, it rebuilds the cache using the new font:

    luaotfload | resolve: font family='priory', subfamily='regular' found: c:/texliv
    e/2013/texmf-dist/fonts/truetype/public/myfont.otf(save: C:/texlive/2013/texmf-v
    ar/luatex-cache/generic/fonts/otf/myfont.lua)(save: C:/texlive/2013/texmf-var/lu
    atex-cache/generic/fonts/otf/myfont.luc)
    

    Is there a better way to do this? Can I rebuild the font cache without having to manually delete directories?

    • Ulrike Fischer
      Ulrike Fischer over 8 years
      The luc doesn't contain the font, only informations about metrics etc. And you don't need to run texhash or updmap. Imho you can delete the cache with luaotfload-tool --cache=erase or luaotfload-tool --cache=purge (no idea what is the difference).
    • bgmCoder
      bgmCoder over 8 years
      Not sure what purge does, but erase does erase the files in the cache folder at C:\texlive\2013\texmf-var\luatex-cache\generic\fonts\otf
    • Philipp Gesang
      Philipp Gesang over 8 years
      Not sure what purge does -- Recommended reading: man 1 luaotfload-tool; from that man page: “1. purge -> delete Lua files from cache; 2. erase -> delete Lua and Luc files from cache;”.
    • egreg
      egreg over 8 years
      Putting personal things in C:\texlive\2013\texmf-dist\fonts\truetype\public is not a good idea. Use C:\texlive\texmf-local\fonts\truetype\<fontname> creating the needed directories if not existent; <fontname> stands for an arbitrary string, say myfont if your font is myfont.ttf. Of course, if the font is OTF, use opentype instead of truetype.
    • bgmCoder
      bgmCoder over 8 years
      egreg - You are right. I moved things to the texmf-local and it works perfectly.
    • Ulrike Fischer
      Ulrike Fischer over 8 years
      @phg: we poor windows users can't use man. In texlive I can find a pdf-file with texdoc luaotfload-tool, in miktex I couldn't find nothing with texdoc, and with a file search in the doc folder only a luaotfload-tool.1.
    • Philipp Gesang
      Philipp Gesang over 8 years
      @Ulrike Fischer: The man page is generated from a human readable source. The installed version of that file (matching your distribution’s Luaotfload package) can be read like so: less $(kpsewhich --format=source luaotfload-tool.rst) -- of course substituting the Windows equivalent of a pager for less and adapting the command substitution to the shell you use.
  • bgmCoder
    bgmCoder over 8 years
  • cfr
    cfr over 8 years
    Why don't you use opentype rather than truetype?
  • bgmCoder
    bgmCoder over 8 years
    It doesn't matter - the extensions .ttf and .otf are interchangeable - they are both opentype beneath the scenes. However, it is commong practice that if you add opentype layout features that you use the .otf extension to show it. Read this: forum.high-logic.com/viewtopic.php?f=5&t=1619