Repository navigation
Conversation
… fix XLSX rendering
Untrack selected project notes and local configuration, update README links, and retain the standard build and test jobs.
Keep local notes and configuration ignored; preserve .NET CI and license files.
Switch portable conversion to managed EMF and WMF rendering, resolve real font faces, preserve cropping, and remove incorporated Drawing sources and package notices.
Reuse the existing CJK font selection policy and report substitution rather than losing OLE previews when an exact family is unavailable.
…dering Replace incorporated Drawing code with owned managed metafile rendering. Preserve the existing CJK fallback policy after Ubuntu CI verification.
…ftware#216) (mini-software#218) * fix(xlsx): read SpreadsheetML parts that use a prefixed namespace ExcelReader took the namespace of each part from the root's default namespace (GetDefaultNamespace). Parts written with a prefixed namespace, such as <x:workbook xmlns:x="...">, have no default namespace, so every lookup used XNamespace.None and found no sheets, strings or cells. Use the root element's own namespace instead, which is identical for default namespace documents. Fixes mini-software#216 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(xlsx): honor prefixed font flags and range bounds * fix(xlsx): resolve cell references in between rules * fix(xlsx): compare conditional rules using raw values * fix(xlsx): preserve numeric operands in low-memory rules --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Wei Lin <shps951002@gmail.com>
…software#158) (mini-software#219) * Resolve PAGE and NUMPAGES fields in header/footer tables RenderHeaderFooterElementsOnPage resolved the {PAGE}/{NUMPAGES} placeholders only for header/footer paragraphs. Paragraphs inside a header/footer table were drawn with the raw placeholders (and wrapped as such in narrow cells), so the footer showed "Page {PAGE} of {NUMPAGES}". Resolve the placeholders in a copy of the table before it is measured and drawn, and measure the reserved footer height with the same page 1 of 1 convention as paragraphs. Refs mini-software#158 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix DOCX page fields in header/footer tables * Measure header/footer margins after pagination * Honor section layouts for header and footer rendering * Keep continuous-section footer margins across pages --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Wei Lin <shps951002@gmail.com>
…ini-software#221) * fix(xlsx): keep the whole-table style when a table has a data format A table can carry its own data format (dataDxfId) next to its table style. The reader applied that format instead of the wholeTable element of the style, so the fill of the table style was lost on every data row. In "Simple invoice1" the table body was printed white on a tinted page. Apply the wholeTable element first, then row stripes, then the table's own data format, so each layer adds to the one below it. The assertion for "Business expenses budget2" expected no fill on the rows between stripes. The Excel reference shows the whole-table fill there, so the assertion now expects it. * docs(xlsx): state the full layer order for table data rows * fix(xlsx): keep a cell's own fill on top of the table style A fill set on a table body cell is direct formatting. The table style layers replaced it, so an explicitly filled cell took the whole-table or stripe fill. Restore the cell's own fill after the table layers are applied. The firstColumn element moves into the data-row loop so the same rule covers it. Font properties are not covered: the reader cannot yet tell an explicit cell font from the workbook default. * test(xlsx): cover a cell's own fill under row stripes and firstColumn The firstColumn branch that moved into the data-row loop had no test. Add row stripes and a firstColumn element to the fixture behind a flag, and list firstColumn in the layer-order comment. * Preserve empty and white table fills --------- Co-authored-by: Wei Lin <shps951002@gmail.com>
Use char.IsWhiteSpace instead of a hardcoded list of whitespace characters in HasUsableGlyph to prevent unnecessary font fallback for characters without visible outlines, such as U+3000.
henry3260
reviewed
Nov 26, 2026
| private static bool HasUsableGlyph(byte[] ttf, int codePoint, ushort gid) | ||
| { | ||
| if (codePoint is ' ' or 0x00A0 or 0x2009) return true; | ||
| if (codePoint <= char.MaxValue && char.IsWhiteSpace((char)codePoint)) return true; |
Member
There was a problem hiding this comment.
Could we add a regression test for this? For example, a text block with U+3000 and a preferred font whose U+3000 glyph has no outline, asserting that only the preferred font is embedded. If there is no suitable font available in CI, a before/after file size in the PR description is fine too.
This branch has not been deployed
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.
Problem
HasUsableGlyphrecognizes only three whitespace characters as valid glyphs without outlines. As a result, an ideographic space (U+3000) can trigger unnecessary font fallback even when the preferred TrueType font supports it.In my case, converting a six-page Japanese Excel report to PDF produced a 14 MB file because MiniPdf embedded the entire Noto Sans CJK JP font alongside IPAexGothic and IPAexMincho.
Inspecting the embedded font's ToUnicode CMap confirmed that U+3000 was the only character assigned to Noto Sans CJK JP.
Solution
Replace the hardcoded whitespace check with
char.IsWhiteSpace, allowing Unicode whitespace characters to use their existing glyphs without requiring visible outlines.This preserves the intended font selection and avoids unnecessary font embedding.
Summary by CodeRabbit