Repository navigation
PDF: lay each day out along a rail with transport mode icons - #111
Merged
Merged
Conversation
The itinerary in the PDF now reads like the app's timeline: a rail per day, places as dots in the trip's accent, legs as their mode's icon in a disc. The icon is the one this database gives the mode, so an icon chosen for a built-in reaches the paper too; the bundle only carries custom ones. Flutter's Material Icons font is CFF-based and package:pdf parses TrueType only, so build_pdf_icons.py converts the transport icons out of the SDK's own font into MaterialIconsPdf.ttf (CC BY 4.0, ~8 KB). Both icon fonts wrote a left side bearing of 0 into hmtx, which a TrueType renderer reads as an origin at xMin, drawing each glyph shifted left. That also put the app's horse and lift icons up to 15% of their size off center; TransportGlyphs.ttf is rebuilt with lsb = xMin, and a test guards both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
The itinerary in the PDF export now reads like the app's timeline. Each day is a rail with places as dots in the trip's accent and legs as their transport mode's icon in a disc. The mode's name stays in the text.
What changed
trip_pdf.dart): each row draws its own piece of the rail, from a day's first node to its last. A decision's accent bar is drawn per row in the text column, so the rail runs past it unbroken.transportModeIconsByKey, read by the export). That includes an icon chosen for a built-in, which a bundle does not carry.pdfTransportModeIconfalls back to the bundle's custom-mode icon, then to the built-in's own.OTTO), and package:pdf parses TrueType only. It falls back to Latin-1 and throws on the code point.assets/fonts/build_pdf_icons.pytherefore converts exactly theIcons.*thattransport_mode.dartnames out of the SDK's own font intoMaterialIconsPdf.ttf(~8 KB). The font is CC BY 4.0; its attribution is registered on the license page.lsb = 0intohmtx, while the outlines start atxMin > 0. A TrueType renderer puts the origin atxMin − lsb, so each glyph was drawn shifted left. This affected the app too. Measured in Flutter's engine (flutter_test, Linux), the horse, gondola, chairlift and T-bar icons sat 8–15% of their size left of center; after rebuildingTransportGlyphs.ttfthey are exactly centered.Testing
kTransportModeIconshas a glyph in the font the PDF picks for it;lsb == xMinfor both fonts (fails on the oldTransportGlyphs.ttf); icon resolution order;transportModeIconsByKey; the icon font is embedded for a trip with a leg.flutter analyzeclean, full suite passes (1634).TripPdfFonts.load()loads both fonts through the real asset bundle.To check on a device (CI APK)
No new or changed strings, so nothing is missing from
app_zh.arb.SECURITY.mdis unaffected: no new host, permission or parsed foreign format.🤖 Generated with Claude Code