Claude commited on
Commit
0787d77
·
1 Parent(s): 1ef8428

Add per-team logos for team races + font-resolution diagnostics

Browse files

Two additive changes; no other theme's behavior changes.

Team logos (#1): team-mode races resolve bar imagery via _load_team_logo
-> PROJECT_ROOT/assets/logos/{ABBREV}.png, but hf_space/assets/logos/ held
only NBA_logo.png (the league logo for the title). Add all 30 per-team
PNGs so team races (Thunder/Spurs/Celtics/...) show their team logo at the
left of each bar. lookup_team already maps the bare nicknames to these
abbrev filenames; PR #2's `COPY assets/logos/ /assets/logos/` deploys them.

Font diagnostics (#2): _load_font silently fell back to PIL's tiny default
bitmap on any failure, which looks like a wrong, too-small typeface. Add
definitive logging that distinguishes the two failure modes:
- font_custom_dir MISSING [...] -> files absent (Poppins fallback)
- FONT LOAD FAILED ... (unknown file format) -> present but unreadable
(e.g. a 0-byte/empty or LFS-pointer file) -> PIL default bitmap
This makes the Futura load status explicit in the Space build log.

https://claude.ai/code/session_01CvFzavoj9JGA95bn1UvZJN

assets/logos/ATL.png ADDED

Git LFS Details

  • SHA256: 35739bdba58313c0bc6b41709f38e90bb06b18dfe0399a06a6b4e511d6e8036f
  • Pointer size: 130 Bytes
  • Size of remote file: 21.2 kB
assets/logos/BKN.png ADDED

Git LFS Details

  • SHA256: 3133664f96799a00c84a4b6fb326fbbcf31cad063d99354c5b9932c79649ea49
  • Pointer size: 130 Bytes
  • Size of remote file: 17.4 kB
assets/logos/BOS.png ADDED

Git LFS Details

  • SHA256: 28a4d24cf9eac090964bb24dc86eb40af53296daba00f53dd61334ef4285b606
  • Pointer size: 130 Bytes
  • Size of remote file: 22.5 kB
assets/logos/CHA.png ADDED

Git LFS Details

  • SHA256: 4a692e83a216a69443f403e83284ad41b7dc4318396f0c936f1c6204dfd6a991
  • Pointer size: 130 Bytes
  • Size of remote file: 40 kB
assets/logos/CHI.png ADDED

Git LFS Details

  • SHA256: c9c8d127ac6eacd521e4b759a822b4169856a45780fe70a275cad0b09d7d62a2
  • Pointer size: 130 Bytes
  • Size of remote file: 22.7 kB
assets/logos/CLE.png ADDED

Git LFS Details

  • SHA256: 3ba2fe7764699bb78e6e00fc2bece136529a36906f6baf302ca377600bdbfe63
  • Pointer size: 130 Bytes
  • Size of remote file: 18.6 kB
assets/logos/DAL.png ADDED

Git LFS Details

  • SHA256: f6f9a375940c76fb5a39268cfa00b71f565f404c053fd2b684670eba9624f282
  • Pointer size: 130 Bytes
  • Size of remote file: 35.4 kB
assets/logos/DEN.png ADDED

Git LFS Details

  • SHA256: 547622a913c2fe8e36e63aa847f35a223e72366fab1a586c0d39ba4012c471c8
  • Pointer size: 130 Bytes
  • Size of remote file: 37.1 kB
assets/logos/DET.png ADDED

Git LFS Details

  • SHA256: 5394680c0f55acbcf69780cbbacf63e98e9815d43d9c8e94ece0c3b0a2f6171f
  • Pointer size: 130 Bytes
  • Size of remote file: 37.1 kB
assets/logos/GSW.png ADDED

Git LFS Details

  • SHA256: 350af1fc66d90c759e9d4964740306f60e7cc708861cc4113aeebf4684081cbe
  • Pointer size: 130 Bytes
  • Size of remote file: 37.9 kB
assets/logos/HOU.png ADDED

Git LFS Details

  • SHA256: 3530e740d69c168d424aa91278936f116e8966f6d14d0afbb60abe769f7fead9
  • Pointer size: 130 Bytes
  • Size of remote file: 22.7 kB
assets/logos/IND.png ADDED

Git LFS Details

  • SHA256: 24fcdff4ed37a9c8bb78abd77ab4f093806176af6898228a46b9b49220c0ed91
  • Pointer size: 130 Bytes
  • Size of remote file: 27.3 kB
assets/logos/LAC.png ADDED

Git LFS Details

  • SHA256: 6685d9646a528a55e18c0dcb908b7221e3f760a1d2bc472d616fe9a09a16c7ca
  • Pointer size: 130 Bytes
  • Size of remote file: 28.2 kB
assets/logos/LAL.png ADDED

Git LFS Details

  • SHA256: f8c71464343b03eccb225fea4f6ffb5790bb70eb671c1e59527c15aa180bb50a
  • Pointer size: 130 Bytes
  • Size of remote file: 28 kB
assets/logos/MEM.png ADDED

Git LFS Details

  • SHA256: 0210ea0777a06c5ae34347007e672b1dcbe5c354505c09aed85a42316801560f
  • Pointer size: 130 Bytes
  • Size of remote file: 30.8 kB
assets/logos/MIA.png ADDED

Git LFS Details

  • SHA256: 415115389782becf59ed59b249a616bd1ab64055e5024e9efb00bf07655258ec
  • Pointer size: 130 Bytes
  • Size of remote file: 24.5 kB
assets/logos/MIL.png ADDED

Git LFS Details

  • SHA256: 9ff84f6a528cd7f2244e446c08cc23bd3bce8e1a9ba1f2f828b6568f8d182e4f
  • Pointer size: 130 Bytes
  • Size of remote file: 31.5 kB
assets/logos/MIN.png ADDED

Git LFS Details

  • SHA256: 958aea7fe4c9b8e4bdfceeba0185a9c968d36ab22be7f75f70ba07bb5d945345
  • Pointer size: 130 Bytes
  • Size of remote file: 39.5 kB
assets/logos/NOP.png ADDED

Git LFS Details

  • SHA256: ee9111b808f9a0caf2ad769dbc94d0642c58972b248d7ee7f3a0fc31f053ec51
  • Pointer size: 130 Bytes
  • Size of remote file: 26.8 kB
assets/logos/NYK.png ADDED

Git LFS Details

  • SHA256: c6b40c896056275ca86e61478455932db165b6f5b477628b76c0414ade572f96
  • Pointer size: 130 Bytes
  • Size of remote file: 41.6 kB
assets/logos/OKC.png ADDED

Git LFS Details

  • SHA256: 2bc39cefa8df505ef0a8ee576d887587fae4929106b773f9f5ba16d1ef61ec45
  • Pointer size: 130 Bytes
  • Size of remote file: 27.3 kB
assets/logos/ORL.png ADDED

Git LFS Details

  • SHA256: 02cc296ba9f4215439de9d0f8c2cf474e3187a383b55a7588aa23c9a1684b9a2
  • Pointer size: 130 Bytes
  • Size of remote file: 34.2 kB
assets/logos/PHI.png ADDED

Git LFS Details

  • SHA256: 55e423c8b8c948aa7e216e2983cfe26e006968cd4ac8ece366d2a5067456ae28
  • Pointer size: 130 Bytes
  • Size of remote file: 14.8 kB
assets/logos/PHX.png ADDED

Git LFS Details

  • SHA256: 777aaf2a9b173a78a62cd3f59c69207039c19d4615c54734f9532cfc54d914d8
  • Pointer size: 130 Bytes
  • Size of remote file: 20.3 kB
assets/logos/POR.png ADDED

Git LFS Details

  • SHA256: 3417f8d2f7f531edc5c2e6a02f3f48127523adde1729349e05e1180761dbae11
  • Pointer size: 130 Bytes
  • Size of remote file: 29.2 kB
assets/logos/SAC.png ADDED

Git LFS Details

  • SHA256: d7a7be80bc999106cc55135abbb710e3266ebdd4b2282b99a709b105f863527a
  • Pointer size: 130 Bytes
  • Size of remote file: 21.9 kB
assets/logos/SAS.png ADDED

Git LFS Details

  • SHA256: 3e18512b405628b363e05b53b1194c7b03659b1f26060be3596beea125eede0e
  • Pointer size: 130 Bytes
  • Size of remote file: 19.3 kB
assets/logos/TOR.png ADDED

Git LFS Details

  • SHA256: 885f140a324fe5f713a1f4f0f6b2a12a3a5d4d21196a261ca0bb048fa2fa91d5
  • Pointer size: 130 Bytes
  • Size of remote file: 12.8 kB
assets/logos/UTA.png ADDED

Git LFS Details

  • SHA256: f0abbc5053725f48c7326d49ed29cb385d2c91c8de3a4f1b5c4373131eb54e24
  • Pointer size: 130 Bytes
  • Size of remote file: 14.9 kB
assets/logos/WAS.png ADDED

Git LFS Details

  • SHA256: a00e04415ea568ff9ad7f864bc536d42967cb3090b99ed67116265d524008715
  • Pointer size: 130 Bytes
  • Size of remote file: 29.1 kB
bar_race/render.py CHANGED
@@ -260,7 +260,11 @@ def _resolve_font(family: str, weight: str) -> str:
260
  def _load_font(path: str, size: int) -> ImageFont.FreeTypeFont | ImageFont.ImageFont:
261
  try:
262
  return ImageFont.truetype(path, size)
263
- except (OSError, IOError):
 
 
 
 
264
  return ImageFont.load_default()
265
 
266
 
@@ -976,10 +980,17 @@ class FrameRenderer:
976
  all_found = False
977
  # If not all custom fonts found, fall back to standard resolution.
978
  if not all_found:
 
 
 
 
979
  bold_path = cfg.font_bold
980
  medium_path = cfg.font_medium
981
  regular_path = cfg.font_regular
982
  light_path = cfg.font_light
 
 
 
983
  # Override with font_family if config used defaults (auto-resolved).
984
  elif family != "sans":
985
  bold_path = _resolve_font(family, "bold")
 
260
  def _load_font(path: str, size: int) -> ImageFont.FreeTypeFont | ImageFont.ImageFont:
261
  try:
262
  return ImageFont.truetype(path, size)
263
+ except (OSError, IOError) as e:
264
+ # Definitive diagnostic: a present-but-unreadable file (e.g. a git-LFS
265
+ # pointer that never resolved) lands here and falls back to the tiny
266
+ # built-in bitmap font — which looks like a wrong, too-small typeface.
267
+ print(f"[render] FONT LOAD FAILED: {path!r} ({e}) -> PIL default bitmap")
268
  return ImageFont.load_default()
269
 
270
 
 
980
  all_found = False
981
  # If not all custom fonts found, fall back to standard resolution.
982
  if not all_found:
983
+ missing = [fn for fn in _custom_map.values()
984
+ if not (custom_dir / fn).is_file()]
985
+ print(f"[render] font_custom_dir {str(custom_dir)!r}: MISSING {missing} "
986
+ f"-> falling back to default fonts (Poppins/system)")
987
  bold_path = cfg.font_bold
988
  medium_path = cfg.font_medium
989
  regular_path = cfg.font_regular
990
  light_path = cfg.font_light
991
+ else:
992
+ print(f"[render] font_custom_dir {str(custom_dir)!r}: all 4 custom "
993
+ f"fonts present (bold={os.path.basename(bold_path)})")
994
  # Override with font_family if config used defaults (auto-resolved).
995
  elif family != "sans":
996
  bold_path = _resolve_font(family, "bold")