Skip to content

Commit

Permalink
Put /fonts on top, fix resolving of files
Browse files Browse the repository at this point in the history
  • Loading branch information
jerbob92 committed Jul 25, 2023
1 parent b2b3510 commit 9626673
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 13 deletions.
20 changes: 10 additions & 10 deletions build/xpdf.patch
Original file line number Diff line number Diff line change
@@ -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",
13 changes: 10 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"embed"
_ "embed"
"fmt"
"io/fs"
"log"
"os"
"path/filepath"
Expand All @@ -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()
Expand Down Expand Up @@ -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.
Expand Down
Binary file modified wasm/pdffonts.wasm
Binary file not shown.
Binary file modified wasm/pdftohtml.wasm
Binary file not shown.
Binary file modified wasm/pdftopng.wasm
Binary file not shown.
Binary file modified wasm/pdftoppm.wasm
Binary file not shown.
Binary file modified wasm/pdftops.wasm
Binary file not shown.

0 comments on commit 9626673

Please sign in to comment.