Files
NUEEX c00f689c49 License nueex's original work under GPL-3.0-or-later
Define explicit original, mixed and excluded file scope, credit nueex, and
preserve historical MIT grants and third-party notices. Keep libjbc's
redistribution permission unresolved and exclude third-party fonts, branding
and imagery from the original-work grant.

Retain the latest upstream build fixes and removal of obsolete tools.
Application/build edits are licensing comments only; the production ELF and
all 35 object files match the baseline byte for byte. No binaries or release
artifacts are included.
2026-10-26 16:47:23 +00:00

24 lines
1.1 KiB
Python

# PS MTP Explorer
# Original Author: nueex
# Copyright (C) 2026 nueex
# SPDX-License-Identifier: GPL-3.0-or-later
# GNU GPL version 3 or later; see LICENSE and LICENSING.md.
# WITHOUT ANY WARRANTY; see LICENSE.
# Historical MIT permissions/notices: LICENSES/MIT-legacy.txt.
"""Embed the pinned OFL Noto Sans font; no runtime font-file dependency."""
from pathlib import Path
import hashlib
ROOT=Path(__file__).resolve().parents[1]
FONT=ROOT/'assets/fonts/NotoSans-Light.ttf'
EXPECTED='74ffdd438f2ae232371ceb00444dae93e2590d263a4ff4c5e2c8385aa8012fdb'
def embed():
data=FONT.read_bytes()
if hashlib.sha256(data).hexdigest()!=EXPECTED: raise ValueError('Bundled font changed; review before embedding')
out='/* Generated from the bundled OFL font. See assets/fonts/OFL.txt. */\nstatic const unsigned char psmtp_font_data[]={\n'
out+=''.join(','.join(str(v) for v in data[i:i+32])+',\n' for i in range(0,len(data),32))+'};\n'
target=ROOT/'src/ps4/font_data.inc'
if not target.exists() or target.read_text()!=out: target.write_text(out,encoding='ascii')
return target
if __name__=='__main__':print(embed())