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

Suggested feature: epstopdf - alert on missing font packages #429

Closed
1 task done
ivankokan opened this issue Dec 4, 2019 · 13 comments
Closed
1 task done

Suggested feature: epstopdf - alert on missing font packages #429

ivankokan opened this issue Dec 4, 2019 · 13 comments
Assignees
Milestone

Comments

@ivankokan
Copy link
Contributor

ivankokan commented Dec 4, 2019

Motivated by this issue and Andrey's expectations

I expected, however, Miktex to install missing packages.

I was wondering whether it would be possible from MiKTeX to alert on missing packages in "install missing packages on-the-fly" fashion.

(Related to MiKTeX/miktex-packaging#112.)

@ivankokan
Copy link
Contributor Author

ivankokan commented Dec 12, 2019

Hi @edocevoli.

This could be implemented this way:

  1. If epstopdf fails, try to capture the font name using the following regex (I tried to be precise with regex but pragmatic as well):
Error: /invalidfont in /findfont
Operand stack:
   Helvetica-BoldOblique
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval-
-   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   2015   1   3   %oparray_pop   2014   1   3   %oparray_pop   --nostringval--   1998   1   3   %oparray_pop   1884   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   1967   1   3   %oparray_pop
Dictionary stack:
   --dict:973/1684(ro)(G)--   --dict:0/20(G)--   --dict:123/200(L)--
Current allocation mode is local
Error:[[:space:]]*/invalidfont[[:space:]]*in[[:space:]]*/findfont[[:space:]]*Operand stack:[[:space:]]*([^[:space:]]+)
  1. Find all font associations in Fontmap.MiKTeX for previously detected font. (Fontmap.MiKTeX might contain some non-unique associations, hence all should be considered.) If the font in EPS is rare, or it does not have any association in Fontmap.MiKTeX, stop here ("nothing can be done", "submit an issue" etc.).

  2. If "Always install missing packages on-the-fly" or "Ask me" are set, for each font association found in 2. (e.g. a/b/c/d/e/f.pfb) trigger or prompt for installing all packages that contain f.pfb (use filename only, ignore relative path). (Eventually, this might not help due to incorrect association in Fontmap.MiKTeX.)

Note: If multiple font resources are not installed, epstopdf/mgs reports only one at a time, and it is expected that steps 1.-3. must be run several times.

What do you think?

@Abraham-dot
Copy link

Abraham-dot commented Dec 12, 2019

MikTex has a wrong version of Ghostscript which produces errors by not recognizing fonts.
For example, it writes:

Error: /invalidfont in /findfont
Operand stack:
--nostringval-- Helvetica-Oblique
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 2015 1 3 %oparray_pop 2014 1 3 %oparray_pop --nostringval-- 1998 1 3 %oparray_pop 1884 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- 1967 2 4 %oparray_pop
Dictionary stack:
--dict:989/1684(ro)(G)-- --dict:0/20(G)-- --dict:111/200(L)-- --dict:35/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
Current file position is 69493
MiKTeX GPL Ghostscript 9.25: Unrecoverable error, exit code 1
xdvipdfmx:fatal: pdf_ref_obj(): passed invalid object.
No output PDF file written.
Sorry, but xelatex did not succeed.
The log file hopefully contains the information to get MiKTeX going again:
C:\Users\Abraham1\AppData\Local\MiKTeX\2.9\miktex\log\xelatex.log
Sorry, but "MiKTeX Compiler Driver" did not succeed.

Note the text above: "MiKTeX GPL Ghostscript 9.25: Unrecoverable error, exit code 1"
This error occurs when the input is an eps figure. This error does not occur with this figure for a different version of Ghostscript. Please explain how I can change the version of Ghostscript which is used with MikTex. (I use Xelatex in MikTex TexWorks.)

@ivankokan
Copy link
Contributor Author

ivankokan commented Dec 12, 2019

This issue is about epstopdf, not about xdvipdfmx which is your case.

Also, MiKTeX does not have "wrong version" of Ghostscript, only "not recent". But 9.25 works correctly considering the updates in few recent months.

Anyway, do you have helvetic package installed, and MiKTeX up-to-date in general?

@ivankokan
Copy link
Contributor Author

This error occurs when the input is an eps figure. This error does not occur with this figure for a different version of Ghostscript.

I suggest you convert those EPS resources manually with epstopdf and include them as PDF resources in XeLaTeX. That will do.

Please explain how I can change the version of Ghostscript which is used with MikTex. (I use Xelatex in MikTex TexWorks.)

I suggest maybe opening a new issue on this matter.

@ivankokan
Copy link
Contributor Author

@Abraham-dot Have you tried?

@ClareBellingham
Copy link

ClareBellingham commented Mar 9, 2020

Has this issue been resolved, or is there an easy step by step on where to install or point the fonts as I have this issue after updating Miktex and now cannot build my reports to include eps at all

@ivankokan
Copy link
Contributor Author

@ClareBellingham MiKTeX/miktex-packaging#112 (comment)

Or, the ultimate approach: use MiKTeX Console Packages view to filter the package list with *.pfb, and install all filtered packages.

@ivankokan
Copy link
Contributor Author

Hi @edocevoli. I am keen to help with implementing this feature. Can you please instruct how to set up the dev environment?

@edocevoli
Copy link
Member

Thank you, I am already working on it (not yet committed).

I think it is better (maybe easier) to scan the EPS file before running Ghostscript. So /Helvetica-Oblique findfont triggers the font look / installation before the Ghostscript invocation.

@edocevoli edocevoli self-assigned this Apr 10, 2020
@edocevoli edocevoli added this to the 2.9.7400 milestone Apr 10, 2020
edocevoli added a commit that referenced this issue Apr 10, 2020
@ivankokan
Copy link
Contributor Author

ivankokan commented Apr 11, 2020

Thank you, I am already working on it (not yet committed).

I think it is better (maybe easier) to scan the EPS file before running Ghostscript. So /Helvetica-Oblique findfont triggers the font look / installation before the Ghostscript invocation.

Great! Such pre-check approach is definitely more pragmatic than post-check. A quick look on the commit - looks good.

I urged on this request due to many related questions/issues on Stack Exchange lately, mostly caused by MiKTeX/miktex-packaging#112. Once this feature is finished, that one will be indirectly resolved.

On the other hand, the background of MiKTeX/miktex-packaging#112 ("which set does specific package belong to?") might still be an issue for something else. As mentioned here (MiKTeX/miktex-packaging#112 (comment)), how do Level values within mpm.ini change and who does actually control that?

[courier]
CabMD5=92238816e6c6f72ce057c9799e03fcd8
CabSize=508571
Level=M
MD5=d662dc38c0a2336c57ca2ad4f83a6272
TimePackaged=1303317872
Type=TarLzma

[helvetic]
CabMD5=9af2da562ef951a723d574bfacefbd98
CabSize=745459
Level=L
MD5=0018d8f18232b2e59e1d45b2973addd0
TimePackaged=1159465592
Type=MSCab

@edocevoli
Copy link
Member

This has now been implemented.

Re MiKTeX/miktex-packaging#112:
The levels are predefined. I can make helvetic a basic (M) package.

@ivankokan
Copy link
Contributor Author

This has now been implemented.

Re MiKTeX/miktex-packaging#112:
The levels are predefined. I can make helvetic a basic (M) package.

Excellent! Looking forward to test and verify it.

@ivankokan
Copy link
Contributor Author

@edocevoli Tested. Verified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants