[Scummvm-git-logs] scummvm master -> ca960c61c2d0bb58dfa568f4d04a35ff27a54719

sev- noreply at scummvm.org
Tue Jul 12 12:08:38 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ca960c61c2 DEVTOOLS: COMPANION: Initial code for extracting classic mac fonts


Commit: ca960c61c2d0bb58dfa568f4d04a35ff27a54719
    https://github.com/scummvm/scummvm/commit/ca960c61c2d0bb58dfa568f4d04a35ff27a54719
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-07-12T14:08:04+02:00

Commit Message:
DEVTOOLS: COMPANION: Initial code for extracting classic mac fonts

Changed paths:
    devtools/dumper-companion.py


diff --git a/devtools/dumper-companion.py b/devtools/dumper-companion.py
index 2bd456e540c..ebf3b9160e2 100755
--- a/devtools/dumper-companion.py
+++ b/devtools/dumper-companion.py
@@ -24,6 +24,7 @@ from pathlib import Path
 from struct import pack, unpack
 from typing import Any, ByteString, List, Tuple
 import unicodedata
+import urllib.request
 
 import machfs
 
@@ -189,6 +190,13 @@ def file_to_macbin(f: machfs.File, name: ByteString) -> bytes:
 
     return macbin
 
+def macbin_get_datafork(f: bytes) -> bytes:
+    header = unpack(">x64p4s4sBxHHHBxIIIIHB14xIHBB", f[0:124])
+
+    print("Data len is:", header[8])
+
+    return f[128:128 + header[8]]
+
 
 def escape_string(s: str) -> str:
     """
@@ -550,6 +558,21 @@ def collect_forks(args: argparse.Namespace) -> int:
     return 0
 
 
+def create_macfonts(args: argparse.Namespace) -> int:
+    """
+    Downloads System 7 image, extracts fonts from it and packs them
+    int classicmacfonts.dat
+    """
+    print("Downloading System 7.0.1 image...", end="")
+    with urllib.request.urlopen("https://download.info.apple.com/Apple_Support_Area/Apple_Software_Updates/English-North_American/Macintosh/System/Older_System/System_7.0.x/System_7.0.1.smi.bin") as file:
+        output = file.read()
+        print('done')
+
+    datafork = macbin_get_datafork(output)
+
+    return 0
+
+
 def generate_parser() -> argparse.ArgumentParser:
     """
     Generate the parser
@@ -624,6 +647,12 @@ def generate_parser() -> argparse.ArgumentParser:
         )
         parser_macbinary.set_defaults(func=collect_forks)
 
+    parser_macfonts = subparsers.add_parser(
+        "createmacfonts",
+        help="Creates classicmacfonts.dat from Mac OS 7 system images"
+    )
+    parser_macfonts.set_defaults(func=create_macfonts)
+
     return parser
 
 




More information about the Scummvm-git-logs mailing list