fix: restore booklet viewer with mupdf 0.6 (#170)

mupdf 0.5 had struct size mismatches on Arch Linux (mupdf-sys bindings
incompatible with system MuPDF headers). Upgrading to mupdf 0.6 fixes
the bindings.

- Removed the booklet feature gate — mupdf is now a direct dependency
  again, matching the v1.1.19 configuration
- Removed stub implementation (always compile real MuPDF backend)
- sys-lib-libjpeg remains excluded (cross-distro libjpeg incompatibility)

cc
This commit is contained in:
vicrodh committed 2026-03-19 09:28:07 -06:00
1 parent c2e9a4f0ba
commit 509426ebcf
2 files changed
+3 -50

No files matched your search

+1 -5
View File
@@ -13,10 +13,6 @@ crate-type = ["staticlib", "cdylib", "rlib"]
name = "qbz"
path = "src/main.rs"
[features]
default = []
booklet = ["mupdf"]
[build-dependencies]
tauri-build = { version = "2", features = [] }
@@ -107,7 +103,7 @@ image = { version = "0.25", default-features = false, features = ["png", "jpeg",
# GTK/GdkPixbuf. But NOT libjpeg — Ubuntu ships libjpeg8 (libjpeg.so.8) while
# Debian/Fedora ship libjpeg62-turbo (libjpeg.so.62). Let mupdf vendor its own
# libjpeg to avoid cross-distro breakage (GitHub #161, #162).
mupdf = { version = "0.5", default-features = false, optional = true, features = [
mupdf = { version = "0.6", default-features = false, features = [
"system-fonts",
"sys-lib-zlib",
"sys-lib-harfbuzz",
+2 -45
View File
@@ -53,10 +53,9 @@ fn booklet_temp_dir() -> PathBuf {
}
// ---------------------------------------------------------------------------
// Real MuPDF implementation (feature = "booklet")
// MuPDF implementation
// ---------------------------------------------------------------------------
#[cfg(feature = "booklet")]
mod real_impl {
use super::*;
use base64::Engine;
@@ -264,52 +263,10 @@ mod real_impl {
}
// ---------------------------------------------------------------------------
// Stub implementation (no MuPDF)
// Public Tauri commands — delegate to MuPDF implementation
// ---------------------------------------------------------------------------
#[cfg(not(feature = "booklet"))]
mod stub_impl {
use super::*;
const UNAVAILABLE: &str =
"Booklet viewer unavailable: built without MuPDF (enable the 'booklet' feature)";
pub async fn open(
_url: String,
_state: &tauri::State<'_, BookletState>,
) -> Result<BookletInfo, String> {
Err(UNAVAILABLE.to_string())
}
pub async fn render_page(
_page: u32,
_dpi: u32,
_rotation: Option<u32>,
_state: &tauri::State<'_, BookletState>,
) -> Result<RenderedPage, String> {
Err(UNAVAILABLE.to_string())
}
pub async fn save(
_dest: String,
_state: &tauri::State<'_, BookletState>,
) -> Result<(), String> {
Err(UNAVAILABLE.to_string())
}
pub async fn close(_state: &tauri::State<'_, BookletState>) -> Result<(), String> {
Err(UNAVAILABLE.to_string())
}
}
// ---------------------------------------------------------------------------
// Public Tauri commands — delegate to the active implementation
// ---------------------------------------------------------------------------
#[cfg(feature = "booklet")]
use real_impl as impl_;
#[cfg(not(feature = "booklet"))]
use stub_impl as impl_;
/// Download a PDF from a URL, save to temp, and return page info.
#[tauri::command]