Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cookingsymbols package #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Kernald
Copy link
Collaborator

@Kernald Kernald commented Feb 8, 2021

No description provided.

@Kernald
Copy link
Collaborator Author

Kernald commented Feb 8, 2021

I can't figure out why the test doesn't build - the only error I get is failed to open file recorder output: [Errno 2] No such file or directory: 'lualatex.fls', which seems to mean there's an error happening earlier, but I have no clue how to see the actual error. Any advice?

@Kernald Kernald force-pushed the cookingsymbols branch 2 times, most recently from b219953 to 393207f Compare August 1, 2021 22:56
@Kernald Kernald mentioned this pull request Aug 3, 2021
@patbro patbro added bug Something isn't working help wanted Extra attention is needed labels Aug 7, 2021
@Kernald
Copy link
Collaborator Author

Kernald commented Oct 19, 2022

When rebased ontop of #89, we get more details:

kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 1+0/600 --dpi 600 cookingsymbols
mktexpk: don't know how to create bitmap font for cookingsymbols.
mktexpk: perhaps cookingsymbols is missing from the map file.
kpathsea: Appending font creation commands to missfont.log.

! error:  (file cookingsymbols) (type 3): font cookingsymbols at 600 not found

I suspect this is what happens:

  • We're missing a tool allowing lualatex to use the font (we have the tfm file), so kpathsea reverts to calling mktexpk to generate another file (not sure what) through mktexpk
  • mktexpk looks for cookingsymbols.mf

This fails because cookingsymbols.mf is part of texmf-dist/fonts/source/public/cookingsymbols, which we don't have access to. While bundling the source maps could be a workaround (I haven't tested this), the proper fix would likely be to understand why the tfm file isn't used in the first place.

@solsjo any suggestion?

@solsjo
Copy link
Collaborator

solsjo commented Jan 23, 2023

@Kernald, sorry, missed this comment.

No, I'm afraid I don't much information to add.

I did encounter a similar problem, at that time it was related to latex not finding the fontmaps files (*.map) need to produce the font, IIRC.

For me that was related to refactoring messing with the rules and kpathsea lookup. So it should work in the standard case? unless cockingsymbols depend on some package containing some separate font maps?

@solsjo
Copy link
Collaborator

solsjo commented Mar 20, 2023

@Kernald,
I've revisited this one after merging my commits to master.

TL;DR

I managed to reproduce your error, and I've spent some time trying to figure it out.
Is the cookingsymbols we reference in the repo fully functional to be used, I don't really know who provides them?
But, it seems to me (and I don't have much knowledge of latex, really, really!) that perhaps it is better to generate the mf from the .dtx .ins files?
https://ctan.org/pkg/cookingsymbols?lang=en
or copy the mf source from here:
https://ftp.acc.umu.se/mirror/CTAN/macros/latex/contrib/cookingsymbols/cookingsymbols.pdf,
maybe in an additional rule the can produce mf from .dtx .ins, or are,
dtx / ins file converted on the fly to mf using \generate directive?

reproducing the error after removing the tool_wrapper

When trying to reproduce the error I noticed that because of the refactoring (not mimicking the TDS structure + latex install structure, but making use of environment variables) we need to do so additional changes.


--- a/latex.bzl
+++ b/latex.bzl
@@ -118,6 +118,7 @@ def get_env(ctx, toolchain, files):
         "SOURCE_DATE_EPOCH": "0",
         "TEXMF": ".",
         "TEXMFCNF": ctx.files.web2c[0].dirname,
+        "WEB2C": ctx.files.web2c[0].dirname,

to find web2c files from scripts, and

--- a/repositories.bzl
+++ b/repositories.bzl
@@ -95,7 +95,11 @@ def latex_repositories(version = TEXLIVE_VERSION_2022):
         download_pkg_archive(bin_build_file, version, path, sha256, patches)
 
     for path, sha256, patches in pkgs.other:
-        download_pkg_archive(other_build_file, version, path, sha256, patches)
+        patch_cmds = []
+        if path.endswith("scripts/texlive") or "web2c" in path:
+            patch_cmds = ["grep -rnl ':$PATH' | xargs sed -i 's#:$PATH#:$(dirname $(dirname $mydir))/$(dirname $(which kpsewhich)):$PATH#g'"]
+
+        download_pkg_archive(other_build_file, version, path, sha256, patches, patch_cmds)

To make the scripts find kpsewhich (some of the scripts execute in a temp-folder instead, but beacuse kpsewhich directory is added to PATH with relative path it only works from the bazel entrypoint) we need to add the path to kpsewhich in the scripts, which themselves appends to the PATH to find their own scripts directory. The hack above simply follows on that. We should probably implement a more solid solution than this.

@Kernald
Copy link
Collaborator Author

Kernald commented Mar 21, 2023

I managed to reproduce your error, and I've spent some time trying to figure it out. Is the cookingsymbols we reference in the repo fully functional to be used, I don't really know who provides them? But, it seems to me (and I don't have much knowledge of latex, really, really!) that perhaps it is better to generate the mf from the .dtx .ins files? https://ctan.org/pkg/cookingsymbols?lang=en or copy the mf source from here: https://ftp.acc.umu.se/mirror/CTAN/macros/latex/contrib/cookingsymbols/cookingsymbols.pdf, maybe in an additional rule the can produce mf from .dtx .ins, or are, dtx / ins file converted on the fly to mf using \generate directive?

I'm honestly not sure about any of that - I never dealt with those files before, you clearly have more LaTeX knowledge than I do :-) The only thing that I know is that I didn't have to do any manual work to use cookingsymbols on my LaTeX installation, but I guess the toolchain (outside of Bazel) is smart enough to generate what's needed on the fly.

@solsjo
Copy link
Collaborator

solsjo commented Mar 21, 2023

Hmm, I read that pdflatex and XeTex does generate e.g. generate tfm files on the fly but not lualatex. Do you remember which program you used?

@Kernald
Copy link
Collaborator Author

Kernald commented Mar 21, 2023

I suspect pdflatex, but can't say for certain. Looking for files named *cookingsymbols* on my machine (and excluding any Bazel related ones), I found these:

/home/kernald/.texlive/texmf-var/fonts/pk/ljfour/public/cookingsymbols
/home/kernald/.texlive/texmf-var/fonts/pk/ljfour/public/cookingsymbols/cookingsymbols.657pk
/home/kernald/.texlive/texmf-var/fonts/pk/ljfour/public/cookingsymbols/cookingsymbols.600pk
/home/kernald/.texlive/texmf-var/fonts/pk/ljfour/public/cookingsymbols/cookingsymbols.870pk
/usr/share/texmf-dist/fonts/tfm/public/cookingsymbols
/usr/share/texmf-dist/fonts/tfm/public/cookingsymbols/cookingsymbols.tfm
/usr/share/texmf-dist/fonts/source/public/cookingsymbols
/usr/share/texmf-dist/fonts/source/public/cookingsymbols/cookingsymbols.mf
/usr/share/texmf-dist/tex/latex/cookingsymbols
/usr/share/texmf-dist/tex/latex/cookingsymbols/cookingsymbols.sty

Something did generate those pk files - I'm not sure what, when or how, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Development

Successfully merging this pull request may close these issues.

3 participants