Skip to content

Fix pixel-font text clipping and refine Trade Corner search#48

Open
fsegouin wants to merge 1 commit into
REONTeam:mainfrom
fsegouin:feat/pixel-font-rendering-and-search
Open

Fix pixel-font text clipping and refine Trade Corner search#48
fsegouin wants to merge 1 commit into
REONTeam:mainfrom
fsegouin:feat/pixel-font-rendering-and-search

Conversation

@fsegouin

Copy link
Copy Markdown
Contributor

Summary

  • Corrects the PokeCrystal font's vertical metrics so pixel text no longer clips at the top of card and table rows, in Chrome and Safari.
  • Fixes horizontal clipping of Trade Corner cards at 2x zoom in Safari (a zoom + ch interaction).
  • Adds clickable shiny / pokerus / gender filter chips to the Trade Corner search, and keeps the search field a fixed height when a filter is added.
  • Removes redundant !important from pokecrystal-pages.css.

Details

Font clipping. The .ttf declared ascent 0.75em / descent 0.25em, but the glyph ink runs from 0.875em above the baseline to 0.125em below it, so every line-height: 1 row shaved the top pixel off capitals. The metrics are corrected in the font itself (hhea, OS/2 typo and win, with USE_TYPO_METRICS set), so it renders correctly in every browser with no per-element CSS overrides.

Safari 2x. Under the CSS zoom property Safari resolves ch against the already-zoomed font size, so ch-based card widths and offsets over-scaled and pushed labels under the sprite. The zoomed card metrics and the Battle Tower list padding are converted from ch to pixels (this font is fixed-width, so 1ch = 8px).

Search UX. Shiny and pokerus render as an in-box × glyph (blank when off); gender shows ♂/♀ and toggles on click. The search field is pinned to the height of a single-chip row, so adding a filter no longer resizes it.

Cleanup. Stripping every !important and diffing computed styles across all four pixel-font pages (Trade Corner, Battle Tower, Rankings, Save Converter) showed that only card-internal font sizes actually depended on them; those are restored with two tightly-scoped rules. The !important inside @media blocks are left untouched.

Testing

Checked in Chrome and Safari: card, table and search text render without clipping at 1x and 2x; the four pixel-font pages are pixel-identical (computed-style and font-histogram diffs) to before the !important removal; the search field holds a fixed height when filters are added; and the shiny/pokerus/gender chips filter results correctly.

Screenshot 2026-07-17 at 09 01 00 Screenshot 2026-07-17 at 09 01 06 image

The bundled pixel font declared vertical metrics that did not match its glyph
outlines, so capital letters overshot the top of every line-height:1 row and
were clipped. Correct the font's ascent, descent and line gap so the ink sits
inside the em box.

Safari resolves ch against the already-zoomed font size under the CSS zoom
property, which over-shifted card text and clipped it at 2x. Replace the zoomed
card and Battle Tower metrics that used ch with their pixel values.

Add clickable shiny, pokerus and gender chips to the search, hold the search
field at a fixed height when a filter is applied, and drop pokecrystal-pages
!important declarations that were not overriding anything.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant