Raster x3, gemalte Register, Ortsbild-Schleife
Basis 1920x1080 mit Kachel 96 (Phase 0.5): Assets, Daten-ids, Engine, Theme und Pruefungen umgestellt; alte 32-px-Master im Archiv. Boden, Dach und Haus gezeichnet statt generiert (boden.py, dach.py) — FLUX-Kacheln hatten nach --flatten nur zwei Farben. Schrift neu in Zielaufloesung (font16.py, 12x16 entworfen, x2 exportiert, proportionaler Vorschub). Zwei Register: gemaltes Ortsbild mit Hotspots und Kachelgebiet mit gemalten Figuren, verbunden ueber einen ScreenManager. Die Schleife ist ohne Fenster geprueft (tools/probe_schleife.tscn). Dokumentation: darstellung.md (Regeln), stand.md (Uebergabe), Beweise unter art/prep/ (terrain-96, kacheltest, stadt-gemalt, schleife, stil-vergleich).
This commit is contained in:
parent
ae7fde714e
commit
43600009e5
571 changed files with 9402 additions and 1700 deletions
|
|
@ -8,6 +8,8 @@ Werkzeug schreibt beides in `final/Font/`:
|
|||
font8_10.fnt BMFont-Textformat, Zeigt auf die 1x-Textur
|
||||
font8_10_2x.fnt dasselbe in 2x (eigene Textur, eigene Metriken)
|
||||
font8_10_atlas_2x.png
|
||||
font8_10_3x.fnt 3x-Fassung fuer die 1920x1080-Basis (Vorschub 24,
|
||||
font8_10_atlas_3x.png Zeile 36)
|
||||
|
||||
python3 tools/font_export.py # schreiben + pruefen
|
||||
python3 tools/font_export.py --check # nur pruefen
|
||||
|
|
@ -30,11 +32,18 @@ from pathlib import Path
|
|||
from PIL import Image, ImageDraw
|
||||
|
||||
ART = Path(__file__).resolve().parent.parent
|
||||
BASIS = "font8_10"
|
||||
sys.path.insert(0, str(ART / "tools"))
|
||||
import font8 # noqa: E402
|
||||
import importlib # noqa: E402
|
||||
|
||||
ZELLE_W = 8 # Atlas-Zelle: 6 Spalten Glyphe + 2 Spalten Luft
|
||||
ZELLE_H = font8.ROWS # 10
|
||||
# Skalen, die exportiert und geprueft werden. Seit 15.11.2026 auch 3x, weil die
|
||||
# Basisaufloesung auf 1920x1080 gewachsen ist (docs/roadmap.md, Raster-Entscheid).
|
||||
SKALEN = (1, 2, 3)
|
||||
|
||||
font8 = importlib.import_module("font8") # Standard; --font waehlt anders
|
||||
ZELLE_W = font8.ZELLE_W
|
||||
ZELLE_H = font8.ZELLE_H
|
||||
RAND = (font8.ZELLE_W - font8.COLS) // 2 # linker Vorlauf in der Zelle
|
||||
SPALTEN = 16 # Glyphen pro Atlas-Zeile
|
||||
|
||||
|
||||
|
|
@ -51,9 +60,7 @@ def atlas(scale: int = 1) -> tuple[Image.Image, dict[str, tuple[int, int]]]:
|
|||
for row, zeile in enumerate(font8.GLYPHS[ch].split("/")):
|
||||
for col, p in enumerate(zeile):
|
||||
if p == "#":
|
||||
# +1: font8.draw_text setzt die Glyphe auf x+rx+1, also mit
|
||||
# 1 px linkem Vorlauf in der 8-px-Zelle.
|
||||
px[gx + col + 1, gy + row] = (255, 255, 255, 255)
|
||||
px[gx + col + RAND, gy + row] = (255, 255, 255, 255)
|
||||
if scale > 1:
|
||||
im = im.resize((im.width * scale, im.height * scale), Image.NEAREST)
|
||||
return im, pos
|
||||
|
|
@ -66,7 +73,7 @@ def fnt(scale: int, bild: str) -> str:
|
|||
zeilen = [
|
||||
f'info face="taloria8" size={font8.ROWS * s} bold=0 italic=0 charset="" '
|
||||
f"unicode=1 stretchH=100 smooth=0 aa=1 padding=0,0,0,0 spacing=0,0 outline=0",
|
||||
f"common lineHeight={font8.LINE * s} base={8 * s} scaleW={SPALTEN * ZELLE_W * s} "
|
||||
f"common lineHeight={font8.LINE * s} base={font8.BASE * s} scaleW={SPALTEN * ZELLE_W * s} "
|
||||
f"scaleH={(len(zeichen) + SPALTEN - 1) // SPALTEN * ZELLE_H * s} pages=1 "
|
||||
f"packed=0 alphaChnl=0 redChnl=4 greenChnl=4 blueChnl=4",
|
||||
f'page id=0 file="{bild}"',
|
||||
|
|
@ -74,9 +81,13 @@ def fnt(scale: int, bild: str) -> str:
|
|||
]
|
||||
for i, ch in enumerate(zeichen):
|
||||
gx, gy = (i % SPALTEN) * ZELLE_W * s, (i // SPALTEN) * ZELLE_H * s
|
||||
if hasattr(font8, "masse"):
|
||||
versatz, vorschub = font8.masse(ch)
|
||||
else:
|
||||
versatz, vorschub = 0, font8.ADVANCE
|
||||
zeilen.append(
|
||||
f"char id={ord(ch)} x={gx} y={gy} width={ZELLE_W * s} height={ZELLE_H * s} "
|
||||
f"xoffset=0 yoffset=0 xadvance={font8.ADVANCE * s} page=0 chnl=15")
|
||||
f"xoffset={versatz * s} yoffset=0 xadvance={vorschub * s} page=0 chnl=15")
|
||||
return "\n".join(zeilen) + "\n"
|
||||
|
||||
|
||||
|
|
@ -119,7 +130,7 @@ def alle_zeichen(pro_zeile: int = 40) -> list[str]:
|
|||
|
||||
def pruefen(out: Path, skalierung: int = 1) -> list[str]:
|
||||
probe = alle_zeichen()
|
||||
name = "font8_10.fnt" if skalierung == 1 else "font8_10_2x.fnt"
|
||||
name = f"{BASIS}{'' if skalierung == 1 else f'_{skalierung}x'}.fnt"
|
||||
f = lies_fnt(out / name)
|
||||
|
||||
breite = max(font8.text_width(t) for t in probe) + 8
|
||||
|
|
@ -140,15 +151,25 @@ def main(argv: list[str] | None = None) -> int:
|
|||
ap = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
||||
ap.add_argument("--check", action="store_true", help="nur pruefen")
|
||||
ap.add_argument("--out", type=Path, default=ART / "final" / "Font")
|
||||
ap.add_argument("--font", default="font8", choices=["font8", "font12", "font16"])
|
||||
ap.add_argument("--scale", type=int, default=0, help="0 = alle (font8: 1/2/3)")
|
||||
a = ap.parse_args(argv)
|
||||
global font8, BASIS, ZELLE_W, ZELLE_H, RAND
|
||||
font8 = importlib.import_module(a.font)
|
||||
BASIS = {"font8": "font8_10", "font12": "font12_9", "font16": "font16_12"}[a.font]
|
||||
ZELLE_W, ZELLE_H = font8.ZELLE_W, font8.ZELLE_H
|
||||
RAND = (font8.ZELLE_W - font8.COLS) // 2
|
||||
global SKALEN
|
||||
SKALEN = (a.scale,) if a.scale else {"font8": (1, 2, 3), "font12": (6,), "font16": (2,)}[a.font]
|
||||
out = a.out
|
||||
|
||||
if not a.check:
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
for s in (1, 2):
|
||||
for s in SKALEN:
|
||||
bild, _ = atlas(s)
|
||||
png = f"font8_10_atlas{'' if s == 1 else '_2x'}.png"
|
||||
fntname = f"font8_10{'' if s == 1 else '_2x'}.fnt"
|
||||
endung = "" if s == 1 else f"_{s}x"
|
||||
png = f"{BASIS}_atlas{endung}.png"
|
||||
fntname = f"{BASIS}{endung}.fnt"
|
||||
bild.save(out / png)
|
||||
(out / fntname).write_text(fnt(s, png))
|
||||
print(f" {png:26s} {bild.width}x{bild.height}")
|
||||
|
|
@ -170,7 +191,9 @@ def main(argv: list[str] | None = None) -> int:
|
|||
bild_out / "_bmfont_probe_2x.png")
|
||||
print(f" {bild_out}/_bmfont_probe.png (aus der .fnt gesetzt)")
|
||||
|
||||
fehler = pruefen(out, 1) + pruefen(out, 2)
|
||||
fehler = []
|
||||
for s in SKALEN:
|
||||
fehler += pruefen(out, s)
|
||||
for f in fehler:
|
||||
print(" ", f, file=sys.stderr)
|
||||
print("\nPruefung:", "bestanden" if not fehler else "FEHLGESCHLAGEN")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue