This commit is contained in:
jeremygan2021
2026-03-03 23:31:06 +08:00
parent 0aa8f5f473
commit 20d2e72c51
10 changed files with 220 additions and 201 deletions

View File

@@ -54,9 +54,11 @@ class Font:
d = binascii.unhexlify(parts[2])
self.cache[c] = d
# 清除重试计数(如果有)
# 清除重试计数(如果有)和 pending
if c in self.retry_count:
del self.retry_count[c]
if c in self.pending_requests:
self.pending_requests.remove(c)
return True
except Exception as e:
print(f"Font data parse error: {e}")
@@ -110,6 +112,11 @@ class Font:
if wait:
print(f"Batch requesting fonts: {req_str}")
try:
# Add Pending requests to retry count to avoid spamming
for c in missing_list:
if c not in self.pending_requests:
self.pending_requests.add(c)
self.ws.send(f"GET_FONTS_BATCH:{req_str}")
if wait:
self._wait_for_fonts(missing_codes)