M2: the loca-format fix is hayro-interpret patch (83)

Patch (79) was also taken by #3969, opened earlier; this PR's number moves
past the highest any open PR of ours or main uses (82): README row, code
comments and the render tests that name it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyDBXygTf7jcqdsjcfn
This commit is contained in:
mtlcl410
2026-11-06 03:37:18 +08:00
co-authored by Claude Opus 5.5
parent abc348894c
commit cb8d211eec
4 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -8200,7 +8200,7 @@ mod icc_profile_cache;
mod symbolic_truetype_cmap;
// A TrueType font whose `head.indexToLocFormat` is out of range reads `loca` in the format its
// length gives (vendored hayro-interpret patch 79).
// length gives (vendored hayro-interpret patch 83).
mod truetype_loca_format;
/// Render `pdf`'s first page at 72 dpi with no time limit beyond the test's own.
@@ -1,5 +1,5 @@
//! A TrueType font whose `head.indexToLocFormat` holds neither 0 nor 1 draws through the `loca`
//! format its table is in (vendored hayro-interpret patch 79). The OpenType `head` table allows
//! format its table is in (vendored hayro-interpret patch 83). The OpenType `head` table allows
//! only 0 (short offsets) and 1 (long); the glyph reader took anything but 1 as short, so a font
//! whose field reads 256 (pdf.js `issue2537r.pdf`) had its long offsets read as short ones, and
//! "LINE UP" drew as boxes. ISO 32000-2 §9.9 has an embedded TrueType program drawn as the
+1 -1
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -195,7 +195,7 @@ impl Debug for OpenTypeFontBlob {
}
}
/// PdfCraft patch (79): a copy of the font with its `head.indexToLocFormat` set to the format its
/// PdfCraft patch (83): a copy of the font with its `head.indexToLocFormat` set to the format its
/// `loca` table is in, when the field holds neither 0 (short offsets) nor 1 (long), or `None` when
/// it needs no change. The glyph outline reader takes only 1 as long, so a font whose field reads
/// 256 (the value's bytes swapped) had its long `loca` read as short offsets: every glyph came
@@ -232,7 +232,7 @@ fn with_loca_format_fixed(data: &[u8], index: u32) -> Option<Vec<u8>> {
impl OpenTypeFontBlob {
pub(crate) fn new(data: FontData, index: u32) -> Option<Self> {
// PdfCraft patch (79): see `with_loca_format_fixed`.
// PdfCraft patch (83): see `with_loca_format_fixed`.
let data = match with_loca_format_fixed(data.as_ref().as_ref(), index) {
Some(fixed) => Arc::new(fixed) as FontData,
None => data,