mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 08:39:57 -04:00
Let the launcher replace a cached font file it has registered.
A font file registered with Windows stays open, so writing it failed with Permission denied. When the cached title font was registered but its family could not be used, every start tried to decode it again, failed on the locked file and kept the system font. The registration is now given up before the fonts are decoded again, and an unchanged file is not rewritten. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -1019,6 +1019,14 @@ class FontTest(Tmp):
|
||||
self.assertEqual(got['title'][1], 'DejaVu Sans')
|
||||
self.assertEqual(Path(got['title'][0]).read_bytes(), otf)
|
||||
self.assertEqual(gamefiles.cached_fonts(self.layout)['title'][1], 'DejaVu Sans')
|
||||
# Registered as a font, Windows keeps the file open: decoding it again must not fail on the unchanged file,
|
||||
# and once the registration is given up a file that went bad is replaced.
|
||||
path = Path(got['title'][0])
|
||||
winsys.register_font(path)
|
||||
self.assertEqual(gamefiles.extract_fonts(self.layout, self.tmp / 'game')['title'][1], 'DejaVu Sans')
|
||||
winsys.unregister_font(path)
|
||||
path.write_bytes(b'not a font')
|
||||
self.assertEqual(Path(gamefiles.extract_fonts(self.layout, self.tmp / 'game')['title'][0]).read_bytes(), otf)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- the button art of a release
|
||||
|
||||
Reference in New Issue
Block a user