Skip to content

F-Office v0.2.0

Choose a tag to compare

@osolmaz osolmaz released this 30 Nov 05:00

Memory efficiency, streaming PDF export, zero-copy browser file I/O, and the new @f-office/viewer drop-in browser component.

Install

CLI (foffice) — bundles metric-compatible open fonts from Compatifont (OFL-1.1):

# From crates.io
cargo install f-office-cli

# Or via cargo-binstall / prebuilt archives attached to this release
cargo binstall f-office-cli

# Or via Homebrew (macOS and Linux)
brew install osolmaz/tap/foffice

Rust library:

cargo add f-office

JavaScript / TypeScript (browser and Node.js):

npm install @f-office/wasm @compatifont/fonts
# Drop-in browser viewer component:
npm install @f-office/viewer @f-office/wasm @compatifont/fonts

What's new in v0.2.0

  • Handle-based lazy images (ImageRef): Document::open now reads only image headers for layout dimensions instead of eagerly pinning image byte buffers in memory; rasterization and PDF export decode images on demand behind a bounded LRU cache.
  • Flat-arena XML, streaming <w:body>, and compact text index (TextMap): f-office-xml::Document uses flat arenas and a single string buffer while preserving exact byte spans for foffice edit; <w:body> top-level blocks stream during layout; Document retains a compact reading-order TextMap instead of full Vec<PlacedLine>.
  • Streaming PDF export: Replaced in-memory PDF assembly with a streaming Write-based PDF emitter (Document::write_pdf_to, foffice convert --to pdf, and @f-office/wasm writePdfTo / worker writePdfBlob).
  • Zero-copy browser & random-access file I/O: Added RandomAccessRead + Package::open_source / Document::open_source, plus createBlobSource (File.slice() / FileReaderSync), createOpfsSource (FileSystemSyncAccessHandle), openDocxFile, and openDocxOpfs in @f-office/wasm so large DOCX files do not need to be copied into WASM linear memory.
  • New @f-office/viewer package: Drop-in <f-office-viewer> Web Component and createDocxViewer() API with virtualized page scrolling, HiDPI tiled renderRegion rendering + bounded LRU tile cache, zoom/fit modes, selectable text layer, on-demand @compatifont/fonts loading + worker-recycle font replay, and streaming PDF export.
  • Layout and graphics fixes: DrawingML a:grpFill group fill inheritance, improved EMF/WMF shape and gradient rendering, math operator spacing fixes, and updated logo spacing.

Notes

  • Licensed under Apache-2.0 (bundled Compatifont font files are OFL-1.1).
  • Building from source requires Rust 1.100 or newer.
  • @f-office/wasm uses WebAssembly SIMD (Chrome 91+, Firefox 89+, Safari 16.4+, Node.js 18+).