Skip to content

Commit 20d67b9

Browse files
authored
Merge pull request #13731 from quarto-dev/fix-font-space-detection
2 parents 9903625 + 8de8b31 commit 20d67b9

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

news/changelog-1.9.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ All changes included in 1.9:
1010
- ([#13625](https://github.com/quarto-dev/quarto-cli/issues/13625)): Fix Windows file locking error (os error 32) when rendering with `--output-dir` flag. Context cleanup now happens before removing the temporary `.quarto` directory, ensuring file handles are properly closed.
1111
- ([#13633](https://github.com/quarto-dev/quarto-cli/issues/13633)): Fix detection and auto-installation of babel language packages from newer error format that doesn't explicitly mention `.ldf` filename.
1212
- ([#13694](https://github.com/quarto-dev/quarto-cli/issues/13694)): Fix `notebook-view.url` being ignored - external notebook links now properly use specified URLs instead of local preview files.
13+
- ([#13732](https://github.com/quarto-dev/quarto-cli/issues/13732)): Fix automatic font package installation for fonts with spaces in their names (e.g., "Noto Emoji", "DejaVu Sans"). Font file search patterns now match both with and without spaces.
1314

1415
## Dependencies
1516

src/command/render/latexmk/parse-error.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ const packageMatchers = [
297297
];
298298

299299
function fontSearchTerm(font: string): string {
300-
return `${font}(-(Bold|Italic|Regular).*)?[.](tfm|afm|mf|otf|ttf)`;
300+
const fontPattern = font.replace(/\s+/g, '\\s*');
301+
return `${fontPattern}(-(Bold|Italic|Regular).*)?[.](tfm|afm|mf|otf|ttf)`;
301302
}
302303

303304
function findMissingPackages(logFileText: string): string[] {

tests/unit/latexmk/parse-error.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import { unitTest } from "../../test.ts";
1010
import { assert } from "testing/asserts";
1111

1212
function fontSearchTerm(font: string): string {
13-
return `${font}(-(Bold|Italic|Regular).*)?[.](tfm|afm|mf|otf|ttf)`;
13+
const fontPattern = font.replace(/\s+/g, '\\s*');
14+
return `${fontPattern}(-(Bold|Italic|Regular).*)?[.](tfm|afm|mf|otf|ttf)`;
1415
}
1516

1617
function assertFound(logText: string, expected: string, file?: string) {
@@ -32,6 +33,8 @@ unitTest("Detect missing files with `findMissingFontsAndPackages`", async () =>
3233
assertFound('!pdfTeX error: /usr/local/bin/pdflatex (file tcrm0700): Font tcrm0700 at 600 not found', fontSearchTerm("tcrm0700"))
3334
assertFound('(fontspec) The font "LibertinusSerif-Regular" cannot be', fontSearchTerm("LibertinusSerif-Regular"));
3435
assertFound('! Font \\JY3/mc/m/n/10=file:HaranoAjiMincho-Regular.otf:-kern;jfm=ujis at 9.24713pt not loadable: metric data not found or bad.', "HaranoAjiMincho-Regular.otf");
36+
assertFound('! The font "Noto Emoji" cannot be found.', fontSearchTerm("Noto Emoji"));
37+
assertFound('! Package fontspec Error: The font "DejaVu Sans" cannot be found.', fontSearchTerm("DejaVu Sans"));
3538
assertFound("! LaTeX Error: File `framed.sty' not found.", "framed.sty");
3639
assertFound("! LaTeX Error: File 'framed.sty' not found.", "framed.sty");
3740
assertFound("/usr/local/bin/mktexpk: line 123: mf: command not found", "mf");

0 commit comments

Comments
 (0)