Restore registered pdfTeX images from native formats

This commit is contained in:
gloamxun committed 2026-11-27 13:32:22 +08:00
1 parent 1307bbcf0c
commit c2f18f50dc
14 files changed
+667 -49

No files matched your search

+10 -3
View File
@@ -33,11 +33,12 @@ pub enum ResourceKind {
Format,
Config,
FontMapping,
PdfImage,
}
impl ResourceKind {
fn directory(self) -> &'static str {
match self {
Self::Tex => "tex",
Self::Tex | Self::PdfImage => "tex",
Self::Tfm => "fonts/tfm",
Self::Vf => "fonts/vf",
Self::Type1 => "fonts/type1",
@@ -52,7 +53,7 @@ impl ResourceKind {
}
fn environment(self) -> &'static str {
match self {
Self::Tex => "TEXINPUTS",
Self::Tex | Self::PdfImage => "TEXINPUTS",
Self::Tfm => "TFMFONTS",
Self::Vf => "VFFONTS",
Self::Type1 => "T1FONTS",
@@ -68,7 +69,7 @@ impl ResourceKind {
}
fn extensions(self) -> &'static [&'static str] {
match self {
Self::Tex => &["tex"],
Self::Tex | Self::PdfImage => &["tex"],
Self::Tfm => &["tfm"],
Self::Vf => &["vf"],
Self::Type1 => &["pfb", "pfa"],
@@ -1238,6 +1239,12 @@ impl FileWorld {
}
}
fn paths(&self, kind: ResourceKind, from: &Path) -> Vec<SearchPath> {
// Images use the TeX namespace and have their own dependency role.
let kind = if kind == ResourceKind::PdfImage {
ResourceKind::Tex
} else {
kind
};
let mut defaults = vec![SearchPath::directory(&self.config.cwd, false)];
if kind == ResourceKind::Tex && self.config.input_policy == InputPolicy::Project {
if let Some(parent) = from.parent() {