diff --git a/build/xpdf.patch b/build/xpdf.patch index e1ad6b4..f31a7f0 100644 --- a/build/xpdf.patch +++ b/build/xpdf.patch @@ -1,12 +1,12 @@ -diff --git a/xpdf/GlobalParams.cc b/xpdf/GlobalParams.cc -index 5fd4393..98f83ce 100644 ---- a/xpdf/GlobalParams.cc +diff --git a/xpdf/GlobalParams.cc.old b/xpdf/GlobalParams.cc +index 5fd4393..37b0e84 100644 +--- a/xpdf/GlobalParams.cc.old +++ b/xpdf/GlobalParams.cc -@@ -114,6 +114,7 @@ static const char *displayFontDirs[] = { - "/usr/share/fonts/default/Type1", - "/usr/share/fonts/default/ghostscript", - "/usr/share/fonts/type1/gsfonts", +@@ -109,6 +109,7 @@ static const char *displayFontDirs[] = { + }; + #else + static const char *displayFontDirs[] = { + "/fonts", - #if defined(__sun) && defined(__SVR4) - "/usr/sfw/share/ghostscript/fonts", - #endif + "/usr/share/ghostscript/fonts", + "/usr/local/share/ghostscript/fonts", + "/usr/share/fonts/default/Type1", diff --git a/main.go b/main.go index e2cafbf..5c75ce2 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "embed" _ "embed" "fmt" + "io/fs" "log" "os" "path/filepath" @@ -22,11 +23,11 @@ import ( //go:embed wasm/* var wasmBinaries embed.FS -//go:embed fonts +//go:embed fonts/* var fontFiles embed.FS func main() { - ctx := context.WithValue(context.Background(), experimental.FunctionListenerFactoryKey{}, logging.NewLoggingListenerFactory(os.Stdout)) + ctx := context.WithValue(context.Background(), experimental.FunctionListenerFactoryKey{}, logging.NewHostLoggingListenerFactory(os.Stdout, logging.LogScopeFilesystem)) ctx = context.Background() // Comment this line to get debug information. runtimeConfig := wazero.NewRuntimeConfig() @@ -86,7 +87,13 @@ func main() { } fsConfig := wazero.NewFSConfig() - fsConfig = fsConfig.WithFSMount(fontFiles, "/fonts") + + fontsSub, err := fs.Sub(fontFiles, "fonts") + if err != nil { + log.Fatal(err) + } + + fsConfig = fsConfig.WithFSMount(fontsSub, "/fonts") // On Windows we mount the volume of the current working directory as // root. On Linux we mount / as root. diff --git a/wasm/pdffonts.wasm b/wasm/pdffonts.wasm index 30a4cc9..e7bf88c 100755 Binary files a/wasm/pdffonts.wasm and b/wasm/pdffonts.wasm differ diff --git a/wasm/pdftohtml.wasm b/wasm/pdftohtml.wasm index 8be5963..8cd5ff1 100755 Binary files a/wasm/pdftohtml.wasm and b/wasm/pdftohtml.wasm differ diff --git a/wasm/pdftopng.wasm b/wasm/pdftopng.wasm index 08e8a8b..f698caa 100755 Binary files a/wasm/pdftopng.wasm and b/wasm/pdftopng.wasm differ diff --git a/wasm/pdftoppm.wasm b/wasm/pdftoppm.wasm index 6d2c0f3..701cc55 100755 Binary files a/wasm/pdftoppm.wasm and b/wasm/pdftoppm.wasm differ diff --git a/wasm/pdftops.wasm b/wasm/pdftops.wasm index e8a329c..4ea9e93 100755 Binary files a/wasm/pdftops.wasm and b/wasm/pdftops.wasm differ