Embed text fonts and fix preview table rule coordinates

This commit is contained in:
gloamxun committed 2026-10-19 21:07:25 +08:00
1 parent b119c57e8e
commit 2856506d65
6 files changed
+37 -35

No files matched your search

+7 -8
View File
@@ -1923,13 +1923,12 @@ struct FontInputs {
impl FontInputs {
fn load(model: &DocumentModel) -> Result<Self, String> {
let latin_dir = latin_font_directory()?;
// Use the Base-14 faces when every text character is representable;
// otherwise embed the metric-compatible Liberation faces.
let builtin = if document_needs_embedded_latin(model) {
None
} else {
Some(fonts::Builtin::Times)
};
// Always embed the metric-compatible Liberation faces. Base-14 Times
// depends on the viewer having the exact WinAnsi faces installed and
// produced broken glyphs in some readers, so portability wins over the
// smaller PDF.
let _needs_embedded_latin = document_needs_embedded_latin(model);
let builtin = None;
let latin_fonts = fonts::from_files(&latin_dir, "LiberationSerif", builtin)
.map_err(|error| format!("could not load Latin fonts: {error}"))?;
let cjk_path = document_contains_cjk(model)
@@ -1947,7 +1946,7 @@ impl FontInputs {
.transpose()?;
let monospace_fonts = if let Some(mono_dir) = &monospace_dir {
Some(
fonts::from_files(mono_dir, "LiberationMono", Some(fonts::Builtin::Courier))
fonts::from_files(mono_dir, "LiberationMono", None)
.map_err(|error| format!("could not load monospaced fonts: {error}"))?,
)
} else {
+2 -2
View File
@@ -185,7 +185,7 @@ fn write_table(
write_table_rule(
output,
table_x,
cursor,
f64::from(y) + cursor,
&column_offsets,
column_count,
rule,
@@ -225,7 +225,7 @@ fn write_table(
write_table_rule(
output,
table_x,
cursor,
f64::from(y) + cursor,
&column_offsets,
column_count,
rule,