From c0323205e3eb6cdd6188ac65a92628d1c115e17d Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Mon, 2 Sep 2024 11:37:45 +0200 Subject: [PATCH] Correctly detect new fontspec error for missing font closes #448 --- DESCRIPTION | 2 +- R/latex.R | 4 +++- tests/test-cran/test-latex.R | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 51814bb4c..e20b79895 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: tinytex Type: Package Title: Helper Functions to Install and Maintain TeX Live, and Compile LaTeX Documents -Version: 0.52.1 +Version: 0.52.2 Authors@R: c( person("Yihui", "Xie", role = c("aut", "cre", "cph"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")), person(given = "Posit Software, PBC", role = c("cph", "fnd")), diff --git a/R/latex.R b/R/latex.R index e37099211..e6fc6ca48 100644 --- a/R/latex.R +++ b/R/latex.R @@ -561,6 +561,7 @@ regex_errors = function() { # ! I can't find file `hyph-de-1901.ec.tex'. # ! Package pdfx Error: No color profile sRGB_IEC61966-2-1_black_scaled.icc found # No file LGRcmr.fd. ! LaTeX Error: This NFSS system isn't set up properly. + # (fontspec) The font "LibertinusSerif-Regular" cannot be list( font = c( # error messages about missing fonts (don't move the first item below, as @@ -569,7 +570,8 @@ regex_errors = function() { ".*! Font [^=]+=([^ ]+).+ not loadable.*", '.*! .*The font "([^"]+)" cannot be found.*', '.*!.+ error:.+\\(file ([^)]+)\\): .*', - '.*Unable to find TFM file "([^"]+)".*' + '.*Unable to find TFM file "([^"]+)".*', + '.*\\(fontspec\\)\\s+The font "([^"]+)" cannot be.*' ), fd = c( # font definition files diff --git a/tests/test-cran/test-latex.R b/tests/test-cran/test-latex.R index 431802317..bf387635a 100644 --- a/tests/test-cran/test-latex.R +++ b/tests/test-cran/test-latex.R @@ -5,6 +5,7 @@ assert('detect_files() can detect filenames from LaTeX log', { (detect_files("! Font U/psy/m/n/10=psyr at 10.0pt not loadable: Metric (TFM) file not found") %==% font_ext("psyr")) (detect_files('! The font "FandolSong-Regular" cannot be found.') %==% font_ext("FandolSong-Regular")) (detect_files('!pdfTeX error: /usr/local/bin/pdflatex (file tcrm0700): Font tcrm0700 at 600 not found') %==% font_ext('tcrm0700')) + (detect_files('(fontspec) The font "LibertinusSerif-Regular" cannot be') %==% font_ext('LibertinusSerif-Regular')) (length(detect_files("asdf qwer")) == 0) (detect_files("! LaTeX Error: File `framed.sty' not found.") %==% 'framed.sty')