fix: implement deferred libeot-parity items (#7) - #8
Merged
Conversation
Address all five deferred parity findings from #7: 1. Byte-boundary enforcement (stream.ts): byte read/write/seek now throw EOT_OFF_BYTE_BOUNDARY when the stream is mid-byte; readNBits remains the sole legitimate mid-byte accessor. Seeks require alignment instead of silently resetting bitPos. 2. Bbox accumulator (ctf-parser.ts): fold in int16-truncated deltas, matching libeot and the coordinates the glyph actually renders with. 3. Reserved-space errors (stream.ts): *ThroughReserve seeks throw EOT_SEEK_PAST_EOS and copyTo throws EOT_OUT_OF_RESERVED_SPACE instead of auto-growing; the glyph builder already pre-reserves worst-case space. 4. Missing head (sfnt-builder.ts): dumpContainer throws EotError NoHeadTable instead of silently skipping the checksumAdjustment patch. 5. hdmx/VDMX diagnostics (ctf-parser.ts): dropped tables surfaced via a new SFNTContainer.droppedTables field and an opt-in onWarn callback threaded through decompressMtx options. Adds OffByteBoundary/OutOfReservedSpace/SeekPastEos error codes and the ParseCTFOptions type; documents onWarn in the README. Test suite 214 -> 222. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements all five deferred libeot-parity items tracked in #7.
Changes
stream.ts) — byte read/write/seek now throwEOT_OFF_BYTE_BOUNDARYwhen the stream is mid-byte (bitPos != 0).readNBitsremains the sole legitimate mid-byte accessor. Seeks require alignment rather than silently resettingbitPos, mirroring libeot.ctf-parser.ts) — folds in the int16-truncated deltas, matching libeot and the coordinates the glyph actually renders with. No effect on valid input.stream.ts) —*ThroughReserveseeks throwEOT_SEEK_PAST_EOSandcopyTothrowsEOT_OUT_OF_RESERVED_SPACEinstead of auto-growing. The glyph builder already pre-reserves worst-case space per glyph, so the decode path is unaffected.head(sfnt-builder.ts) —dumpContainerthrowsEotErrorNoHeadTableinstead of silently skipping thechecksumAdjustmentpatch.ctf-parser.ts) — dropped tables surfaced via a new optionalSFNTContainer.droppedTablesfield and an opt-inonWarncallback threaded throughdecompressMtxoptions (noconsoleoutput, matching the library's existing convention).API additions
OffByteBoundary,OutOfReservedSpace,SeekPastEos.ParseCTFOptionstype;parseCTFnow exported.decompressMtxgainsoptions.onWarn(documented in README).Verification
droppedTables/onWarn, and the missing-headguard; updated 11sfnt-buildertests to include aheadtable.tsupbuild succeeds; source istsc-clean.Closes #7
🤖 Generated with Claude Code