Track Unity source, scenes, editable assets, licenses, tools and QA evidence. Exclude generated caches, Windows builds and raw runtime logs.
56 lines
2.4 KiB
Python
56 lines
2.4 KiB
Python
"""Archive the installed, unmodified OFL font with its embedded legal metadata."""
|
|
import hashlib
|
|
import json
|
|
import shutil
|
|
import struct
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
SOURCE = Path('C:/Windows/Fonts/NotoSansSC-VF.ttf')
|
|
LICENSE = Path('D:/vibeCoding/blender/Blender 4.5/license/spdx/OFL-1.1.txt')
|
|
|
|
|
|
def main():
|
|
data = SOURCE.read_bytes()
|
|
tables = {}
|
|
for i in range(struct.unpack_from('>H', data, 4)[0]):
|
|
tag, _, offset, _ = struct.unpack_from('>4sIII', data, 12 + 16 * i)
|
|
tables[tag] = offset
|
|
start = tables[b'name']
|
|
_, count, strings = struct.unpack_from('>HHH', data, start)
|
|
names = {}
|
|
for i in range(count):
|
|
platform, _, _, name, size, offset = struct.unpack_from('>6H', data, start + 6 + 12 * i)
|
|
if platform == 3:
|
|
names[str(name)] = data[start + strings + offset:start + strings + offset + size].decode('utf-16-be')
|
|
assert 'SIL Open Font License, Version 1.1' in names['13']
|
|
archive = ROOT / 'SourceAssets/ThirdParty/Adobe/NotoSansSC'
|
|
imported = ROOT / 'Assets/ThirdParty/Adobe/NotoSansSC'
|
|
legal = ROOT / 'Docs/Production/Licenses/Adobe/NotoSansSC'
|
|
for target in (archive, imported, legal):
|
|
target.mkdir(parents=True, exist_ok=True)
|
|
for target in (archive, imported):
|
|
shutil.copyfile(SOURCE, target / SOURCE.name)
|
|
copyright_text = names['0']
|
|
license_text = copyright_text + '\n\n' + LICENSE.read_text(encoding='utf-8')
|
|
for target in (archive, imported, legal):
|
|
(target / 'OFL.txt').write_text(license_text, encoding='utf-8')
|
|
provenance = {
|
|
'archived': '2026-11-12',
|
|
'source': str(SOURCE),
|
|
'canonicalProject': 'https://github.com/notofonts/noto-cjk',
|
|
'canonicalLicense': 'https://openfontlicense.org/open-font-license-official-text/',
|
|
'retrieval': 'Locally installed unmodified font. Public HTTPS retrieval failed; license identified in embedded name records 13/14.',
|
|
'sha256': hashlib.sha256(data).hexdigest(),
|
|
'bytes': len(data),
|
|
'embeddedNames': names,
|
|
'fullLicenseSource': str(LICENSE),
|
|
'modifications': 'None to source font; Unity generates a project font atlas.'
|
|
}
|
|
(legal / 'Provenance.json').write_text(json.dumps(provenance, ensure_ascii=False, indent=2), encoding='utf-8')
|
|
print(json.dumps({k: provenance[k] for k in ('sha256', 'bytes')}, indent=2))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|