[226] Schriftfamilien im GPU-Text: Familie je Zeile im Szenenformat, Glyphen-Atlas je Familie/Schnitt lazy (WOFF2 in render2d), Messung mit denselben Metriken
This commit is contained in:
84 files changed
+1063
-31
No files matched your search
@@ -88,6 +88,8 @@ Die Rust-Abhängigkeiten werden mit cargo-deny geprüft (src-tauri/deny.toml, CI
|
|||||||
Schriften (public/fonts/*, je Ordner mit OFL.txt), SIL Open Font License 1.1, lokal gebündelt:
|
Schriften (public/fonts/*, je Ordner mit OFL.txt), SIL Open Font License 1.1, lokal gebündelt:
|
||||||
Archivo, DM Sans, IBM Plex Sans und IBM Plex Mono (IBM Corp.), Inter, Jost, Karla, Manrope, Outfit,
|
Archivo, DM Sans, IBM Plex Sans und IBM Plex Mono (IBM Corp.), Inter, Jost, Karla, Manrope, Outfit,
|
||||||
Public Sans, Rubik, Source Sans 3 und Source Serif 4 (Adobe), Space Grotesk, Work Sans.
|
Public Sans, Rubik, Source Sans 3 und Source Serif 4 (Adobe), Space Grotesk, Work Sans.
|
||||||
|
[226] Dieselben Dateien liest auch der GPU-Glyphen-Pass (render2d); die WOFF2-Container sind ohne Transformation
|
||||||
|
neu gepackt (fontTools, Schriftdaten unverändert), die Breitentabellen im Kern (core/src/text_metrics.rs) stammen aus ihrer Tabelle hmtx.
|
||||||
|
|
||||||
Website (website/static/fonts, Lizenztexte OFL-*.txt daneben), SIL Open Font License 1.1, Quelle google/fonts:
|
Website (website/static/fonts, Lizenztexte OFL-*.txt daneben), SIL Open Font License 1.1, Quelle google/fonts:
|
||||||
Schibsted Grotesk (The Schibsted-Grotesk Project Authors), Schnitte 600 und 800, auf Latein beschnitten;
|
Schibsted Grotesk (The Schibsted-Grotesk Project Authors), Schnitte 600 und 800, auf Latein beschnitten;
|
||||||
|
|||||||
@@ -79,6 +79,18 @@ Kennwort, anonym) als PDF; Austausch mit Fachplanern über DXF/IFC.
|
|||||||
- Datensicherheit: Speichern/Autosave/Wiederherstellen auf dem Mac ([116]), Öffnen alter Beispielstände, kein Kern-Panic im Ablauf.
|
- Datensicherheit: Speichern/Autosave/Wiederherstellen auf dem Mac ([116]), Öffnen alter Beispielstände, kein Kern-Panic im Ablauf.
|
||||||
|
|
||||||
### Phase 2 (20.–26.11.): Wettbewerb lückenlos
|
### Phase 2 (20.–26.11.): Wettbewerb lückenlos
|
||||||
|
- ◐ **[226]** Schriftfamilien im GPU-Text (13.11., Nachfolger [218]/[194]): Der Glyphen-Pass (`render2d/src/glyph.rs`, WebGPU und Metal) kannte nur
|
||||||
|
Inter; die in Stempel/Textfeldern gewählte Familie wirkte nur in SVG/PDF/DXF. **Stand 13.11.:** Szenenformat: Familien-Kennung (Index in
|
||||||
|
`TEXT_FONTS` + 1, 0 = Inter) ab Bit 16 des Text-Codes (`plan/scene.rs`, `plan_screen_texts`, `scene_bin.rs`, `text_lines.rs`; Kern
|
||||||
|
`text_layout::font_family_id`, Test gleicht mit `src/text/fontList.ts` ab). Atlas je Familie/Schnitt lazy: `GlyphText::needed_fonts` →
|
||||||
|
Webview lädt `/fonts/<slug>/…woff2` (`src/text/glyphFonts.ts`, `wasmRendererSession`) → `add_font`; render2d entpackt WOFF2 selbst
|
||||||
|
(`woff2.rs`, brotli-decompressor, nur untransformierte Pakete — die 56 Dateien in `public/fonts` wurden so neu gepackt). Rückfall Inter bei
|
||||||
|
fehlender Familie, bei fehlendem Schnitt (Manrope/Outfit/Space Grotesk kursiv) der aufrechte der Familie. Messung: `text_metrics.rs`
|
||||||
|
(erzeugt von `scripts/gen-text-metrics.py` aus `hmtx`, 4 Schnitte je Familie) über `text_width_em_in` für Stempelblock/Ausrichtung;
|
||||||
|
Inter und alle anderen Aufrufer (Masse, Marken) unverändert. Bildtest `headless::schriftfamilien_im_glyphen_pass` (Breite gezeichnet =
|
||||||
|
Breite gemessen ±4 %). Mac: `native2d_font`/`native2d_needed_fonts` (`lib.rs`, `native_embed.rs`, `useNativePlanRenderer.ts`) nach Muster
|
||||||
|
geschrieben, NICHT kompiliert/geprüft. **Offen:** Mac-Gegenprobe; je Zeile zählt nur die Familie des ersten Laufs (Mischzeilen); Textfelder
|
||||||
|
mit Drehung (Vektor-Glyphen `vtext.rs`, Systemschrift) und SVG-Overlay-Texte unverändert; Kerning nicht in der Kern-Messung. · S
|
||||||
- ◐ **[218]** Raumstempel bearbeiten im Objekteinstellungsfenster (13.11., Wunsch Maintainer): **Stand 13.11.:** Der Overlay-Dialog
|
- ◐ **[218]** Raumstempel bearbeiten im Objekteinstellungsfenster (13.11., Wunsch Maintainer): **Stand 13.11.:** Der Overlay-Dialog
|
||||||
(„Fenster im Fenster“, `RoomStampEditor`/`RoomStampEditorHost`, samt Alt-Rich-Text-Dialog `TextEditorDialog`) ist weg. Doppelklick auf einen
|
(„Fenster im Fenster“, `RoomStampEditor`/`RoomStampEditorHost`, samt Alt-Rich-Text-Dialog `TextEditorDialog`) ist weg. Doppelklick auf einen
|
||||||
Raumstempel (oder den Raum) wählt den Raum und öffnet die Objekteinstellungen mit dem neuen Abschnitt „Raumstempel“
|
Raumstempel (oder den Raum) wählt den Raum und öffnet die Objekteinstellungen mit dem neuen Abschnitt „Raumstempel“
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,53 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Vorschubbreiten der gebuendelten Schriften -> src-tauri/core/src/text_metrics.rs ([226]).
|
||||||
|
|
||||||
|
Liest public/fonts/<slug>/<slug>-<400|700>-<normal|italic>.woff2 (Reihenfolge der Familien wie
|
||||||
|
src/text/fontList.ts, Kennung = Index + 1; Inter bleibt bei den Tabellen in text_layout.rs) und schreibt
|
||||||
|
die Breiten (1/1000 em, Tabelle `hmtx`) fuer U+0020-U+007E, U+00A0-U+00FF und einige Satzzeichen.
|
||||||
|
Aufruf: python3 scripts/gen-text-metrics.py (braucht fontTools + brotli)
|
||||||
|
"""
|
||||||
|
import re, os
|
||||||
|
from fontTools.ttLib import TTFont
|
||||||
|
|
||||||
|
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
src = open(os.path.join(root, "src/text/fontList.ts")).read()
|
||||||
|
names = re.findall(r'^\s+"([^"]+)",$', src.split("TEXT_FONTS: string[] = [")[1].split("];")[0], re.M)
|
||||||
|
CHARS = list(range(0x20, 0x7F)) + list(range(0xA0, 0x100)) + [0x2013, 0x2014, 0x2026, 0x20AC, 0x2018, 0x2019, 0x201A, 0x201C, 0x201D, 0x201E]
|
||||||
|
|
||||||
|
def widths(path):
|
||||||
|
f = TTFont(path)
|
||||||
|
cmap = f.getBestCmap()
|
||||||
|
hmtx = f["hmtx"]
|
||||||
|
upem = f["head"].unitsPerEm
|
||||||
|
out = []
|
||||||
|
for c in CHARS:
|
||||||
|
g = cmap.get(c)
|
||||||
|
out.append(round(hmtx[g][0] * 1000 / upem) if g else 0) # 0 = Zeichen fehlt in der Schrift
|
||||||
|
return out
|
||||||
|
|
||||||
|
rows = []
|
||||||
|
for i, name in enumerate(names):
|
||||||
|
if i == 0:
|
||||||
|
continue # Inter: Tabellen in text_layout.rs
|
||||||
|
slug = name.lower().replace(" ", "-")
|
||||||
|
for style in range(4): # Bit 0 fett, Bit 1 kursiv
|
||||||
|
w = "700" if style & 1 else "400"
|
||||||
|
it = "italic" if style & 2 else "normal"
|
||||||
|
p = os.path.join(root, f"public/fonts/{slug}/{slug}-{w}-{it}.woff2")
|
||||||
|
if not os.path.exists(p): # z. B. Manrope kursiv: wie aufrecht (so zeichnet auch der Glyphen-Pass)
|
||||||
|
p = os.path.join(root, f"public/fonts/{slug}/{slug}-{w}-normal.woff2")
|
||||||
|
rows.append((name, style, widths(p)))
|
||||||
|
|
||||||
|
out = ["// ERZEUGT von scripts/gen-text-metrics.py ([226]) — nicht von Hand aendern.",
|
||||||
|
"// Vorschubbreiten (1/1000 em) der gebuendelten Schriften ausser Inter (public/fonts, SIL OFL 1.1, s. NOTICE):",
|
||||||
|
"// Zeile = (Kennung - 2) * 4 + Schnitt (Bit 0 fett, Bit 1 kursiv), Spalten = `CHARS`; 0 = Zeichen fehlt.",
|
||||||
|
f"pub const N_CHARS: usize = {len(CHARS)};",
|
||||||
|
"/// Zeichen der Spalten: U+0020-007E, U+00A0-00FF, dann Satzzeichen.",
|
||||||
|
"pub const EXTRA_CHARS: [u32; 10] = [0x2013, 0x2014, 0x2026, 0x20AC, 0x2018, 0x2019, 0x201A, 0x201C, 0x201D, 0x201E];",
|
||||||
|
f"pub static WIDTHS: [[u16; N_CHARS]; {len(rows)}] = ["]
|
||||||
|
for name, style, w in rows:
|
||||||
|
out.append(f" // {name}, Schnitt {style}")
|
||||||
|
out.append(" [" + ", ".join(map(str, w)) + "],")
|
||||||
|
out.append("];")
|
||||||
|
open(os.path.join(root, "src-tauri/core/src/text_metrics.rs"), "w").write("\n".join(out) + "\n")
|
||||||
|
print(len(rows), "Tabellen")
|
||||||
Generated
+1
@@ -3994,6 +3994,7 @@ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
|
|||||||
name = "render2d"
|
name = "render2d"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"brotli-decompressor",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"console_error_panic_hook",
|
"console_error_panic_hook",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ pub mod reorder;
|
|||||||
pub use dossier_hatch::ugrid;
|
pub use dossier_hatch::ugrid;
|
||||||
pub mod wasm_alloc;
|
pub mod wasm_alloc;
|
||||||
pub mod text_layout;
|
pub mod text_layout;
|
||||||
|
pub mod text_metrics;
|
||||||
pub mod grips;
|
pub mod grips;
|
||||||
pub mod grip_drag;
|
pub mod grip_drag;
|
||||||
pub mod sheet_height;
|
pub mod sheet_height;
|
||||||
|
|||||||
@@ -682,6 +682,8 @@ pub struct SText {
|
|||||||
pub align: u32,
|
pub align: u32,
|
||||||
/// Schnitt der Zeile ([194], erster Lauf): Bit 0 fett, Bit 1 kursiv.
|
/// Schnitt der Zeile ([194], erster Lauf): Bit 0 fett, Bit 1 kursiv.
|
||||||
pub style: u32,
|
pub style: u32,
|
||||||
|
/// Schriftfamilie ([226]): 0 = Inter, sonst `text_layout::font_family_id`.
|
||||||
|
pub family: u32,
|
||||||
pub content: Vec<u8>,
|
pub content: Vec<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -791,7 +793,7 @@ pub fn encode_scene_bin(s: &Scene, texts: &[SText]) -> Vec<u8> {
|
|||||||
for t in texts {
|
for t in texts {
|
||||||
f(&mut rec, t.size_mm);
|
f(&mut rec, t.size_mm);
|
||||||
// Ausrichtung im unteren Byte, Schnitt darüber ([194], `render2d/src/scene_bin.rs`).
|
// Ausrichtung im unteren Byte, Schnitt darüber ([194], `render2d/src/scene_bin.rs`).
|
||||||
u(&mut rec, t.align | (t.style << 8));
|
u(&mut rec, t.align | (t.style << 8) | (t.family << 16));
|
||||||
u(&mut rec, strs.len() as u32);
|
u(&mut rec, strs.len() as u32);
|
||||||
u(&mut rec, t.content.len() as u32);
|
u(&mut rec, t.content.len() as u32);
|
||||||
col(&mut rec, &t.color);
|
col(&mut rec, &t.color);
|
||||||
@@ -890,7 +892,7 @@ mod tests {
|
|||||||
lines: vec![SLine { a: v2(0.0, 0.0), b: v2(2600000.5, 1200000.25), color: [0.0, 0.5, 0.0, 1.0], width_mm: 0.35, dash: SDash::List(vec![3.0, 1.0, 0.5, 1.0]), z: 4.0 }],
|
lines: vec![SLine { a: v2(0.0, 0.0), b: v2(2600000.5, 1200000.25), color: [0.0, 0.5, 0.0, 1.0], width_mm: 0.35, dash: SDash::List(vec![3.0, 1.0, 0.5, 1.0]), z: 4.0 }],
|
||||||
line_ends: 0,
|
line_ends: 0,
|
||||||
};
|
};
|
||||||
let t = |x: f64, y: f64, content: &str, size_mm: f64, color: Rgba, align: u32| SText { pos: v2(x, y), size_mm, color, align, style: 0, content: content.as_bytes().to_vec() };
|
let t = |x: f64, y: f64, content: &str, size_mm: f64, color: Rgba, align: u32| SText { pos: v2(x, y), size_mm, color, align, style: 0, family: 0, content: content.as_bytes().to_vec() };
|
||||||
let texts = vec![
|
let texts = vec![
|
||||||
t(1.0, 2.0, "Küche 12,5 m²", 2.5, [0.0, 0.0, 0.0, 1.0], 1),
|
t(1.0, 2.0, "Küche 12,5 m²", 2.5, [0.0, 0.0, 0.0, 1.0], 1),
|
||||||
t(3.0, 4.0, "", 2.0, [0.0, 0.0, 0.0, 1.0], 2),
|
t(3.0, 4.0, "", 2.0, [0.0, 0.0, 0.0, 1.0], 2),
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use crate::plan::buf::{whole, T_DRAWING_TEXT, T_TEXT};
|
|||||||
use crate::plan::dxf::{StampLine as DxfLine, TextIn, TextStyleIn};
|
use crate::plan::dxf::{StampLine as DxfLine, TextIn, TextStyleIn};
|
||||||
use crate::plan::parts::{in_ranges, Part};
|
use crate::plan::parts::{in_ranges, Part};
|
||||||
use crate::plan::scene::{to_rgba, Rgba, SText, STYLE_BOLD, STYLE_ITALIC};
|
use crate::plan::scene::{to_rgba, Rgba, SText, STYLE_BOLD, STYLE_ITALIC};
|
||||||
use crate::text_layout::{doc_from_text, font_name_of, is_blank, plain_text, split_ws, stamp_block, stamp_line_offsets, wrap_doc_to_lines, LayoutOpts, LineAlign, Placed, PT_TO_MM, TEXT_LINE_HEIGHT_MULT};
|
use crate::text_layout::{doc_from_text, font_family_id, font_name_of, is_blank, plain_text, split_ws, stamp_block, stamp_line_offsets, wrap_doc_to_lines, LayoutOpts, LineAlign, Placed, PT_TO_MM, TEXT_LINE_HEIGHT_MULT};
|
||||||
use serde::{Deserialize, Deserializer};
|
use serde::{Deserialize, Deserializer};
|
||||||
|
|
||||||
fn num<'de, D: Deserializer<'de>>(d: D) -> Result<f64, D::Error> {
|
fn num<'de, D: Deserializer<'de>>(d: D) -> Result<f64, D::Error> {
|
||||||
@@ -119,8 +119,13 @@ fn greyed_color(c: Rgba, greyed: bool) -> Rgba {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn push(out: &mut Vec<SText>, x: f64, y: f64, content: String, size_mm: f64, color: Rgba, align: LineAlign, style: u32) {
|
fn push(out: &mut Vec<SText>, x: f64, y: f64, content: String, size_mm: f64, color: Rgba, align: LineAlign, style: u32, family: u32) {
|
||||||
out.push(SText { pos: crate::hatch::V2 { x, y }, size_mm, color, align: align.code(), style, content: content.into_bytes() });
|
out.push(SText { pos: crate::hatch::V2 { x, y }, size_mm, color, align: align.code(), style, family, content: content.into_bytes() });
|
||||||
|
}
|
||||||
|
|
||||||
|
/// [226] Schriftfamilie einer gesetzten Zeile aus ihrem ersten Lauf (0 = Inter, auch für nicht gebündelte Namen).
|
||||||
|
fn line_family(line: &crate::text_layout::Line) -> u32 {
|
||||||
|
font_family_id(line.tspans.first().and_then(|s| font_name_of(s.font_family.as_deref())).as_deref())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Schnitt einer gesetzten Zeile aus ihrem ersten Lauf (wie der DXF-Export, `stamp_lines`).
|
/// Schnitt einer gesetzten Zeile aus ihrem ersten Lauf (wie der DXF-Export, `stamp_lines`).
|
||||||
@@ -193,7 +198,7 @@ fn stamp_scene(t: &StampText, forced: bool, mm_to_m: f64, out: &mut Vec<SText>)
|
|||||||
let fill = line.tspans.first().map(|s| s.fill.as_str()).or(color);
|
let fill = line.tspans.first().map(|s| s.fill.as_str()).or(color);
|
||||||
let c = greyed_color(to_rgba(fill).unwrap_or(def), greyed);
|
let c = greyed_color(to_rgba(fill).unwrap_or(def), greyed);
|
||||||
let dx = offsets.get(k).copied().unwrap_or(0.0) * mm_to_m;
|
let dx = offsets.get(k).copied().unwrap_or(0.0) * mm_to_m;
|
||||||
push(out, t.at.x + dx, t.at.y - y * mm_to_m, content, line.max_size().unwrap_or(base_mm), c, line.align, line_style(line));
|
push(out, t.at.x + dx, t.at.y - y * mm_to_m, content, line.max_size().unwrap_or(base_mm), c, line.align, line_style(line), line_family(line));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,7 +222,7 @@ fn single_scene(t: &SingleText, forced: bool, mm_to_m: f64, out: &mut Vec<SText>
|
|||||||
let fill = line.tspans.first().map(|s| s.fill.as_str()).or(color);
|
let fill = line.tspans.first().map(|s| s.fill.as_str()).or(color);
|
||||||
let c = greyed_color(to_rgba(fill).unwrap_or(def), greyed);
|
let c = greyed_color(to_rgba(fill).unwrap_or(def), greyed);
|
||||||
let style = line_style(&line);
|
let style = line_style(&line);
|
||||||
push(out, t.at.x, t.at.y - dy, content, if unit_per_pt > 0.0 { size_m / mm_to_m } else { size_m }, c, line.align, style);
|
push(out, t.at.x, t.at.y - dy, content, if unit_per_pt > 0.0 { size_m / mm_to_m } else { size_m }, c, line.align, style, line_family(&line));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,6 +346,14 @@ mod tests {
|
|||||||
assert!((big[1].size_mm - 20.0 * PT_TO_MM).abs() < 1e-3, "{}", big[1].size_mm);
|
assert!((big[1].size_mm - 20.0 * PT_TO_MM).abs() < 1e-3, "{}", big[1].size_mm);
|
||||||
assert_eq!(big[1].style, STYLE_BOLD | STYLE_ITALIC);
|
assert_eq!(big[1].style, STYLE_BOLD | STYLE_ITALIC);
|
||||||
assert_eq!(big[1].color, [1.0, 0.0, 0.0, 1.0]);
|
assert_eq!(big[1].color, [1.0, 0.0, 0.0, 1.0]);
|
||||||
|
assert_eq!((plain[1].family, big[1].family), (0, 0));
|
||||||
|
// [226] Schriftfamilie der Zeile reist in die Szene: Serifenschrift = Kennung 15, Arial (nicht gebündelt) = Inter.
|
||||||
|
let serif = run(r##","marks":{"font":"'Source Serif 4', serif"}"##);
|
||||||
|
assert_eq!(serif[1].family, 15);
|
||||||
|
assert_eq!(run(r##","marks":{"font":"Arial"}"##)[1].family, 0);
|
||||||
|
// Block-Breite und Zeilenlage folgen der Metrik der gewählten Schrift (Serif ≠ Inter).
|
||||||
|
let (wide_inter, wide_serif) = (run(r##","marks":{"sizePt":30}"##), run(r##","marks":{"sizePt":30,"font":"Source Serif 4"}"##));
|
||||||
|
assert!((wide_serif[1].pos.x - wide_inter[1].pos.x).abs() > 1e-4, "{} {}", wide_serif[1].pos.x, wide_inter[1].pos.x);
|
||||||
// Grössere Zeile: der Block wird höher, die erste Grundlinie rückt nach oben (Modell-y nach oben).
|
// Grössere Zeile: der Block wird höher, die erste Grundlinie rückt nach oben (Modell-y nach oben).
|
||||||
assert!(big[0].pos.y > plain[0].pos.y);
|
assert!(big[0].pos.y > plain[0].pos.y);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -638,13 +638,64 @@ pub fn text_width_em(text: &str, bold: bool) -> f64 {
|
|||||||
w as f64 / 1000.0 * if bold { 1.05 } else { 1.0 }
|
w as f64 / 1000.0 * if bold { 1.05 } else { 1.0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// [226] Gebündelte Schriftfamilien in der Reihenfolge von `src/text/fontList.ts` (`TEXT_FONTS`; ein Test gleicht
|
||||||
|
/// beide ab). Kennung im Szenenformat = Index + 1, 0 = Inter/unbekannt (der Glyphen-Pass von render2d zeichnet
|
||||||
|
/// Inter, wenn eine Familie fehlt).
|
||||||
|
pub const FONT_FAMILIES: [&str; 15] = [
|
||||||
|
"Inter", "Work Sans", "IBM Plex Sans", "IBM Plex Mono", "Source Sans 3", "Space Grotesk", "Manrope", "Outfit", "DM Sans", "Public Sans", "Karla",
|
||||||
|
"Rubik", "Jost", "Archivo", "Source Serif 4",
|
||||||
|
];
|
||||||
|
|
||||||
|
/// [226] Kennung der gebündelten Familie zu einem Namen (ohne Beachtung der Gross-/Kleinschreibung); 0 für Inter,
|
||||||
|
/// keinen Namen und alles Unbekannte (Arial, Helvetica …).
|
||||||
|
pub fn font_family_id(name: Option<&str>) -> u32 {
|
||||||
|
let Some(n) = name else { return 0 };
|
||||||
|
match FONT_FAMILIES.iter().position(|f| f.eq_ignore_ascii_case(n.trim())) {
|
||||||
|
Some(0) | None => 0,
|
||||||
|
Some(i) => i as u32 + 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// [226] Breite eines Texts in em in der Schrift `family` (CSS-Familie oder Name; `None`/Inter/unbekannt: Inter,
|
||||||
|
/// [`text_width_em`]). Gleiche Metrik wie der Glyphen-Pass (Tabelle `hmtx` der gebündelten Datei, ohne Kerning),
|
||||||
|
/// damit Kasten und Freistellung zur gezeichneten Schrift passen. Zeichen ausserhalb der Tabelle:
|
||||||
|
/// [`CHAR_WIDTH_FACTOR`].
|
||||||
|
pub fn text_width_em_in(text: &str, bold: bool, italic: bool, family: Option<&str>) -> f64 {
|
||||||
|
let id = font_family_id(font_name_of(family).as_deref());
|
||||||
|
if id < 2 {
|
||||||
|
return text_width_em(text, bold);
|
||||||
|
}
|
||||||
|
let row = &crate::text_metrics::WIDTHS[(id as usize - 2) * 4 + bold as usize + 2 * italic as usize];
|
||||||
|
let w: u32 = text
|
||||||
|
.chars()
|
||||||
|
.map(|ch| {
|
||||||
|
let c = ch as u32;
|
||||||
|
let col = match c {
|
||||||
|
0x20..=0x7e => Some((c - 0x20) as usize),
|
||||||
|
0xa0..=0xff => Some((c - 0xa0) as usize + 95),
|
||||||
|
_ => crate::text_metrics::EXTRA_CHARS.iter().position(|&e| e == c).map(|i| i + 191),
|
||||||
|
};
|
||||||
|
match col.map(|i| row[i]) {
|
||||||
|
Some(w) if w > 0 => w as u32,
|
||||||
|
_ => (CHAR_WIDTH_FACTOR * 1000.0) as u32,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.sum();
|
||||||
|
w as f64 / 1000.0
|
||||||
|
}
|
||||||
|
|
||||||
|
/// [226] Breite eines Laufs (Tspan) in em in seiner eigenen Schrift.
|
||||||
|
fn tspan_width_em(t: &Tspan) -> f64 {
|
||||||
|
text_width_em_in(&t.text, t.bold, t.italic, t.font_family.as_deref())
|
||||||
|
}
|
||||||
|
|
||||||
/// [140] Waagrechte Lage jeder Zeile eines Raumstempels relativ zum Anker (gleiche Einheiten wie die Zeilen):
|
/// [140] Waagrechte Lage jeder Zeile eines Raumstempels relativ zum Anker (gleiche Einheiten wie die Zeilen):
|
||||||
/// der Block ist so breit wie seine breiteste Zeile ([`stamp_block_size`]) und um den Anker zentriert; eine
|
/// der Block ist so breit wie seine breiteste Zeile ([`stamp_block_size`]) und um den Anker zentriert; eine
|
||||||
/// linksbündige Zeile beginnt am linken Blockrand (−Breite/2), eine rechtsbündige endet am rechten (+Breite/2),
|
/// linksbündige Zeile beginnt am linken Blockrand (−Breite/2), eine rechtsbündige endet am rechten (+Breite/2),
|
||||||
/// eine zentrierte steht am Anker. So liegt der gezeichnete Stempel im gemessenen Rechteck, mit dem
|
/// eine zentrierte steht am Anker. So liegt der gezeichnete Stempel im gemessenen Rechteck, mit dem
|
||||||
/// `plan::domains` ihn im Raum einpasst (vorher begann eine linksbündige Namenszeile am Anker).
|
/// `plan::domains` ihn im Raum einpasst (vorher begann eine linksbündige Namenszeile am Anker).
|
||||||
pub fn stamp_line_offsets(placed: &[Placed]) -> Vec<f64> {
|
pub fn stamp_line_offsets(placed: &[Placed]) -> Vec<f64> {
|
||||||
let width = |p: &Placed| p.line.tspans.iter().map(|t| text_width_em(&t.text, t.bold) * t.font_size).sum::<f64>();
|
let width = |p: &Placed| p.line.tspans.iter().map(|t| tspan_width_em(t) * t.font_size).sum::<f64>();
|
||||||
let w = placed.iter().map(width).fold(0.0, f64::max);
|
let w = placed.iter().map(width).fold(0.0, f64::max);
|
||||||
placed
|
placed
|
||||||
.iter()
|
.iter()
|
||||||
@@ -664,7 +715,7 @@ pub fn stamp_block_size(doc: &RichTextDoc, extra: &[ExtraRow], base_pt: f64, uni
|
|||||||
if placed.is_empty() {
|
if placed.is_empty() {
|
||||||
return (0.0, 0.0);
|
return (0.0, 0.0);
|
||||||
}
|
}
|
||||||
let w = placed.iter().map(|p| p.line.tspans.iter().map(|t| text_width_em(&t.text, t.bold) * t.font_size).sum::<f64>()).fold(0.0, f64::max);
|
let w = placed.iter().map(|p| p.line.tspans.iter().map(|t| tspan_width_em(t) * t.font_size).sum::<f64>()).fold(0.0, f64::max);
|
||||||
// [199] Erste Zeile nach ihrer grössten Schrift (wie die Zentrierung in [`stamp_block_refs`]).
|
// [199] Erste Zeile nach ihrer grössten Schrift (wie die Zentrierung in [`stamp_block_refs`]).
|
||||||
let first = placed[0].line.tspans.iter().map(|t| t.font_size).fold(base_pt * unit_per_pt, f64::max);
|
let first = placed[0].line.tspans.iter().map(|t| t.font_size).fold(base_pt * unit_per_pt, f64::max);
|
||||||
let h = first + placed[1..].iter().map(|p| p.line.line_height).sum::<f64>();
|
let h = first + placed[1..].iter().map(|p| p.line.line_height).sum::<f64>();
|
||||||
@@ -692,6 +743,35 @@ mod tests {
|
|||||||
lines.iter().map(Line::content).collect()
|
lines.iter().map(Line::content).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// [226] Familienliste = `TEXT_FONTS` der Oberfläche (gleiche Reihenfolge: Kennung = Index + 1).
|
||||||
|
#[test]
|
||||||
|
fn schriftfamilien_wie_in_der_oberflaeche() {
|
||||||
|
let ts = include_str!("../../../src/text/fontList.ts");
|
||||||
|
let body = ts.split("TEXT_FONTS: string[] = [").nth(1).unwrap().split("];").next().unwrap();
|
||||||
|
let names: Vec<&str> = body.lines().filter_map(|l| l.trim().strip_prefix('"')?.strip_suffix("\",")).collect();
|
||||||
|
assert_eq!(names, FONT_FAMILIES);
|
||||||
|
assert_eq!(font_family_id(Some("Source Serif 4")), 15);
|
||||||
|
assert_eq!(font_family_id(Some("work sans")), 2);
|
||||||
|
assert_eq!((font_family_id(Some("Inter")), font_family_id(Some("Arial")), font_family_id(None)), (0, 0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// [226] Breiten je Familie: Inter bleibt die alte Tabelle, andere Familien messen mit ihrer eigenen Schrift.
|
||||||
|
#[test]
|
||||||
|
fn breite_je_schriftfamilie() {
|
||||||
|
let t = "Wohnen 17.01 m²";
|
||||||
|
assert_eq!(text_width_em_in(t, false, false, None), text_width_em(t, false));
|
||||||
|
assert_eq!(text_width_em_in(t, true, true, Some("\"Inter\", sans-serif")), text_width_em(t, true));
|
||||||
|
assert_eq!(text_width_em_in(t, false, false, Some("Arial")), text_width_em(t, false));
|
||||||
|
let serif = text_width_em_in(t, false, false, Some("Source Serif 4"));
|
||||||
|
let mono = text_width_em_in(t, false, false, Some("IBM Plex Mono"));
|
||||||
|
assert!((serif - text_width_em(t, false)).abs() > 0.05, "{serif}");
|
||||||
|
// Nichtproportional: jedes Zeichen 600/1000 em.
|
||||||
|
assert!((mono - 0.6 * t.chars().count() as f64).abs() < 1e-9, "{mono}");
|
||||||
|
assert!(text_width_em_in(t, true, false, Some("Source Serif 4")) > serif);
|
||||||
|
// Fehlendes Zeichen: Schätzung statt 0.
|
||||||
|
assert!(text_width_em_in("日", false, false, Some("Rubik")) > 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn zeilen_lage_am_anker_und_in_der_spalte() {
|
fn zeilen_lage_am_anker_und_in_der_spalte() {
|
||||||
let rows = [(LineAlign::Left, 9.0), (LineAlign::Center, 2.5), (LineAlign::Right, 4.0)];
|
let rows = [(LineAlign::Left, 9.0), (LineAlign::Center, 2.5), (LineAlign::Right, 4.0)];
|
||||||
|
|||||||
@@ -0,0 +1,120 @@
|
|||||||
|
// ERZEUGT von scripts/gen-text-metrics.py ([226]) — nicht von Hand aendern.
|
||||||
|
// Vorschubbreiten (1/1000 em) der gebuendelten Schriften ausser Inter (public/fonts, SIL OFL 1.1, s. NOTICE):
|
||||||
|
// Zeile = (Kennung - 2) * 4 + Schnitt (Bit 0 fett, Bit 1 kursiv), Spalten = `CHARS`; 0 = Zeichen fehlt.
|
||||||
|
pub const N_CHARS: usize = 201;
|
||||||
|
/// Zeichen der Spalten: U+0020-007E, U+00A0-00FF, dann Satzzeichen.
|
||||||
|
pub const EXTRA_CHARS: [u32; 10] = [0x2013, 0x2014, 0x2026, 0x20AC, 0x2018, 0x2019, 0x201A, 0x201C, 0x201D, 0x201E];
|
||||||
|
pub static WIDTHS: [[u16; N_CHARS]; 56] = [
|
||||||
|
// Work Sans, Schnitt 0
|
||||||
|
[341, 272, 403, 639, 622, 856, 623, 234, 350, 350, 572, 604, 266, 510, 266, 437, 622, 390, 583, 583, 611, 582, 608, 561, 616, 617, 296, 296, 604, 604, 604, 542, 958, 660, 653, 686, 721, 638, 610, 724, 734, 296, 566, 656, 598, 854, 734, 748, 610, 748, 665, 641, 604, 708, 648, 961, 601, 572, 630, 348, 437, 348, 560, 539, 500, 566, 627, 560, 627, 577, 393, 532, 619, 266, 266, 567, 306, 953, 619, 600, 627, 627, 408, 527, 419, 617, 520, 836, 533, 516, 534, 351, 243, 351, 540, 341, 264, 567, 620, 665, 620, 243, 598, 500, 820, 382, 493, 604, 510, 820, 500, 460, 604, 365, 362, 600, 622, 657, 226, 500, 242, 360, 493, 788, 855, 908, 537, 660, 660, 660, 660, 660, 660, 954, 686, 638, 638, 638, 638, 296, 296, 296, 296, 737, 734, 748, 748, 748, 748, 748, 604, 748, 708, 708, 708, 708, 572, 627, 617, 566, 566, 566, 566, 566, 566, 895, 560, 577, 577, 577, 577, 266, 266, 266, 266, 620, 619, 600, 600, 600, 600, 600, 604, 600, 617, 617, 617, 617, 516, 627, 516, 664, 1014, 870, 700, 255, 255, 255, 443, 443, 443],
|
||||||
|
// Work Sans, Schnitt 1
|
||||||
|
[286, 301, 447, 688, 641, 938, 646, 250, 391, 391, 588, 604, 290, 528, 290, 468, 644, 431, 596, 593, 646, 583, 616, 608, 627, 616, 302, 302, 604, 604, 604, 607, 931, 677, 684, 681, 718, 631, 612, 723, 742, 318, 618, 693, 602, 910, 741, 737, 668, 737, 689, 645, 653, 710, 683, 997, 663, 657, 634, 391, 468, 391, 612, 539, 500, 579, 627, 567, 627, 579, 415, 560, 620, 291, 291, 622, 327, 941, 620, 599, 627, 627, 430, 533, 437, 619, 561, 900, 589, 563, 516, 420, 320, 420, 597, 286, 298, 575, 621, 646, 666, 320, 623, 500, 772, 438, 585, 604, 528, 772, 500, 495, 604, 392, 379, 540, 621, 748, 274, 500, 298, 422, 585, 872, 941, 954, 605, 677, 677, 677, 677, 677, 677, 924, 681, 631, 631, 631, 631, 318, 318, 318, 318, 741, 741, 737, 737, 737, 737, 737, 604, 737, 710, 710, 710, 710, 657, 674, 646, 579, 579, 579, 579, 579, 579, 878, 567, 579, 579, 579, 579, 291, 291, 291, 291, 604, 620, 599, 599, 599, 599, 599, 623, 599, 619, 619, 619, 619, 563, 627, 563, 692, 1006, 928, 702, 294, 294, 286, 539, 539, 526],
|
||||||
|
// Work Sans, Schnitt 2
|
||||||
|
[336, 268, 398, 639, 620, 888, 606, 231, 342, 342, 564, 604, 252, 510, 262, 420, 629, 382, 565, 564, 565, 571, 589, 538, 606, 609, 296, 296, 604, 604, 604, 536, 950, 643, 645, 674, 706, 625, 585, 707, 719, 290, 549, 637, 586, 837, 719, 742, 610, 742, 637, 639, 592, 693, 628, 939, 588, 562, 591, 344, 469, 345, 560, 539, 500, 616, 616, 538, 616, 572, 385, 613, 600, 258, 258, 545, 303, 934, 600, 595, 616, 616, 388, 512, 402, 598, 493, 803, 519, 504, 513, 333, 239, 333, 540, 336, 264, 565, 599, 665, 600, 239, 591, 500, 807, 355, 490, 604, 510, 809, 500, 444, 604, 368, 346, 600, 606, 657, 223, 500, 253, 355, 491, 794, 885, 887, 528, 643, 643, 643, 643, 643, 643, 935, 674, 625, 625, 625, 625, 290, 290, 290, 290, 725, 719, 742, 742, 742, 742, 742, 604, 742, 693, 693, 693, 693, 562, 614, 595, 616, 616, 616, 616, 616, 616, 883, 538, 572, 572, 572, 572, 258, 258, 258, 258, 598, 600, 595, 595, 595, 595, 595, 604, 595, 598, 598, 598, 598, 504, 616, 504, 664, 1014, 854, 664, 241, 241, 241, 425, 425, 425],
|
||||||
|
// Work Sans, Schnitt 3
|
||||||
|
[284, 300, 451, 688, 634, 1001, 643, 251, 393, 393, 585, 604, 282, 528, 286, 461, 642, 425, 579, 583, 630, 570, 602, 598, 629, 607, 296, 300, 604, 604, 605, 598, 934, 671, 683, 688, 708, 626, 599, 715, 736, 316, 609, 685, 603, 904, 735, 732, 664, 732, 677, 640, 648, 704, 663, 988, 660, 653, 623, 390, 466, 390, 612, 539, 500, 618, 618, 563, 618, 582, 414, 616, 611, 288, 288, 612, 328, 933, 611, 600, 618, 618, 423, 522, 436, 610, 550, 880, 586, 558, 512, 413, 319, 413, 592, 284, 298, 575, 624, 658, 658, 319, 622, 500, 778, 428, 578, 604, 528, 780, 500, 478, 604, 386, 376, 600, 614, 750, 270, 500, 285, 420, 579, 871, 946, 961, 595, 671, 671, 671, 671, 671, 671, 916, 688, 626, 626, 626, 626, 316, 316, 316, 316, 732, 735, 732, 732, 732, 732, 732, 604, 732, 704, 704, 704, 704, 653, 668, 637, 618, 618, 618, 618, 618, 618, 884, 563, 582, 582, 582, 582, 288, 288, 288, 288, 599, 611, 600, 600, 600, 600, 600, 623, 600, 610, 610, 610, 610, 558, 618, 558, 692, 1006, 921, 702, 284, 284, 284, 524, 524, 524],
|
||||||
|
// IBM Plex Sans, Schnitt 0
|
||||||
|
[236, 284, 419, 713, 598, 927, 694, 242, 335, 335, 450, 600, 272, 399, 272, 383, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 292, 292, 600, 600, 600, 477, 891, 641, 653, 621, 671, 583, 559, 695, 707, 400, 510, 634, 501, 812, 707, 708, 606, 708, 640, 581, 572, 678, 609, 891, 613, 593, 580, 317, 383, 317, 600, 565, 600, 534, 580, 503, 580, 549, 324, 528, 568, 250, 250, 527, 272, 873, 568, 560, 580, 580, 367, 487, 351, 568, 492, 768, 507, 499, 464, 343, 314, 343, 600, 236, 284, 514, 595, 612, 605, 314, 586, 600, 776, 399, 513, 600, 0, 476, 600, 468, 600, 346, 346, 600, 573, 652, 326, 600, 359, 398, 513, 847, 872, 824, 467, 641, 641, 641, 641, 641, 641, 907, 621, 583, 583, 583, 583, 400, 400, 400, 400, 674, 707, 708, 708, 708, 708, 708, 600, 708, 678, 678, 678, 678, 593, 606, 640, 534, 534, 534, 534, 534, 534, 864, 503, 549, 549, 549, 549, 250, 250, 250, 250, 555, 568, 560, 560, 560, 560, 560, 600, 568, 568, 568, 568, 568, 499, 580, 499, 588, 780, 803, 625, 273, 273, 274, 475, 474, 475],
|
||||||
|
// IBM Plex Sans, Schnitt 1
|
||||||
|
[236, 320, 493, 632, 601, 974, 721, 268, 338, 338, 601, 600, 310, 403, 310, 460, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 330, 330, 600, 600, 600, 500, 903, 685, 667, 651, 697, 607, 585, 719, 724, 432, 559, 696, 530, 819, 724, 714, 656, 714, 674, 624, 584, 694, 650, 973, 673, 649, 607, 334, 460, 334, 600, 556, 600, 569, 608, 517, 608, 562, 361, 552, 596, 286, 286, 577, 303, 894, 596, 564, 608, 608, 404, 504, 383, 596, 538, 841, 560, 534, 518, 372, 402, 372, 600, 236, 320, 552, 582, 628, 650, 402, 569, 600, 792, 449, 558, 600, 0, 464, 600, 470, 600, 347, 345, 600, 602, 677, 358, 600, 344, 433, 558, 837, 859, 828, 494, 685, 685, 685, 685, 685, 685, 968, 651, 607, 607, 607, 607, 432, 432, 432, 432, 702, 724, 714, 714, 714, 714, 714, 600, 714, 694, 694, 694, 694, 649, 656, 692, 569, 569, 569, 569, 569, 569, 864, 517, 562, 562, 562, 562, 286, 286, 286, 286, 603, 596, 564, 564, 564, 564, 564, 600, 572, 596, 596, 596, 596, 534, 608, 534, 588, 780, 897, 627, 300, 300, 304, 535, 535, 539],
|
||||||
|
// IBM Plex Sans, Schnitt 2
|
||||||
|
[236, 271, 409, 681, 579, 900, 670, 233, 328, 328, 452, 600, 273, 387, 273, 378, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 293, 293, 600, 600, 600, 470, 863, 623, 627, 602, 652, 565, 542, 661, 684, 387, 498, 615, 489, 784, 684, 679, 588, 679, 625, 577, 557, 656, 593, 862, 596, 577, 563, 317, 378, 316, 600, 548, 593, 583, 572, 488, 583, 511, 307, 508, 565, 264, 253, 519, 264, 848, 565, 550, 572, 572, 364, 471, 320, 562, 484, 740, 494, 484, 448, 329, 306, 329, 600, 236, 271, 505, 577, 612, 594, 306, 557, 593, 784, 390, 499, 600, 0, 469, 593, 454, 600, 339, 339, 593, 568, 629, 316, 593, 339, 389, 499, 854, 856, 834, 470, 623, 623, 623, 623, 623, 623, 886, 602, 565, 565, 565, 565, 387, 387, 387, 387, 655, 684, 679, 679, 679, 679, 679, 600, 679, 656, 656, 656, 656, 577, 587, 641, 583, 583, 583, 583, 583, 583, 806, 488, 511, 511, 511, 511, 264, 264, 264, 264, 563, 565, 550, 550, 550, 550, 550, 600, 550, 562, 562, 562, 562, 484, 572, 484, 565, 749, 795, 601, 273, 273, 273, 470, 470, 470],
|
||||||
|
// IBM Plex Sans, Schnitt 3
|
||||||
|
[236, 314, 488, 640, 561, 939, 704, 263, 353, 353, 595, 600, 307, 395, 307, 479, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 327, 327, 600, 600, 600, 490, 891, 658, 651, 635, 682, 578, 557, 700, 700, 415, 536, 657, 510, 801, 700, 695, 637, 695, 655, 586, 569, 678, 631, 941, 641, 624, 573, 323, 479, 323, 600, 548, 585, 591, 583, 494, 591, 515, 353, 535, 588, 281, 276, 550, 281, 877, 588, 542, 583, 583, 394, 497, 354, 582, 512, 791, 518, 509, 492, 361, 395, 361, 600, 236, 314, 532, 591, 624, 626, 395, 557, 585, 771, 444, 562, 600, 0, 453, 585, 459, 600, 340, 332, 585, 587, 646, 350, 585, 344, 427, 562, 891, 888, 869, 490, 658, 658, 658, 658, 658, 658, 920, 635, 578, 578, 578, 578, 415, 415, 415, 415, 687, 700, 695, 695, 695, 695, 695, 600, 695, 678, 678, 678, 678, 624, 634, 669, 591, 591, 591, 591, 591, 591, 827, 494, 515, 515, 515, 515, 281, 281, 281, 281, 573, 588, 542, 542, 542, 542, 542, 600, 543, 582, 582, 582, 582, 509, 583, 509, 583, 773, 889, 617, 286, 286, 286, 520, 520, 520],
|
||||||
|
// IBM Plex Mono, Schnitt 0
|
||||||
|
[600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600],
|
||||||
|
// IBM Plex Mono, Schnitt 1
|
||||||
|
[600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600],
|
||||||
|
// IBM Plex Mono, Schnitt 2
|
||||||
|
[600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600],
|
||||||
|
// IBM Plex Mono, Schnitt 3
|
||||||
|
[600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600],
|
||||||
|
// Source Sans 3, Schnitt 0
|
||||||
|
[200, 289, 426, 497, 497, 824, 609, 249, 303, 303, 418, 497, 249, 311, 249, 350, 497, 497, 497, 497, 497, 497, 497, 497, 497, 497, 249, 249, 497, 497, 497, 425, 847, 543, 588, 571, 615, 527, 494, 617, 652, 263, 479, 579, 486, 727, 647, 664, 566, 664, 569, 534, 536, 645, 515, 786, 513, 476, 539, 303, 350, 303, 497, 500, 542, 504, 553, 456, 555, 496, 292, 504, 544, 246, 247, 495, 255, 829, 547, 542, 555, 555, 347, 419, 338, 544, 467, 719, 446, 467, 425, 303, 241, 303, 497, 200, 289, 497, 497, 497, 497, 241, 497, 542, 744, 345, 429, 497, 311, 423, 542, 331, 497, 367, 367, 542, 562, 560, 249, 542, 367, 365, 429, 781, 808, 796, 425, 544, 544, 544, 544, 544, 544, 822, 571, 527, 527, 527, 527, 263, 263, 263, 263, 639, 647, 664, 664, 664, 664, 664, 497, 664, 645, 645, 645, 645, 476, 583, 576, 504, 504, 504, 504, 504, 504, 778, 456, 496, 496, 496, 496, 246, 246, 246, 246, 544, 547, 542, 542, 542, 542, 542, 497, 542, 544, 544, 544, 544, 467, 555, 467, 480, 800, 948, 497, 249, 249, 249, 426, 426, 426],
|
||||||
|
// Source Sans 3, Schnitt 1
|
||||||
|
[200, 340, 537, 528, 528, 857, 667, 300, 344, 344, 457, 528, 300, 332, 300, 339, 528, 528, 528, 528, 528, 528, 528, 528, 528, 528, 300, 300, 528, 528, 528, 463, 902, 573, 605, 582, 635, 548, 524, 638, 674, 301, 509, 614, 518, 762, 665, 684, 596, 684, 613, 556, 556, 665, 556, 813, 567, 525, 541, 344, 339, 344, 528, 500, 555, 527, 573, 468, 573, 518, 341, 534, 571, 276, 278, 548, 286, 857, 572, 555, 573, 573, 398, 443, 383, 568, 523, 776, 514, 521, 460, 344, 268, 344, 528, 200, 340, 528, 528, 528, 528, 268, 528, 555, 750, 359, 480, 528, 332, 462, 555, 365, 528, 376, 376, 555, 594, 636, 300, 555, 376, 373, 480, 809, 846, 818, 463, 573, 573, 573, 573, 573, 573, 845, 582, 548, 548, 548, 548, 301, 301, 301, 301, 657, 665, 684, 684, 684, 684, 684, 528, 684, 665, 665, 665, 665, 525, 617, 632, 527, 527, 527, 527, 527, 527, 781, 467, 518, 518, 518, 518, 276, 276, 276, 276, 558, 572, 555, 555, 555, 555, 555, 528, 555, 568, 568, 568, 568, 521, 573, 521, 480, 800, 978, 528, 300, 300, 300, 537, 537, 537],
|
||||||
|
// Source Sans 3, Schnitt 2
|
||||||
|
[200, 282, 407, 479, 480, 791, 582, 242, 291, 293, 403, 480, 242, 299, 242, 340, 479, 480, 480, 480, 480, 480, 480, 480, 480, 480, 242, 242, 480, 480, 480, 409, 814, 510, 569, 550, 594, 502, 473, 588, 623, 249, 456, 555, 462, 705, 619, 633, 550, 633, 555, 506, 510, 616, 496, 756, 490, 461, 512, 292, 340, 292, 479, 483, 517, 536, 536, 435, 535, 480, 282, 530, 523, 237, 238, 476, 248, 799, 525, 514, 535, 534, 342, 402, 324, 522, 448, 707, 429, 448, 410, 290, 231, 293, 480, 200, 282, 480, 480, 480, 479, 231, 477, 517, 665, 354, 412, 480, 299, 406, 517, 313, 480, 353, 351, 517, 519, 535, 242, 517, 356, 348, 412, 748, 772, 764, 409, 510, 510, 510, 510, 510, 510, 803, 550, 502, 502, 502, 502, 249, 249, 249, 249, 614, 619, 633, 633, 633, 633, 633, 480, 634, 616, 616, 616, 616, 461, 562, 555, 537, 537, 537, 537, 537, 537, 761, 435, 481, 481, 481, 481, 237, 237, 237, 237, 529, 525, 514, 514, 514, 514, 514, 480, 515, 522, 522, 522, 522, 448, 535, 448, 463, 769, 959, 479, 242, 242, 242, 407, 407, 407],
|
||||||
|
// Source Sans 3, Schnitt 3
|
||||||
|
[200, 331, 510, 506, 509, 829, 633, 291, 329, 331, 438, 509, 291, 320, 291, 329, 509, 509, 509, 509, 509, 509, 509, 509, 509, 509, 291, 291, 509, 509, 509, 444, 866, 547, 593, 567, 621, 525, 504, 611, 653, 294, 491, 596, 499, 740, 643, 660, 583, 660, 596, 529, 532, 643, 554, 793, 545, 510, 525, 330, 329, 330, 506, 481, 534, 552, 553, 443, 546, 496, 327, 546, 547, 265, 267, 525, 275, 827, 552, 531, 553, 551, 384, 424, 367, 544, 499, 748, 490, 499, 443, 328, 255, 331, 509, 200, 331, 509, 509, 509, 509, 255, 505, 534, 672, 365, 461, 509, 320, 444, 534, 348, 509, 364, 360, 534, 554, 608, 291, 534, 376, 358, 461, 777, 813, 788, 444, 548, 548, 548, 548, 548, 548, 838, 567, 525, 525, 525, 525, 294, 294, 294, 294, 641, 643, 660, 660, 660, 660, 660, 509, 660, 643, 643, 643, 643, 509, 595, 609, 552, 552, 552, 552, 552, 552, 755, 443, 496, 496, 496, 496, 265, 265, 265, 265, 549, 552, 531, 531, 531, 531, 531, 509, 532, 544, 544, 544, 544, 499, 553, 499, 464, 771, 976, 509, 291, 291, 291, 510, 510, 510],
|
||||||
|
// Space Grotesk, Schnitt 0
|
||||||
|
[257, 253, 425, 628, 613, 772, 604, 251, 379, 377, 520, 620, 251, 455, 253, 370, 641, 418, 603, 604, 625, 599, 612, 564, 623, 612, 253, 253, 620, 620, 620, 580, 1026, 630, 661, 642, 663, 563, 540, 660, 656, 244, 594, 610, 546, 865, 664, 669, 601, 669, 631, 613, 588, 666, 619, 875, 638, 610, 577, 335, 370, 335, 620, 620, 280, 575, 644, 598, 644, 592, 442, 642, 613, 245, 247, 538, 245, 860, 613, 618, 644, 644, 377, 527, 460, 612, 539, 801, 593, 612, 521, 432, 240, 432, 620, 257, 253, 599, 628, 620, 620, 240, 498, 415, 704, 420, 683, 620, 455, 531, 417, 381, 620, 366, 376, 280, 621, 577, 187, 323, 251, 437, 683, 815, 823, 895, 580, 630, 630, 630, 630, 630, 630, 831, 642, 563, 563, 563, 563, 244, 244, 244, 244, 663, 664, 669, 669, 669, 669, 669, 620, 669, 666, 666, 666, 666, 610, 601, 628, 575, 575, 575, 575, 575, 575, 925, 598, 592, 592, 592, 592, 245, 245, 245, 245, 615, 613, 618, 618, 618, 618, 618, 620, 618, 612, 612, 612, 612, 612, 642, 612, 607, 911, 679, 683, 251, 251, 251, 425, 425, 425],
|
||||||
|
// Space Grotesk, Schnitt 1
|
||||||
|
[254, 298, 514, 636, 606, 758, 591, 294, 398, 390, 540, 620, 294, 432, 298, 388, 648, 452, 594, 608, 636, 600, 618, 554, 600, 618, 298, 298, 620, 620, 620, 578, 1014, 634, 664, 644, 666, 554, 534, 662, 656, 264, 610, 626, 542, 882, 670, 676, 604, 676, 632, 606, 588, 672, 618, 898, 644, 624, 576, 358, 388, 358, 620, 620, 296, 578, 638, 586, 638, 577, 436, 638, 616, 266, 268, 564, 266, 854, 616, 612, 638, 638, 396, 524, 456, 616, 548, 784, 592, 616, 518, 466, 258, 466, 620, 254, 298, 598, 638, 620, 620, 258, 474, 448, 720, 419, 720, 620, 432, 516, 408, 394, 620, 364, 363, 296, 624, 614, 218, 328, 262, 436, 720, 830, 824, 891, 578, 634, 634, 634, 634, 634, 634, 821, 644, 554, 554, 554, 554, 264, 264, 264, 264, 666, 670, 676, 676, 676, 676, 676, 620, 676, 672, 672, 672, 672, 624, 604, 651, 578, 578, 578, 578, 578, 578, 874, 586, 577, 577, 577, 577, 266, 266, 266, 266, 616, 616, 612, 612, 612, 612, 612, 620, 612, 616, 616, 616, 616, 616, 638, 616, 584, 888, 798, 678, 294, 294, 294, 514, 514, 514],
|
||||||
|
// Space Grotesk, Schnitt 2
|
||||||
|
[257, 253, 425, 628, 613, 772, 604, 251, 379, 377, 520, 620, 251, 455, 253, 370, 641, 418, 603, 604, 625, 599, 612, 564, 623, 612, 253, 253, 620, 620, 620, 580, 1026, 630, 661, 642, 663, 563, 540, 660, 656, 244, 594, 610, 546, 865, 664, 669, 601, 669, 631, 613, 588, 666, 619, 875, 638, 610, 577, 335, 370, 335, 620, 620, 280, 575, 644, 598, 644, 592, 442, 642, 613, 245, 247, 538, 245, 860, 613, 618, 644, 644, 377, 527, 460, 612, 539, 801, 593, 612, 521, 432, 240, 432, 620, 257, 253, 599, 628, 620, 620, 240, 498, 415, 704, 420, 683, 620, 455, 531, 417, 381, 620, 366, 376, 280, 621, 577, 187, 323, 251, 437, 683, 815, 823, 895, 580, 630, 630, 630, 630, 630, 630, 831, 642, 563, 563, 563, 563, 244, 244, 244, 244, 663, 664, 669, 669, 669, 669, 669, 620, 669, 666, 666, 666, 666, 610, 601, 628, 575, 575, 575, 575, 575, 575, 925, 598, 592, 592, 592, 592, 245, 245, 245, 245, 615, 613, 618, 618, 618, 618, 618, 620, 618, 612, 612, 612, 612, 612, 642, 612, 607, 911, 679, 683, 251, 251, 251, 425, 425, 425],
|
||||||
|
// Space Grotesk, Schnitt 3
|
||||||
|
[254, 298, 514, 636, 606, 758, 591, 294, 398, 390, 540, 620, 294, 432, 298, 388, 648, 452, 594, 608, 636, 600, 618, 554, 600, 618, 298, 298, 620, 620, 620, 578, 1014, 634, 664, 644, 666, 554, 534, 662, 656, 264, 610, 626, 542, 882, 670, 676, 604, 676, 632, 606, 588, 672, 618, 898, 644, 624, 576, 358, 388, 358, 620, 620, 296, 578, 638, 586, 638, 577, 436, 638, 616, 266, 268, 564, 266, 854, 616, 612, 638, 638, 396, 524, 456, 616, 548, 784, 592, 616, 518, 466, 258, 466, 620, 254, 298, 598, 638, 620, 620, 258, 474, 448, 720, 419, 720, 620, 432, 516, 408, 394, 620, 364, 363, 296, 624, 614, 218, 328, 262, 436, 720, 830, 824, 891, 578, 634, 634, 634, 634, 634, 634, 821, 644, 554, 554, 554, 554, 264, 264, 264, 264, 666, 670, 676, 676, 676, 676, 676, 620, 676, 672, 672, 672, 672, 624, 604, 651, 578, 578, 578, 578, 578, 578, 874, 586, 577, 577, 577, 577, 266, 266, 266, 266, 616, 616, 612, 612, 612, 612, 612, 620, 612, 616, 616, 616, 616, 616, 638, 616, 584, 888, 798, 678, 294, 294, 294, 514, 514, 514],
|
||||||
|
// Manrope, Schnitt 0
|
||||||
|
[200, 314, 392, 920, 589, 902, 652, 214, 426, 426, 436, 576, 266, 420, 254, 388, 610, 390, 570, 553, 590, 578, 620, 502, 580, 620, 299, 306, 614, 750, 614, 524, 904, 634, 613, 716, 672, 570, 504, 705, 684, 234, 464, 594, 510, 840, 684, 724, 604, 724, 630, 616, 596, 702, 604, 936, 606, 556, 614, 407, 388, 407, 670, 660, 490, 556, 592, 554, 592, 584, 354, 592, 594, 234, 250, 496, 234, 848, 594, 592, 592, 592, 360, 525, 400, 594, 508, 768, 527, 528, 530, 420, 254, 420, 662, 200, 314, 554, 571, 642, 556, 254, 525, 510, 804, 315, 536, 600, 420, 625, 490, 450, 600, 400, 390, 490, 604, 634, 226, 397, 321, 345, 536, 974, 934, 980, 524, 634, 634, 634, 634, 634, 634, 918, 716, 570, 570, 570, 570, 234, 234, 234, 234, 666, 684, 724, 724, 724, 724, 724, 488, 724, 702, 702, 702, 702, 556, 594, 598, 556, 556, 556, 556, 556, 556, 942, 554, 584, 584, 584, 584, 234, 234, 234, 234, 582, 594, 592, 592, 592, 592, 592, 540, 592, 594, 594, 594, 594, 528, 592, 528, 540, 780, 632, 648, 222, 222, 266, 372, 372, 372],
|
||||||
|
// Manrope, Schnitt 1
|
||||||
|
[200, 360, 467, 932, 628, 900, 668, 260, 453, 453, 464, 572, 304, 420, 304, 433, 658, 438, 596, 582, 608, 586, 622, 534, 612, 622, 342, 344, 638, 750, 638, 553, 914, 670, 631, 738, 700, 585, 524, 732, 722, 280, 500, 647, 534, 855, 718, 750, 638, 750, 660, 658, 606, 720, 640, 976, 656, 612, 664, 424, 433, 424, 680, 660, 538, 576, 616, 576, 617, 602, 378, 616, 626, 280, 288, 538, 280, 899, 626, 618, 616, 617, 399, 542, 433, 626, 553, 802, 554, 560, 534, 449, 300, 449, 716, 200, 360, 576, 571, 670, 612, 300, 542, 556, 886, 320, 586, 600, 420, 655, 506, 450, 600, 412, 404, 538, 634, 715, 266, 414, 344, 352, 586, 1036, 1014, 1028, 553, 670, 670, 670, 670, 670, 670, 938, 738, 585, 585, 585, 585, 280, 280, 280, 280, 702, 718, 750, 750, 750, 750, 750, 506, 750, 720, 720, 720, 720, 612, 630, 634, 576, 576, 576, 576, 576, 576, 936, 576, 602, 602, 602, 602, 280, 280, 280, 280, 596, 626, 618, 618, 618, 618, 618, 540, 618, 626, 626, 626, 626, 560, 616, 560, 540, 780, 710, 682, 284, 284, 304, 451, 451, 451],
|
||||||
|
// Manrope, Schnitt 2
|
||||||
|
[200, 314, 392, 920, 589, 902, 652, 214, 426, 426, 436, 576, 266, 420, 254, 388, 610, 390, 570, 553, 590, 578, 620, 502, 580, 620, 299, 306, 614, 750, 614, 524, 904, 634, 613, 716, 672, 570, 504, 705, 684, 234, 464, 594, 510, 840, 684, 724, 604, 724, 630, 616, 596, 702, 604, 936, 606, 556, 614, 407, 388, 407, 670, 660, 490, 556, 592, 554, 592, 584, 354, 592, 594, 234, 250, 496, 234, 848, 594, 592, 592, 592, 360, 525, 400, 594, 508, 768, 527, 528, 530, 420, 254, 420, 662, 200, 314, 554, 571, 642, 556, 254, 525, 510, 804, 315, 536, 600, 420, 625, 490, 450, 600, 400, 390, 490, 604, 634, 226, 397, 321, 345, 536, 974, 934, 980, 524, 634, 634, 634, 634, 634, 634, 918, 716, 570, 570, 570, 570, 234, 234, 234, 234, 666, 684, 724, 724, 724, 724, 724, 488, 724, 702, 702, 702, 702, 556, 594, 598, 556, 556, 556, 556, 556, 556, 942, 554, 584, 584, 584, 584, 234, 234, 234, 234, 582, 594, 592, 592, 592, 592, 592, 540, 592, 594, 594, 594, 594, 528, 592, 528, 540, 780, 632, 648, 222, 222, 266, 372, 372, 372],
|
||||||
|
// Manrope, Schnitt 3
|
||||||
|
[200, 360, 467, 932, 628, 900, 668, 260, 453, 453, 464, 572, 304, 420, 304, 433, 658, 438, 596, 582, 608, 586, 622, 534, 612, 622, 342, 344, 638, 750, 638, 553, 914, 670, 631, 738, 700, 585, 524, 732, 722, 280, 500, 647, 534, 855, 718, 750, 638, 750, 660, 658, 606, 720, 640, 976, 656, 612, 664, 424, 433, 424, 680, 660, 538, 576, 616, 576, 617, 602, 378, 616, 626, 280, 288, 538, 280, 899, 626, 618, 616, 617, 399, 542, 433, 626, 553, 802, 554, 560, 534, 449, 300, 449, 716, 200, 360, 576, 571, 670, 612, 300, 542, 556, 886, 320, 586, 600, 420, 655, 506, 450, 600, 412, 404, 538, 634, 715, 266, 414, 344, 352, 586, 1036, 1014, 1028, 553, 670, 670, 670, 670, 670, 670, 938, 738, 585, 585, 585, 585, 280, 280, 280, 280, 702, 718, 750, 750, 750, 750, 750, 506, 750, 720, 720, 720, 720, 612, 630, 634, 576, 576, 576, 576, 576, 576, 936, 576, 602, 602, 602, 602, 280, 280, 280, 280, 596, 626, 618, 618, 618, 618, 618, 540, 618, 626, 626, 626, 626, 560, 616, 560, 540, 780, 710, 682, 284, 284, 304, 451, 451, 451],
|
||||||
|
// Outfit, Schnitt 0
|
||||||
|
[208, 261, 400, 640, 588, 660, 659, 237, 303, 302, 490, 542, 275, 461, 290, 390, 656, 347, 541, 538, 598, 541, 564, 525, 550, 564, 271, 269, 542, 542, 542, 505, 750, 696, 623, 688, 740, 590, 566, 773, 706, 258, 495, 666, 552, 839, 710, 794, 606, 817, 630, 555, 625, 683, 688, 981, 691, 665, 583, 338, 390, 338, 453, 505, 281, 582, 582, 489, 582, 536, 399, 579, 548, 224, 230, 498, 222, 855, 548, 566, 582, 583, 419, 427, 368, 516, 511, 750, 504, 514, 447, 323, 278, 323, 542, 208, 267, 521, 619, 564, 645, 278, 517, 434, 833, 354, 458, 542, 0, 568, 440, 394, 542, 336, 335, 281, 579, 706, 130, 271, 261, 344, 458, 676, 670, 670, 489, 696, 696, 696, 696, 696, 696, 973, 688, 590, 590, 590, 590, 258, 258, 258, 258, 755, 710, 794, 794, 794, 794, 794, 542, 794, 683, 683, 683, 683, 665, 606, 573, 582, 582, 582, 582, 582, 582, 933, 489, 536, 536, 536, 536, 222, 222, 222, 222, 564, 548, 566, 566, 566, 566, 566, 542, 566, 516, 516, 516, 516, 514, 582, 514, 549, 852, 750, 725, 248, 249, 275, 432, 433, 459],
|
||||||
|
// Outfit, Schnitt 1
|
||||||
|
[190, 286, 456, 662, 603, 685, 691, 250, 310, 310, 490, 563, 283, 462, 300, 384, 666, 378, 564, 559, 609, 560, 573, 527, 562, 573, 290, 280, 563, 563, 563, 499, 756, 729, 641, 689, 754, 615, 590, 785, 730, 293, 532, 705, 561, 858, 738, 806, 628, 819, 652, 583, 639, 702, 713, 1002, 715, 687, 608, 349, 384, 349, 466, 505, 323, 595, 595, 496, 595, 548, 436, 584, 572, 261, 273, 546, 261, 873, 572, 576, 595, 595, 444, 458, 399, 539, 537, 785, 536, 534, 481, 342, 300, 342, 563, 190, 287, 516, 629, 601, 672, 300, 538, 495, 811, 361, 510, 563, 0, 546, 464, 396, 563, 340, 334, 323, 593, 718, 182, 304, 266, 349, 510, 695, 692, 690, 488, 729, 729, 729, 729, 729, 729, 994, 689, 615, 615, 615, 615, 293, 293, 293, 293, 774, 738, 806, 806, 806, 806, 806, 563, 806, 702, 702, 702, 702, 687, 628, 592, 595, 595, 595, 595, 595, 595, 935, 496, 548, 548, 548, 548, 261, 261, 261, 261, 573, 572, 576, 576, 576, 576, 576, 563, 576, 539, 539, 539, 539, 534, 595, 534, 568, 867, 840, 714, 261, 261, 283, 487, 487, 509],
|
||||||
|
// Outfit, Schnitt 2
|
||||||
|
[208, 261, 400, 640, 588, 660, 659, 237, 303, 302, 490, 542, 275, 461, 290, 390, 656, 347, 541, 538, 598, 541, 564, 525, 550, 564, 271, 269, 542, 542, 542, 505, 750, 696, 623, 688, 740, 590, 566, 773, 706, 258, 495, 666, 552, 839, 710, 794, 606, 817, 630, 555, 625, 683, 688, 981, 691, 665, 583, 338, 390, 338, 453, 505, 281, 582, 582, 489, 582, 536, 399, 579, 548, 224, 230, 498, 222, 855, 548, 566, 582, 583, 419, 427, 368, 516, 511, 750, 504, 514, 447, 323, 278, 323, 542, 208, 267, 521, 619, 564, 645, 278, 517, 434, 833, 354, 458, 542, 0, 568, 440, 394, 542, 336, 335, 281, 579, 706, 130, 271, 261, 344, 458, 676, 670, 670, 489, 696, 696, 696, 696, 696, 696, 973, 688, 590, 590, 590, 590, 258, 258, 258, 258, 755, 710, 794, 794, 794, 794, 794, 542, 794, 683, 683, 683, 683, 665, 606, 573, 582, 582, 582, 582, 582, 582, 933, 489, 536, 536, 536, 536, 222, 222, 222, 222, 564, 548, 566, 566, 566, 566, 566, 542, 566, 516, 516, 516, 516, 514, 582, 514, 549, 852, 750, 725, 248, 249, 275, 432, 433, 459],
|
||||||
|
// Outfit, Schnitt 3
|
||||||
|
[190, 286, 456, 662, 603, 685, 691, 250, 310, 310, 490, 563, 283, 462, 300, 384, 666, 378, 564, 559, 609, 560, 573, 527, 562, 573, 290, 280, 563, 563, 563, 499, 756, 729, 641, 689, 754, 615, 590, 785, 730, 293, 532, 705, 561, 858, 738, 806, 628, 819, 652, 583, 639, 702, 713, 1002, 715, 687, 608, 349, 384, 349, 466, 505, 323, 595, 595, 496, 595, 548, 436, 584, 572, 261, 273, 546, 261, 873, 572, 576, 595, 595, 444, 458, 399, 539, 537, 785, 536, 534, 481, 342, 300, 342, 563, 190, 287, 516, 629, 601, 672, 300, 538, 495, 811, 361, 510, 563, 0, 546, 464, 396, 563, 340, 334, 323, 593, 718, 182, 304, 266, 349, 510, 695, 692, 690, 488, 729, 729, 729, 729, 729, 729, 994, 689, 615, 615, 615, 615, 293, 293, 293, 293, 774, 738, 806, 806, 806, 806, 806, 563, 806, 702, 702, 702, 702, 687, 628, 592, 595, 595, 595, 595, 595, 595, 935, 496, 548, 548, 548, 548, 261, 261, 261, 261, 573, 572, 576, 576, 576, 576, 576, 563, 576, 539, 539, 539, 539, 534, 595, 534, 568, 867, 840, 714, 261, 261, 283, 487, 487, 509],
|
||||||
|
// DM Sans, Schnitt 0
|
||||||
|
[266, 250, 291, 804, 580, 786, 734, 159, 373, 373, 480, 550, 182, 541, 198, 392, 684, 312, 576, 591, 607, 610, 628, 534, 608, 628, 202, 227, 550, 550, 550, 524, 1005, 664, 603, 717, 688, 565, 535, 758, 681, 234, 501, 584, 527, 841, 691, 774, 580, 774, 594, 580, 561, 655, 669, 968, 603, 580, 541, 314, 392, 314, 622, 660, 213, 544, 626, 572, 627, 568, 340, 558, 575, 240, 243, 504, 223, 891, 574, 593, 626, 627, 370, 502, 392, 573, 527, 763, 496, 556, 458, 427, 234, 427, 550, 266, 250, 572, 601, 533, 602, 234, 586, 306, 794, 478, 452, 550, 0, 504, 381, 343, 550, 330, 330, 213, 584, 587, 198, 228, 204, 458, 452, 706, 745, 812, 524, 664, 664, 664, 664, 664, 664, 912, 717, 565, 565, 565, 565, 234, 234, 234, 234, 709, 691, 774, 774, 774, 774, 774, 550, 776, 655, 655, 655, 655, 580, 580, 659, 544, 544, 544, 544, 544, 544, 914, 572, 568, 568, 568, 568, 223, 223, 223, 223, 619, 574, 593, 593, 593, 593, 593, 550, 597, 573, 573, 573, 573, 556, 626, 556, 669, 873, 566, 771, 210, 210, 188, 367, 367, 348],
|
||||||
|
// DM Sans, Schnitt 1
|
||||||
|
[235, 309, 367, 857, 604, 902, 781, 197, 405, 405, 513, 579, 246, 576, 252, 427, 704, 364, 577, 603, 650, 622, 634, 537, 633, 635, 254, 278, 579, 579, 579, 538, 1046, 709, 638, 738, 707, 583, 556, 778, 714, 272, 541, 653, 558, 886, 729, 784, 614, 784, 631, 604, 597, 685, 706, 1018, 670, 635, 577, 377, 427, 377, 677, 725, 235, 586, 655, 607, 655, 602, 371, 596, 618, 274, 274, 578, 267, 941, 617, 610, 655, 655, 409, 532, 433, 616, 565, 820, 571, 604, 490, 470, 272, 470, 579, 235, 309, 607, 627, 560, 650, 272, 617, 339, 785, 506, 514, 579, 0, 510, 401, 363, 579, 361, 356, 235, 624, 652, 252, 266, 237, 486, 514, 838, 873, 925, 538, 709, 709, 709, 709, 709, 709, 945, 738, 583, 583, 583, 583, 272, 272, 272, 272, 719, 729, 784, 784, 784, 784, 784, 579, 777, 685, 685, 685, 685, 635, 614, 711, 586, 586, 586, 586, 586, 586, 944, 607, 602, 602, 602, 602, 267, 267, 267, 267, 640, 617, 610, 610, 610, 610, 610, 579, 594, 616, 616, 616, 616, 604, 655, 604, 696, 918, 687, 790, 255, 255, 255, 453, 453, 454],
|
||||||
|
// DM Sans, Schnitt 2
|
||||||
|
[282, 252, 316, 805, 583, 787, 735, 163, 373, 374, 479, 550, 182, 515, 200, 392, 687, 313, 587, 590, 608, 613, 621, 534, 605, 622, 205, 215, 550, 550, 550, 526, 995, 664, 604, 719, 692, 545, 528, 761, 682, 235, 489, 585, 528, 842, 692, 781, 584, 781, 595, 583, 560, 655, 669, 968, 604, 580, 541, 315, 694, 314, 622, 634, 213, 552, 621, 574, 622, 570, 340, 553, 576, 241, 252, 512, 224, 883, 574, 596, 622, 623, 371, 505, 386, 575, 540, 763, 495, 557, 464, 428, 235, 428, 550, 282, 252, 574, 601, 533, 602, 235, 588, 262, 800, 479, 452, 550, 0, 504, 349, 347, 550, 330, 329, 208, 585, 592, 200, 228, 204, 458, 452, 775, 854, 840, 525, 664, 664, 664, 664, 664, 664, 912, 719, 545, 545, 545, 545, 235, 235, 235, 235, 717, 692, 781, 781, 781, 781, 781, 550, 776, 655, 655, 655, 655, 580, 583, 660, 552, 552, 552, 552, 552, 552, 925, 574, 570, 570, 570, 570, 224, 224, 224, 224, 615, 574, 596, 596, 596, 596, 596, 550, 597, 575, 575, 575, 575, 557, 622, 557, 643, 847, 568, 778, 217, 217, 189, 375, 375, 357],
|
||||||
|
// DM Sans, Schnitt 3
|
||||||
|
[250, 311, 393, 857, 606, 903, 784, 203, 406, 406, 513, 579, 245, 532, 255, 427, 706, 364, 586, 603, 651, 623, 633, 537, 629, 633, 257, 264, 579, 579, 579, 541, 1035, 709, 639, 739, 711, 566, 545, 781, 714, 273, 536, 654, 559, 887, 730, 793, 617, 793, 631, 606, 598, 685, 706, 1017, 670, 635, 578, 378, 742, 378, 677, 682, 235, 592, 651, 609, 650, 604, 372, 567, 619, 276, 289, 586, 268, 934, 617, 614, 652, 652, 410, 537, 430, 618, 570, 820, 571, 605, 494, 471, 273, 471, 579, 250, 311, 609, 628, 561, 650, 273, 619, 313, 791, 507, 514, 579, 0, 510, 379, 368, 579, 361, 355, 231, 626, 656, 257, 266, 237, 486, 514, 867, 924, 943, 540, 709, 709, 709, 709, 709, 709, 945, 739, 566, 566, 566, 566, 273, 273, 273, 273, 726, 730, 793, 793, 793, 793, 793, 579, 778, 685, 685, 685, 685, 635, 617, 712, 592, 592, 592, 592, 592, 592, 951, 609, 604, 604, 604, 604, 267, 267, 267, 267, 638, 617, 614, 614, 614, 614, 614, 579, 594, 618, 618, 618, 618, 605, 652, 605, 652, 874, 690, 795, 277, 277, 255, 478, 478, 460],
|
||||||
|
// Public Sans, Schnitt 0
|
||||||
|
[243, 251, 426, 603, 658, 904, 708, 248, 302, 309, 394, 554, 242, 378, 225, 350, 612, 407, 596, 630, 628, 640, 622, 600, 648, 624, 226, 240, 546, 554, 546, 521, 831, 710, 670, 688, 694, 620, 594, 733, 766, 283, 388, 682, 578, 886, 754, 734, 636, 748, 676, 670, 594, 700, 672, 954, 688, 607, 637, 303, 350, 303, 473, 518, 218, 553, 596, 544, 596, 566, 396, 622, 576, 248, 262, 562, 303, 865, 577, 566, 596, 596, 391, 506, 389, 580, 504, 780, 564, 535, 480, 328, 263, 332, 568, 243, 252, 542, 613, 540, 612, 263, 490, 296, 817, 409, 454, 554, 378, 539, 328, 463, 554, 367, 402, 218, 586, 559, 230, 231, 240, 406, 478, 792, 866, 918, 518, 710, 710, 710, 710, 710, 710, 974, 688, 620, 620, 620, 620, 283, 283, 283, 283, 707, 754, 734, 734, 734, 734, 734, 540, 750, 700, 700, 700, 700, 607, 650, 590, 553, 553, 553, 553, 553, 553, 914, 544, 566, 566, 566, 566, 242, 242, 242, 302, 566, 577, 566, 566, 566, 566, 566, 554, 586, 580, 580, 580, 580, 535, 590, 535, 555, 1117, 768, 600, 240, 232, 242, 419, 410, 425],
|
||||||
|
// Public Sans, Schnitt 1
|
||||||
|
[226, 282, 480, 616, 680, 939, 784, 261, 333, 336, 473, 588, 277, 393, 270, 381, 644, 428, 635, 665, 656, 675, 660, 626, 671, 659, 270, 278, 578, 588, 578, 534, 828, 726, 684, 718, 720, 634, 614, 759, 770, 308, 402, 717, 578, 918, 782, 760, 652, 773, 696, 692, 616, 724, 704, 968, 717, 668, 670, 337, 381, 337, 484, 553, 264, 566, 608, 547, 608, 576, 396, 628, 592, 267, 288, 580, 329, 896, 593, 576, 607, 607, 412, 527, 416, 595, 520, 788, 588, 563, 496, 384, 268, 384, 612, 226, 282, 561, 648, 578, 659, 268, 512, 381, 830, 406, 500, 588, 393, 552, 393, 474, 588, 392, 425, 264, 604, 599, 259, 273, 256, 403, 511, 831, 902, 960, 544, 726, 726, 726, 726, 726, 726, 1040, 718, 634, 634, 634, 634, 308, 308, 308, 308, 749, 782, 760, 760, 760, 760, 760, 576, 776, 724, 724, 724, 724, 668, 680, 627, 566, 566, 566, 566, 566, 566, 914, 547, 576, 576, 576, 576, 264, 264, 264, 384, 576, 593, 576, 576, 576, 576, 576, 588, 612, 595, 595, 595, 595, 563, 604, 563, 592, 1148, 894, 652, 263, 262, 277, 480, 478, 498],
|
||||||
|
// Public Sans, Schnitt 2
|
||||||
|
[243, 248, 421, 582, 630, 840, 677, 244, 295, 302, 394, 534, 236, 364, 222, 337, 589, 396, 574, 606, 600, 616, 599, 576, 622, 601, 224, 238, 526, 536, 526, 498, 792, 681, 644, 666, 671, 601, 574, 707, 740, 284, 380, 658, 557, 853, 730, 705, 614, 720, 652, 655, 568, 676, 636, 907, 663, 579, 614, 298, 332, 298, 454, 499, 252, 532, 578, 522, 577, 544, 380, 594, 564, 246, 257, 540, 296, 830, 557, 542, 576, 577, 378, 488, 378, 562, 482, 742, 540, 510, 464, 316, 264, 320, 546, 243, 250, 535, 586, 520, 582, 264, 470, 270, 776, 385, 437, 534, 364, 513, 315, 446, 536, 350, 383, 211, 566, 538, 226, 222, 230, 381, 436, 738, 814, 857, 498, 681, 681, 681, 681, 681, 681, 930, 666, 601, 601, 601, 601, 284, 284, 284, 284, 706, 730, 705, 705, 705, 705, 705, 520, 716, 676, 676, 676, 676, 579, 628, 553, 550, 548, 548, 548, 548, 548, 878, 522, 544, 544, 544, 544, 245, 245, 245, 245, 545, 557, 542, 542, 542, 542, 542, 534, 530, 562, 562, 562, 562, 510, 568, 510, 534, 1117, 764, 572, 240, 232, 242, 422, 410, 426],
|
||||||
|
// Public Sans, Schnitt 3
|
||||||
|
[226, 280, 477, 598, 666, 872, 765, 258, 332, 334, 473, 578, 276, 386, 268, 378, 634, 424, 624, 654, 642, 663, 649, 613, 659, 648, 272, 280, 568, 580, 568, 522, 807, 710, 672, 706, 710, 628, 606, 744, 758, 312, 400, 704, 568, 904, 773, 746, 643, 758, 682, 690, 603, 712, 684, 943, 702, 652, 661, 338, 367, 338, 473, 543, 303, 557, 600, 536, 599, 563, 390, 615, 587, 266, 290, 570, 324, 878, 584, 564, 598, 598, 402, 518, 410, 586, 508, 768, 574, 550, 489, 380, 274, 380, 600, 226, 282, 576, 634, 570, 642, 274, 502, 369, 809, 382, 490, 578, 386, 538, 386, 465, 580, 383, 414, 262, 598, 588, 258, 268, 252, 378, 490, 807, 878, 931, 534, 710, 710, 710, 710, 710, 710, 1016, 706, 628, 628, 628, 628, 312, 312, 312, 312, 764, 773, 746, 746, 746, 746, 746, 566, 760, 712, 712, 712, 712, 652, 670, 586, 570, 566, 566, 566, 566, 566, 894, 536, 563, 563, 563, 563, 274, 274, 274, 274, 567, 584, 564, 564, 564, 564, 564, 578, 564, 586, 586, 586, 586, 550, 595, 550, 582, 1149, 894, 638, 264, 263, 287, 480, 478, 508],
|
||||||
|
// Karla, Schnitt 0
|
||||||
|
[238, 278, 304, 626, 630, 726, 914, 136, 356, 356, 412, 525, 209, 348, 178, 432, 594, 330, 580, 590, 558, 564, 572, 470, 614, 580, 230, 261, 525, 525, 525, 498, 938, 574, 622, 613, 660, 562, 524, 644, 668, 280, 404, 608, 468, 847, 684, 646, 554, 652, 612, 604, 500, 653, 562, 894, 642, 548, 592, 316, 432, 284, 525, 724, 324, 550, 592, 516, 592, 514, 342, 564, 604, 298, 314, 564, 280, 936, 604, 546, 584, 584, 362, 526, 376, 606, 502, 724, 512, 466, 474, 348, 280, 348, 525, 238, 278, 512, 564, 600, 548, 280, 600, 374, 690, 550, 572, 525, 0, 690, 414, 340, 525, 401, 402, 324, 606, 600, 178, 312, 258, 546, 572, 887, 932, 1030, 498, 574, 574, 574, 574, 574, 574, 840, 613, 562, 562, 562, 562, 280, 280, 280, 280, 660, 684, 646, 646, 646, 646, 646, 525, 646, 653, 653, 653, 653, 548, 554, 614, 550, 550, 550, 550, 550, 550, 847, 516, 514, 514, 514, 514, 298, 298, 298, 298, 561, 604, 546, 546, 546, 546, 546, 525, 546, 606, 606, 606, 606, 466, 600, 466, 472, 724, 542, 613, 212, 212, 234, 402, 397, 436],
|
||||||
|
// Karla, Schnitt 1
|
||||||
|
[253, 293, 382, 678, 689, 764, 965, 180, 400, 400, 409, 537, 253, 374, 215, 472, 632, 356, 605, 622, 595, 582, 607, 498, 646, 610, 270, 308, 537, 537, 537, 517, 1026, 626, 648, 634, 686, 586, 546, 677, 706, 304, 444, 654, 494, 874, 717, 682, 580, 686, 644, 638, 532, 690, 602, 946, 684, 586, 628, 352, 472, 336, 537, 768, 360, 585, 614, 530, 614, 530, 368, 582, 623, 328, 335, 592, 304, 949, 623, 566, 610, 610, 392, 528, 394, 627, 519, 758, 554, 504, 495, 391, 304, 391, 537, 253, 293, 528, 602, 600, 586, 304, 600, 427, 710, 585, 622, 537, 0, 710, 440, 388, 537, 410, 413, 360, 627, 600, 215, 314, 268, 566, 622, 965, 986, 1086, 517, 626, 626, 626, 626, 626, 626, 883, 634, 586, 586, 586, 586, 304, 304, 304, 304, 686, 717, 682, 682, 682, 682, 682, 537, 682, 690, 690, 690, 690, 586, 580, 648, 585, 585, 585, 585, 585, 585, 862, 530, 530, 530, 530, 530, 328, 328, 328, 328, 567, 623, 566, 566, 566, 566, 566, 537, 566, 627, 627, 627, 627, 504, 600, 504, 525, 768, 659, 634, 271, 271, 279, 491, 485, 516],
|
||||||
|
// Karla, Schnitt 2
|
||||||
|
[214, 250, 275, 564, 569, 653, 824, 122, 320, 320, 371, 500, 189, 314, 161, 389, 535, 298, 522, 532, 503, 508, 516, 423, 553, 523, 208, 236, 500, 500, 500, 449, 846, 517, 560, 552, 595, 506, 472, 580, 602, 252, 364, 548, 421, 763, 616, 581, 499, 587, 552, 544, 451, 589, 507, 805, 578, 494, 533, 285, 389, 256, 403, 653, 332, 504, 526, 463, 535, 463, 309, 508, 544, 269, 283, 508, 252, 841, 543, 491, 535, 526, 343, 473, 338, 545, 453, 652, 461, 436, 427, 314, 252, 314, 500, 214, 250, 463, 508, 600, 494, 252, 488, 334, 690, 504, 588, 500, 0, 690, 402, 326, 500, 364, 366, 327, 546, 600, 162, 290, 225, 491, 586, 855, 862, 932, 448, 517, 517, 517, 517, 517, 517, 744, 552, 506, 506, 506, 506, 252, 252, 252, 252, 595, 616, 581, 581, 581, 581, 581, 500, 581, 589, 589, 589, 589, 494, 499, 559, 504, 504, 504, 504, 504, 504, 770, 463, 463, 463, 463, 463, 269, 269, 269, 269, 520, 543, 491, 491, 491, 491, 491, 500, 491, 545, 545, 545, 545, 436, 535, 436, 427, 653, 546, 552, 193, 193, 210, 362, 364, 367],
|
||||||
|
// Karla, Schnitt 3
|
||||||
|
[228, 264, 345, 610, 620, 688, 868, 162, 360, 360, 368, 500, 228, 336, 193, 425, 570, 321, 544, 560, 535, 524, 546, 448, 582, 549, 243, 277, 500, 500, 500, 465, 924, 563, 583, 571, 617, 527, 492, 609, 635, 274, 400, 589, 445, 787, 645, 615, 523, 617, 580, 574, 479, 621, 546, 869, 616, 544, 566, 317, 425, 302, 474, 691, 362, 526, 553, 477, 553, 477, 329, 524, 561, 295, 301, 517, 274, 854, 561, 509, 549, 549, 374, 474, 355, 564, 467, 682, 499, 454, 445, 352, 274, 403, 500, 228, 264, 477, 542, 600, 544, 274, 482, 382, 710, 526, 632, 500, 0, 710, 427, 358, 500, 370, 376, 360, 564, 600, 193, 292, 234, 509, 630, 891, 910, 1000, 464, 563, 563, 563, 563, 563, 563, 780, 571, 527, 527, 527, 527, 274, 274, 274, 274, 617, 645, 615, 615, 615, 615, 615, 500, 618, 621, 621, 621, 621, 544, 523, 596, 526, 526, 526, 526, 526, 526, 784, 477, 477, 477, 477, 477, 295, 295, 295, 295, 544, 561, 509, 509, 509, 509, 509, 500, 509, 564, 564, 564, 564, 454, 549, 454, 472, 691, 652, 571, 244, 244, 246, 446, 450, 448],
|
||||||
|
// Rubik, Schnitt 0
|
||||||
|
[245, 245, 374, 697, 618, 761, 694, 218, 339, 339, 446, 622, 249, 484, 252, 482, 635, 428, 587, 601, 621, 594, 603, 513, 636, 593, 256, 271, 492, 570, 491, 531, 832, 670, 668, 666, 689, 606, 584, 681, 714, 273, 634, 601, 563, 794, 695, 677, 642, 677, 655, 622, 579, 701, 655, 801, 633, 647, 600, 326, 481, 326, 432, 748, 337, 552, 595, 552, 595, 560, 385, 597, 609, 242, 254, 516, 243, 889, 606, 574, 596, 596, 380, 510, 391, 602, 554, 802, 539, 552, 509, 368, 233, 368, 560, 245, 237, 560, 677, 589, 617, 238, 569, 401, 826, 364, 608, 578, 600, 826, 400, 388, 560, 341, 341, 337, 607, 532, 330, 313, 258, 359, 608, 776, 774, 860, 525, 670, 670, 670, 670, 670, 670, 936, 666, 606, 606, 606, 606, 273, 273, 273, 273, 699, 695, 677, 677, 677, 677, 677, 559, 677, 701, 701, 701, 701, 647, 647, 589, 552, 552, 552, 552, 552, 552, 891, 552, 560, 560, 560, 560, 242, 242, 242, 242, 567, 606, 574, 574, 574, 574, 574, 556, 574, 602, 602, 602, 602, 552, 596, 552, 574, 764, 617, 744, 235, 228, 249, 395, 388, 409],
|
||||||
|
// Rubik, Schnitt 1
|
||||||
|
[213, 291, 452, 686, 668, 807, 742, 243, 384, 384, 445, 607, 278, 477, 284, 534, 680, 497, 650, 659, 683, 646, 651, 573, 677, 641, 292, 300, 517, 566, 516, 597, 845, 716, 704, 702, 716, 639, 618, 720, 745, 324, 671, 663, 597, 828, 719, 712, 676, 712, 691, 663, 630, 725, 693, 831, 690, 681, 650, 383, 533, 383, 464, 736, 398, 590, 631, 590, 631, 594, 443, 634, 650, 286, 303, 585, 286, 916, 643, 611, 631, 631, 454, 553, 467, 641, 595, 838, 588, 597, 553, 425, 265, 425, 554, 213, 284, 597, 721, 613, 689, 269, 605, 459, 808, 357, 621, 570, 600, 808, 439, 411, 569, 356, 354, 398, 657, 627, 330, 296, 294, 354, 621, 845, 829, 906, 592, 716, 716, 716, 716, 716, 716, 973, 702, 639, 639, 639, 639, 324, 324, 324, 324, 735, 719, 712, 712, 712, 712, 712, 602, 712, 725, 725, 725, 725, 681, 678, 639, 590, 590, 590, 590, 590, 590, 915, 590, 594, 594, 594, 594, 286, 286, 286, 286, 605, 643, 611, 611, 611, 611, 611, 535, 611, 641, 641, 641, 641, 597, 632, 597, 567, 757, 740, 785, 270, 264, 278, 490, 485, 498],
|
||||||
|
// Rubik, Schnitt 2
|
||||||
|
[250, 246, 373, 697, 618, 783, 694, 217, 337, 337, 446, 616, 252, 484, 248, 487, 633, 424, 587, 601, 623, 593, 603, 513, 633, 593, 257, 271, 492, 572, 491, 531, 832, 673, 671, 665, 689, 605, 587, 681, 714, 274, 630, 590, 556, 797, 697, 677, 643, 677, 655, 620, 574, 701, 655, 791, 634, 644, 596, 325, 480, 325, 432, 744, 215, 586, 595, 551, 594, 558, 381, 595, 609, 243, 255, 516, 244, 890, 606, 572, 594, 595, 382, 510, 384, 602, 552, 802, 538, 555, 506, 368, 233, 368, 560, 250, 246, 559, 677, 589, 617, 240, 569, 313, 825, 361, 608, 581, 600, 826, 306, 387, 557, 341, 341, 259, 607, 532, 329, 251, 281, 356, 608, 807, 805, 868, 525, 673, 673, 673, 673, 673, 673, 957, 665, 605, 605, 605, 605, 274, 274, 274, 274, 698, 697, 677, 677, 677, 677, 677, 555, 677, 701, 701, 701, 701, 644, 646, 589, 586, 586, 586, 586, 586, 586, 891, 551, 558, 558, 558, 558, 243, 243, 243, 243, 567, 606, 572, 572, 572, 572, 572, 552, 572, 602, 602, 602, 602, 555, 594, 555, 574, 764, 617, 742, 240, 233, 252, 402, 395, 414],
|
||||||
|
// Rubik, Schnitt 3
|
||||||
|
[217, 291, 451, 686, 670, 838, 742, 241, 383, 383, 445, 603, 286, 476, 282, 539, 678, 494, 650, 659, 694, 645, 651, 573, 674, 641, 292, 300, 517, 568, 516, 597, 845, 721, 705, 701, 716, 638, 619, 720, 745, 324, 667, 656, 592, 828, 720, 712, 677, 712, 691, 662, 627, 725, 693, 825, 690, 679, 648, 382, 525, 382, 464, 733, 293, 626, 630, 589, 630, 592, 440, 633, 650, 286, 303, 588, 287, 916, 643, 609, 630, 631, 456, 553, 462, 640, 595, 840, 588, 604, 552, 425, 264, 425, 554, 217, 291, 599, 721, 613, 689, 269, 605, 396, 809, 355, 621, 571, 600, 809, 371, 410, 567, 356, 354, 339, 655, 629, 337, 253, 308, 352, 621, 872, 855, 918, 592, 721, 721, 721, 721, 721, 721, 989, 701, 638, 638, 638, 638, 324, 324, 324, 324, 732, 720, 712, 712, 712, 712, 712, 598, 712, 725, 725, 725, 725, 679, 677, 639, 626, 626, 626, 626, 626, 626, 915, 589, 592, 592, 592, 592, 286, 286, 286, 286, 605, 643, 609, 609, 609, 609, 609, 532, 609, 640, 640, 640, 640, 604, 630, 604, 566, 756, 740, 785, 278, 272, 286, 506, 499, 512],
|
||||||
|
// Jost, Schnitt 0
|
||||||
|
[300, 300, 465, 605, 580, 751, 675, 285, 310, 310, 592, 615, 308, 210, 300, 515, 600, 450, 569, 546, 583, 564, 576, 525, 546, 576, 300, 330, 640, 615, 640, 557, 770, 660, 558, 685, 680, 550, 500, 775, 715, 245, 240, 565, 450, 810, 775, 790, 548, 790, 560, 548, 465, 626, 660, 990, 555, 561, 545, 300, 515, 300, 510, 500, 375, 481, 570, 478, 570, 515, 286, 570, 525, 260, 250, 440, 230, 780, 525, 546, 570, 570, 343, 403, 240, 525, 440, 680, 420, 440, 460, 311, 274, 311, 575, 300, 300, 580, 580, 580, 580, 274, 408, 470, 800, 238, 510, 620, 210, 800, 510, 278, 615, 346, 312, 375, 525, 578, 300, 350, 470, 278, 510, 754, 819, 820, 557, 660, 660, 660, 660, 660, 660, 960, 685, 550, 550, 550, 550, 245, 245, 245, 245, 680, 775, 790, 790, 790, 790, 790, 596, 790, 626, 626, 626, 626, 561, 550, 565, 485, 485, 485, 485, 485, 485, 825, 478, 515, 515, 515, 515, 260, 260, 260, 260, 576, 525, 546, 546, 546, 546, 546, 623, 546, 525, 525, 525, 525, 440, 570, 440, 740, 890, 900, 580, 275, 275, 275, 475, 475, 475],
|
||||||
|
// Jost, Schnitt 1
|
||||||
|
[300, 344, 518, 667, 622, 919, 752, 307, 341, 341, 592, 674, 324, 222, 322, 608, 662, 509, 656, 621, 698, 645, 669, 603, 627, 669, 322, 393, 640, 626, 640, 627, 770, 735, 664, 701, 733, 603, 553, 814, 786, 320, 330, 699, 528, 891, 794, 821, 623, 863, 647, 625, 561, 701, 735, 1065, 686, 660, 620, 362, 546, 362, 510, 531, 375, 539, 617, 494, 617, 573, 344, 610, 569, 276, 272, 577, 270, 820, 575, 590, 617, 617, 411, 456, 318, 575, 527, 761, 532, 521, 522, 398, 352, 398, 575, 300, 344, 580, 611, 577, 669, 352, 576, 511, 800, 270, 541, 650, 210, 800, 532, 297, 634, 408, 365, 375, 575, 671, 322, 394, 482, 278, 541, 822, 894, 879, 627, 735, 735, 735, 735, 735, 735, 1084, 701, 603, 603, 603, 603, 320, 320, 320, 320, 733, 794, 821, 821, 821, 821, 821, 596, 790, 701, 701, 701, 701, 660, 612, 603, 544, 544, 544, 544, 544, 544, 896, 494, 573, 573, 573, 573, 276, 276, 276, 276, 626, 575, 590, 590, 590, 590, 590, 640, 546, 575, 575, 575, 575, 521, 617, 521, 784, 940, 925, 655, 331, 331, 331, 562, 562, 562],
|
||||||
|
// Jost, Schnitt 2
|
||||||
|
[301, 291, 451, 587, 563, 729, 655, 277, 301, 301, 575, 597, 299, 204, 291, 500, 582, 437, 552, 530, 566, 547, 559, 509, 530, 559, 291, 320, 621, 597, 621, 541, 747, 640, 542, 665, 660, 534, 485, 752, 694, 238, 233, 548, 437, 786, 752, 767, 532, 767, 543, 532, 451, 608, 640, 961, 539, 544, 529, 291, 500, 291, 495, 485, 364, 553, 553, 464, 553, 500, 278, 553, 509, 252, 243, 427, 223, 757, 509, 530, 553, 553, 333, 391, 233, 509, 427, 660, 408, 427, 446, 302, 266, 302, 558, 301, 291, 563, 563, 563, 563, 266, 396, 456, 776, 231, 495, 602, 204, 776, 495, 270, 597, 336, 303, 364, 509, 561, 291, 340, 456, 270, 495, 732, 795, 796, 541, 640, 640, 640, 640, 640, 640, 932, 665, 534, 534, 534, 534, 238, 238, 238, 238, 660, 752, 767, 767, 767, 767, 767, 578, 767, 608, 608, 608, 608, 544, 534, 565, 553, 553, 553, 553, 553, 553, 801, 464, 500, 500, 500, 500, 252, 252, 252, 252, 576, 509, 530, 530, 530, 530, 530, 605, 530, 509, 509, 509, 509, 427, 553, 427, 718, 864, 873, 563, 267, 267, 267, 461, 461, 461],
|
||||||
|
// Jost, Schnitt 3
|
||||||
|
[301, 333, 503, 647, 603, 892, 730, 298, 331, 331, 575, 654, 314, 216, 313, 590, 642, 494, 637, 602, 677, 625, 650, 585, 608, 650, 313, 381, 621, 608, 621, 608, 747, 713, 644, 680, 711, 585, 537, 790, 763, 310, 321, 679, 512, 864, 770, 797, 604, 838, 628, 607, 545, 680, 713, 1033, 665, 640, 601, 351, 530, 351, 495, 515, 364, 598, 598, 475, 598, 557, 334, 592, 551, 268, 264, 559, 262, 796, 557, 572, 598, 598, 403, 443, 308, 557, 512, 738, 516, 505, 506, 387, 342, 387, 558, 301, 333, 563, 593, 560, 649, 342, 559, 496, 776, 262, 525, 631, 204, 776, 516, 288, 615, 396, 354, 364, 569, 651, 313, 382, 468, 270, 525, 798, 867, 853, 608, 713, 713, 713, 713, 713, 713, 1053, 680, 585, 585, 585, 585, 310, 310, 310, 310, 711, 770, 797, 797, 797, 797, 797, 578, 767, 680, 680, 680, 680, 640, 594, 603, 598, 598, 598, 598, 598, 598, 887, 479, 557, 557, 557, 557, 268, 268, 268, 268, 626, 557, 572, 572, 572, 572, 572, 621, 530, 557, 557, 557, 557, 505, 598, 505, 760, 912, 897, 635, 321, 321, 321, 546, 546, 546],
|
||||||
|
// Archivo, Schnitt 0
|
||||||
|
[209, 273, 374, 582, 510, 950, 692, 209, 355, 355, 407, 625, 277, 333, 277, 294, 573, 521, 567, 573, 555, 571, 573, 553, 574, 573, 296, 296, 625, 625, 625, 578, 1005, 682, 698, 728, 734, 677, 612, 796, 736, 267, 559, 662, 536, 847, 736, 788, 665, 788, 727, 673, 606, 731, 648, 924, 680, 655, 635, 296, 294, 296, 625, 485, 187, 545, 567, 519, 567, 548, 280, 556, 563, 225, 223, 514, 225, 860, 563, 570, 567, 567, 332, 510, 297, 562, 504, 723, 513, 504, 498, 353, 245, 353, 625, 209, 273, 567, 569, 569, 562, 245, 568, 280, 752, 385, 550, 625, 333, 752, 300, 400, 625, 346, 346, 187, 567, 565, 333, 209, 346, 379, 550, 845, 845, 845, 578, 682, 682, 682, 682, 682, 682, 1000, 728, 677, 677, 677, 677, 267, 267, 267, 267, 734, 736, 788, 788, 788, 788, 788, 625, 788, 731, 731, 731, 731, 655, 679, 619, 545, 545, 545, 545, 545, 545, 894, 519, 548, 548, 548, 548, 225, 225, 225, 225, 567, 563, 570, 570, 570, 570, 570, 625, 570, 562, 562, 562, 562, 504, 562, 504, 500, 1000, 844, 581, 239, 239, 239, 394, 394, 394],
|
||||||
|
// Archivo, Schnitt 1
|
||||||
|
[196, 301, 456, 600, 556, 973, 764, 253, 364, 364, 407, 641, 307, 333, 307, 300, 595, 596, 596, 596, 597, 595, 596, 596, 596, 595, 335, 335, 641, 641, 641, 613, 1001, 724, 722, 733, 739, 683, 622, 802, 754, 301, 603, 725, 591, 872, 754, 793, 681, 793, 730, 679, 641, 748, 694, 964, 706, 699, 653, 350, 300, 350, 641, 518, 228, 580, 608, 573, 608, 584, 325, 607, 602, 267, 264, 570, 267, 891, 602, 613, 608, 608, 380, 556, 342, 601, 547, 798, 572, 547, 519, 393, 253, 393, 641, 196, 301, 597, 599, 597, 595, 253, 598, 326, 772, 398, 576, 641, 333, 772, 307, 400, 641, 371, 371, 228, 605, 616, 333, 237, 371, 393, 576, 887, 887, 887, 613, 724, 724, 724, 724, 724, 724, 1004, 733, 683, 683, 683, 683, 301, 301, 301, 301, 739, 754, 793, 793, 793, 793, 793, 641, 793, 748, 748, 748, 748, 699, 697, 634, 580, 580, 580, 580, 580, 580, 920, 573, 584, 584, 584, 584, 267, 267, 267, 267, 626, 602, 613, 613, 613, 613, 613, 641, 613, 601, 601, 601, 601, 547, 608, 547, 500, 1000, 973, 599, 280, 280, 280, 488, 488, 488],
|
||||||
|
// Archivo, Schnitt 2
|
||||||
|
[209, 273, 374, 582, 510, 950, 692, 209, 355, 355, 407, 625, 277, 333, 277, 294, 573, 521, 567, 573, 555, 571, 573, 553, 574, 573, 296, 296, 625, 625, 625, 578, 1005, 682, 698, 728, 734, 677, 612, 796, 736, 267, 559, 662, 536, 847, 736, 788, 665, 788, 727, 673, 606, 731, 648, 924, 680, 655, 635, 296, 294, 296, 625, 485, 178, 561, 567, 519, 567, 548, 280, 556, 563, 226, 223, 514, 225, 860, 563, 570, 567, 567, 332, 510, 297, 562, 504, 723, 513, 504, 498, 353, 245, 353, 625, 209, 273, 570, 569, 569, 562, 245, 568, 280, 752, 385, 550, 625, 333, 752, 300, 400, 625, 346, 346, 187, 567, 565, 333, 210, 346, 379, 550, 845, 845, 845, 626, 682, 682, 682, 682, 682, 682, 1000, 728, 677, 677, 677, 677, 267, 267, 267, 267, 734, 736, 788, 788, 788, 788, 788, 625, 788, 731, 731, 731, 731, 655, 679, 619, 561, 561, 561, 561, 561, 561, 894, 519, 548, 548, 548, 548, 226, 226, 226, 226, 567, 563, 570, 570, 570, 570, 570, 625, 570, 562, 562, 562, 562, 504, 562, 504, 500, 1000, 844, 581, 238, 238, 239, 393, 393, 394],
|
||||||
|
// Archivo, Schnitt 3
|
||||||
|
[196, 301, 456, 600, 556, 973, 764, 253, 364, 364, 407, 641, 307, 333, 307, 300, 595, 596, 596, 596, 597, 595, 596, 596, 596, 595, 335, 335, 641, 641, 641, 613, 1001, 724, 722, 733, 739, 683, 622, 802, 754, 301, 603, 725, 591, 872, 754, 793, 681, 793, 730, 679, 641, 748, 694, 964, 706, 699, 653, 350, 300, 350, 641, 518, 219, 604, 608, 573, 608, 584, 325, 607, 602, 267, 264, 570, 267, 891, 602, 613, 608, 608, 380, 556, 342, 601, 547, 798, 572, 547, 519, 393, 253, 393, 641, 196, 301, 580, 599, 597, 595, 253, 598, 325, 772, 398, 576, 641, 333, 772, 307, 400, 641, 371, 371, 228, 605, 616, 333, 238, 371, 393, 576, 887, 887, 887, 613, 724, 724, 724, 724, 724, 724, 1004, 733, 683, 683, 683, 683, 301, 301, 301, 301, 739, 754, 793, 793, 793, 793, 793, 641, 793, 748, 748, 748, 748, 699, 697, 634, 604, 604, 604, 604, 604, 604, 920, 573, 584, 584, 584, 584, 267, 267, 267, 267, 626, 602, 613, 613, 613, 613, 613, 641, 613, 601, 601, 601, 601, 547, 608, 547, 500, 1000, 973, 599, 280, 280, 280, 488, 488, 488],
|
||||||
|
// Source Serif 4, Schnitt 0
|
||||||
|
[237, 289, 381, 525, 518, 932, 728, 182, 362, 362, 458, 534, 302, 320, 302, 341, 529, 529, 529, 529, 529, 529, 529, 529, 529, 529, 302, 302, 534, 534, 534, 414, 834, 712, 653, 662, 739, 638, 612, 723, 814, 376, 381, 710, 618, 935, 768, 738, 621, 738, 690, 544, 632, 758, 709, 1005, 672, 667, 586, 335, 341, 335, 534, 514, 400, 541, 619, 520, 614, 533, 369, 557, 641, 329, 303, 594, 329, 955, 643, 579, 622, 601, 456, 465, 359, 628, 579, 836, 569, 586, 490, 359, 290, 359, 534, 237, 289, 518, 519, 501, 518, 290, 494, 400, 756, 376, 540, 534, 320, 460, 400, 344, 534, 381, 381, 400, 617, 599, 302, 400, 381, 400, 540, 902, 932, 902, 414, 712, 712, 712, 712, 712, 712, 956, 662, 638, 638, 638, 638, 376, 376, 376, 376, 739, 768, 738, 738, 738, 738, 738, 534, 738, 758, 758, 758, 758, 667, 624, 630, 541, 541, 541, 541, 541, 541, 827, 520, 533, 533, 533, 533, 329, 329, 329, 329, 565, 643, 579, 579, 579, 579, 579, 534, 579, 628, 628, 628, 628, 586, 607, 586, 514, 814, 826, 518, 225, 225, 225, 440, 440, 440],
|
||||||
|
// Source Serif 4, Schnitt 1
|
||||||
|
[218, 343, 471, 566, 562, 970, 751, 235, 409, 409, 459, 563, 312, 352, 312, 390, 569, 569, 569, 569, 569, 569, 569, 569, 569, 569, 312, 312, 563, 563, 563, 448, 905, 712, 686, 664, 751, 630, 608, 727, 803, 400, 409, 744, 614, 925, 746, 746, 655, 746, 728, 578, 671, 756, 703, 1037, 685, 667, 599, 380, 390, 380, 563, 543, 400, 570, 643, 535, 634, 547, 381, 591, 660, 344, 325, 640, 346, 969, 662, 602, 644, 626, 497, 487, 379, 654, 584, 866, 603, 598, 506, 371, 315, 371, 563, 218, 343, 562, 562, 543, 562, 315, 537, 400, 745, 396, 609, 563, 352, 470, 400, 344, 563, 400, 400, 400, 636, 649, 312, 400, 400, 418, 609, 936, 970, 936, 448, 712, 712, 712, 712, 712, 712, 929, 664, 630, 630, 630, 630, 400, 400, 400, 400, 751, 746, 746, 746, 746, 746, 746, 563, 746, 756, 756, 756, 756, 667, 654, 686, 570, 570, 570, 570, 570, 570, 835, 535, 547, 547, 547, 547, 344, 344, 344, 344, 590, 662, 602, 602, 602, 602, 602, 563, 602, 654, 654, 654, 654, 598, 640, 598, 543, 843, 884, 562, 248, 248, 248, 483, 482, 482],
|
||||||
|
// Source Serif 4, Schnitt 2
|
||||||
|
[227, 305, 456, 573, 524, 928, 701, 259, 385, 385, 480, 534, 300, 314, 300, 339, 537, 537, 537, 537, 537, 537, 537, 537, 537, 537, 300, 300, 534, 534, 534, 459, 880, 683, 622, 614, 703, 604, 572, 669, 772, 365, 361, 688, 584, 935, 746, 674, 571, 674, 646, 505, 591, 725, 652, 917, 667, 593, 561, 345, 331, 345, 534, 512, 400, 554, 524, 434, 557, 442, 325, 511, 580, 320, 275, 497, 298, 869, 596, 526, 543, 520, 426, 383, 354, 597, 511, 777, 564, 515, 493, 390, 286, 390, 534, 227, 305, 524, 524, 511, 524, 286, 465, 400, 798, 397, 576, 534, 314, 473, 400, 328, 534, 374, 374, 400, 574, 597, 300, 400, 374, 377, 576, 896, 928, 896, 459, 683, 683, 683, 683, 683, 683, 912, 614, 604, 604, 604, 604, 365, 365, 365, 365, 703, 746, 674, 674, 674, 674, 674, 534, 674, 725, 725, 725, 725, 593, 568, 547, 554, 554, 554, 554, 554, 554, 719, 434, 442, 442, 442, 442, 320, 320, 320, 320, 518, 596, 526, 526, 526, 526, 526, 534, 526, 597, 597, 597, 597, 515, 535, 515, 512, 812, 820, 524, 273, 273, 273, 485, 485, 485],
|
||||||
|
// Source Serif 4, Schnitt 3
|
||||||
|
[214, 309, 511, 603, 564, 984, 750, 279, 404, 404, 470, 563, 318, 345, 318, 390, 575, 575, 575, 575, 575, 575, 575, 575, 575, 575, 318, 318, 563, 563, 563, 462, 894, 708, 648, 622, 719, 603, 577, 681, 782, 393, 380, 717, 583, 916, 719, 695, 617, 695, 692, 518, 621, 704, 664, 948, 658, 619, 573, 367, 387, 367, 563, 538, 400, 608, 579, 493, 612, 502, 375, 577, 629, 338, 311, 566, 335, 930, 640, 577, 593, 588, 492, 442, 385, 640, 550, 839, 609, 569, 535, 360, 311, 360, 563, 214, 309, 564, 564, 546, 564, 311, 519, 400, 781, 425, 634, 563, 345, 480, 400, 328, 563, 400, 400, 400, 626, 648, 318, 400, 400, 402, 634, 950, 984, 950, 462, 708, 708, 708, 708, 708, 708, 910, 622, 603, 603, 603, 603, 393, 393, 393, 393, 719, 719, 695, 695, 695, 695, 695, 563, 695, 704, 704, 704, 704, 619, 618, 628, 608, 608, 608, 608, 608, 608, 800, 493, 502, 502, 502, 502, 338, 338, 338, 338, 566, 640, 577, 577, 577, 577, 577, 563, 577, 640, 640, 640, 640, 569, 588, 569, 538, 838, 902, 564, 284, 284, 284, 520, 520, 520],
|
||||||
|
];
|
||||||
@@ -25,7 +25,7 @@ fn texts_of(segs: &[f64], greyed: &[f64], paper_scale_n: f64, screen: Option<Scr
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Textzeilen als `[n, (x, y, sizeMm, r, g, b, a, code, nUtf16)*, UTF-16-Einheiten…]`; `code` =
|
/// Textzeilen als `[n, (x, y, sizeMm, r, g, b, a, code, nUtf16)*, UTF-16-Einheiten…]`; `code` =
|
||||||
/// Ausrichtung (unteres Byte) | Schnitt << 8, nur mit `style`.
|
/// Ausrichtung (unteres Byte) | Schnitt << 8 | Familie << 16 ([226]), nur mit `style`.
|
||||||
fn texts_f64(texts: &[SText], style: bool) -> Vec<f64> {
|
fn texts_f64(texts: &[SText], style: bool) -> Vec<f64> {
|
||||||
let mut out = Vec::with_capacity(1 + texts.len() * 12);
|
let mut out = Vec::with_capacity(1 + texts.len() * 12);
|
||||||
out.push(texts.len() as f64);
|
out.push(texts.len() as f64);
|
||||||
@@ -34,7 +34,7 @@ fn texts_f64(texts: &[SText], style: bool) -> Vec<f64> {
|
|||||||
let s = String::from_utf8_lossy(&t.content);
|
let s = String::from_utf8_lossy(&t.content);
|
||||||
let n0 = units.len();
|
let n0 = units.len();
|
||||||
units.extend(s.encode_utf16().map(f64::from));
|
units.extend(s.encode_utf16().map(f64::from));
|
||||||
let code = if style { t.align | (t.style << 8) } else { t.align };
|
let code = if style { t.align | (t.style << 8) | (t.family << 16) } else { t.align };
|
||||||
out.extend_from_slice(&[t.pos.x, t.pos.y, t.size_mm, t.color[0], t.color[1], t.color[2], t.color[3], code as f64, (units.len() - n0) as f64]);
|
out.extend_from_slice(&[t.pos.x, t.pos.y, t.size_mm, t.color[0], t.color[1], t.color[2], t.color[3], code as f64, (units.len() - n0) as f64]);
|
||||||
}
|
}
|
||||||
out.extend(units);
|
out.extend(units);
|
||||||
@@ -68,7 +68,7 @@ pub fn plan_scene_texts(segs: &[f64], greyed: &[f64], paper_scale_n: f64) -> Vec
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Textzeilen der BILDSCHIRM-Szene für die native Fläche ([194], `native2d_scene_texts`): Format wie
|
/// Textzeilen der BILDSCHIRM-Szene für die native Fläche ([194], `native2d_scene_texts`): Format wie
|
||||||
/// `plan_scene_texts`, Kennung = Ausrichtung | Schnitt << 8 (Bit 0 fett, Bit 1 kursiv); ohne gedrehte
|
/// `plan_scene_texts`, Kennung = Ausrichtung | Schnitt << 8 (Bit 0 fett, Bit 1 kursiv) | Familie << 16 ([226]); ohne gedrehte
|
||||||
/// Einzeltexte und ohne den Eintrag mit Plan-Index `skip` (Text im Editor; < 0 = keiner). Leer = Fehler.
|
/// Einzeltexte und ohne den Eintrag mit Plan-Index `skip` (Text im Editor; < 0 = keiner). Leer = Fehler.
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
pub fn plan_screen_texts(segs: &[f64], greyed: &[f64], paper_scale_n: f64, skip: f64) -> Vec<f64> {
|
pub fn plan_screen_texts(segs: &[f64], greyed: &[f64], paper_scale_n: f64, skip: f64) -> Vec<f64> {
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ headless = ["render", "dep:image"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
|
# WOFF2-Schriften fuer den Glyphen-Pass (src/woff2.rs, [226]); reiner Rust-Dekoder, auch wasm.
|
||||||
|
brotli-decompressor = "5"
|
||||||
|
|
||||||
# --- GPU (nur mit Feature "render") ------------------------------------------
|
# --- GPU (nur mit Feature "render") ------------------------------------------
|
||||||
# Standard-Features von wgpu (wgsl, webgpu, dx12, metal + target-spezifisch
|
# Standard-Features von wgpu (wgsl, webgpu, dx12, metal + target-spezifisch
|
||||||
|
|||||||
@@ -558,6 +558,21 @@ impl ChunkRenderer {
|
|||||||
self.scene_text_n = if n.is_finite() && n > 0.0 { n } else { 100.0 };
|
self.scene_text_n = if n.is_finite() && n > 0.0 { n } else { 100.0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// [226] Schriftdatei (WOFF2/SFNT) fuer `key` = Familie << 8 | Schnitt (`glyph::font_key`) einspielen.
|
||||||
|
pub fn add_font(&mut self, key: u32, bytes: &[u8]) -> bool {
|
||||||
|
self.scene_text.add_font(key >> 8, key & 0xff, bytes).is_ok()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// [226] Es gibt keine Datei fuer `key` (nicht weiter anfordern).
|
||||||
|
pub fn mark_font_unavailable(&mut self, key: u32) {
|
||||||
|
self.scene_text.mark_font_unavailable(key >> 8, key & 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// [226] Schriftdateien (`font_key`), die die aktuellen Textzeilen noch brauchen.
|
||||||
|
pub fn needed_fonts(&self) -> Vec<u32> {
|
||||||
|
self.scene_text.needed_fonts()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn scene_text_count(&self) -> usize {
|
pub fn scene_text_count(&self) -> usize {
|
||||||
self.scene_text.lines().len()
|
self.scene_text.lines().len()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ pub fn demo_scene() -> Scene {
|
|||||||
color: ink,
|
color: ink,
|
||||||
align: TextAlign::Center,
|
align: TextAlign::Center,
|
||||||
style: 0,
|
style: 0,
|
||||||
|
family: 0,
|
||||||
}],
|
}],
|
||||||
line_ends: 0,
|
line_ends: 0,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,44 @@
|
|||||||
// Linien, mit derselben Schrift (eingebettetes Inter) und derselben Zeilenlage (gesetzt im Kern,
|
// Linien, mit derselben Schrift (eingebettetes Inter) und derselben Zeilenlage (gesetzt im Kern,
|
||||||
// `core/src/plan/text.rs`), statt im SVG-Overlay der Webview.
|
// `core/src/plan/text.rs`), statt im SVG-Overlay der Webview.
|
||||||
//
|
//
|
||||||
|
// Schriftfamilien ([226]): `GlyphLine::family` waehlt eine der gebuendelten Familien (0 = Inter). Die Bytes
|
||||||
|
// kommen LAZY von aussen (`add_font`, WOFF2 oder SFNT, je Familie und Schnitt); `needed_fonts` sagt, was
|
||||||
|
// die aktuellen Zeilen noch brauchen. Fehlt eine Familie (noch nicht geladen, Datei fehlt, kaputt), zeichnet
|
||||||
|
// der Pass in Inter; fehlt nur der Schnitt (z. B. kursiv), in der naechstbesten Variante derselben Familie.
|
||||||
|
// Die Familiennamen in den Dateien sind unzuverlaessig (Instanzen heissen "Archivo SemiBold" o. ae.),
|
||||||
|
// darum merkt sich der Pass je geladener Datei Name, Gewicht und Neigung und fragt genau damit ab.
|
||||||
|
//
|
||||||
// Jede Zeile wird EINMAL bei einer Referenzgroesse geshapt; pro Frame aendert sich nur der Massstab
|
// Jede Zeile wird EINMAL bei einer Referenzgroesse geshapt; pro Frame aendert sich nur der Massstab
|
||||||
// (`TextArea::scale`) und die Lage — Pan/Zoom kostet kein erneutes Shaping. Die Glyphen rastert
|
// (`TextArea::scale`) und die Lage — Pan/Zoom kostet kein erneutes Shaping. Die Glyphen rastert
|
||||||
// glyphon in der tatsaechlichen Pixelgroesse (scharf bei jedem Zoom).
|
// glyphon in der tatsaechlichen Pixelgroesse (scharf bei jedem Zoom).
|
||||||
|
|
||||||
use crate::text_lines::GlyphLine;
|
use crate::text_lines::GlyphLine;
|
||||||
use crate::types::{TextAlign, STYLE_BOLD, STYLE_ITALIC};
|
use crate::types::{TextAlign, STYLE_BOLD, STYLE_ITALIC};
|
||||||
|
use std::collections::{HashMap, HashSet};
|
||||||
|
|
||||||
|
/// Schluessel einer Schriftdatei: Familie << 8 | Schnitt (`STYLE_BOLD` | `STYLE_ITALIC`).
|
||||||
|
pub fn font_key(family: u32, style: u32) -> u32 {
|
||||||
|
(family << 8) | (style & (STYLE_BOLD | STYLE_ITALIC))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Geladene Datei: wie sie in fontdb heisst und welcher Schnitt sie ist.
|
||||||
|
#[derive(Clone)]
|
||||||
|
struct Face {
|
||||||
|
name: String,
|
||||||
|
weight: u16,
|
||||||
|
italic: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Ersatzkette fuer einen Schnitt derselben Familie (zuerst der gewuenschte).
|
||||||
|
fn style_chain(style: u32) -> Vec<u32> {
|
||||||
|
let mut v = vec![style];
|
||||||
|
for s in [style & !STYLE_ITALIC, style & !STYLE_BOLD, 0] {
|
||||||
|
if !v.contains(&s) {
|
||||||
|
v.push(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
v
|
||||||
|
}
|
||||||
|
|
||||||
/// Eingebettete Plan-Schrift (Inter, variabel). Wird in jedem Pfad geladen: auf wasm gibt es keine
|
/// Eingebettete Plan-Schrift (Inter, variabel). Wird in jedem Pfad geladen: auf wasm gibt es keine
|
||||||
/// Systemschriften, nativ macht sie das Schriftbild unabhaengig vom installierten Fontbestand.
|
/// Systemschriften, nativ macht sie das Schriftbild unabhaengig vom installierten Fontbestand.
|
||||||
@@ -46,6 +78,12 @@ pub struct GlyphText {
|
|||||||
state: Option<State>,
|
state: Option<State>,
|
||||||
family: String,
|
family: String,
|
||||||
font_bytes: Option<Vec<u8>>,
|
font_bytes: Option<Vec<u8>>,
|
||||||
|
/// Geladene Dateien je `font_key`.
|
||||||
|
faces: HashMap<u32, Face>,
|
||||||
|
/// Bytes, die vor dem ersten Frame mit Text eintrafen (`font_key`, SFNT).
|
||||||
|
pending_fonts: Vec<(u32, Vec<u8>)>,
|
||||||
|
/// Schluessel, die geladen wurden oder als nicht verfuegbar gemeldet sind (nicht erneut anfordern).
|
||||||
|
tried: HashSet<u32>,
|
||||||
lines: Vec<GlyphLine>,
|
lines: Vec<GlyphLine>,
|
||||||
shaped: Vec<Option<Shaped>>,
|
shaped: Vec<Option<Shaped>>,
|
||||||
}
|
}
|
||||||
@@ -59,6 +97,9 @@ impl GlyphText {
|
|||||||
state: None,
|
state: None,
|
||||||
family: DEFAULT_FAMILY.to_string(),
|
family: DEFAULT_FAMILY.to_string(),
|
||||||
font_bytes: Some(INTER_TTF.to_vec()),
|
font_bytes: Some(INTER_TTF.to_vec()),
|
||||||
|
faces: HashMap::new(),
|
||||||
|
pending_fonts: Vec::new(),
|
||||||
|
tried: HashSet::new(),
|
||||||
lines: Vec::new(),
|
lines: Vec::new(),
|
||||||
shaped: Vec::new(),
|
shaped: Vec::new(),
|
||||||
}
|
}
|
||||||
@@ -73,13 +114,13 @@ impl GlyphText {
|
|||||||
|
|
||||||
/// Zeilen ersetzen. Unveraenderte Zeilen (gleicher Inhalt/Schnitt) behalten ihr Shaping.
|
/// Zeilen ersetzen. Unveraenderte Zeilen (gleicher Inhalt/Schnitt) behalten ihr Shaping.
|
||||||
pub fn set_lines(&mut self, lines: Vec<GlyphLine>) {
|
pub fn set_lines(&mut self, lines: Vec<GlyphLine>) {
|
||||||
let mut old: std::collections::HashMap<(String, u32), Vec<Shaped>> = std::collections::HashMap::new();
|
let mut old: HashMap<(String, u32, u32), Vec<Shaped>> = HashMap::new();
|
||||||
for (l, s) in self.lines.drain(..).zip(self.shaped.drain(..)) {
|
for (l, s) in self.lines.drain(..).zip(self.shaped.drain(..)) {
|
||||||
if let Some(s) = s {
|
if let Some(s) = s {
|
||||||
old.entry((l.content, l.style)).or_default().push(s);
|
old.entry((l.content, l.style, l.family)).or_default().push(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.shaped = lines.iter().map(|l| old.get_mut(&(l.content.clone(), l.style)).and_then(|v| v.pop())).collect();
|
self.shaped = lines.iter().map(|l| old.get_mut(&(l.content.clone(), l.style, l.family)).and_then(|v| v.pop())).collect();
|
||||||
self.lines = lines;
|
self.lines = lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,10 +128,75 @@ impl GlyphText {
|
|||||||
&self.lines
|
&self.lines
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Schriftdatei (WOFF2 oder SFNT) fuer Familie/Schnitt einspielen. `Err` bei Unbrauchbarem (der Schluessel
|
||||||
|
/// gilt dann als nicht verfuegbar, die Zeilen bleiben in Inter bzw. der Ersatz-Variante).
|
||||||
|
pub fn add_font(&mut self, family: u32, style: u32, bytes: &[u8]) -> Result<(), String> {
|
||||||
|
let key = font_key(family, style);
|
||||||
|
self.tried.insert(key);
|
||||||
|
if family == 0 {
|
||||||
|
return Err("Familie 0 ist das eingebettete Inter".into());
|
||||||
|
}
|
||||||
|
let sfnt = crate::woff2::to_sfnt(bytes)?;
|
||||||
|
match self.state.as_mut() {
|
||||||
|
Some(st) => {
|
||||||
|
let face = register_face(&mut st.font_system, sfnt).ok_or("Schrift nicht lesbar")?;
|
||||||
|
self.faces.insert(key, face);
|
||||||
|
self.invalidate(family);
|
||||||
|
}
|
||||||
|
None => self.pending_fonts.push((key, sfnt)),
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Datei fuer Familie/Schnitt gibt es nicht (404 o. ae.): nicht weiter anfordern.
|
||||||
|
pub fn mark_font_unavailable(&mut self, family: u32, style: u32) {
|
||||||
|
self.tried.insert(font_key(family, style));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Schriftdateien (`font_key`), die die aktuellen Zeilen noch brauchen und die noch niemand geliefert hat.
|
||||||
|
/// Fuer einen Schnitt, den es nicht gibt, kommt der naechste der Ersatzkette (Manrope kursiv → Manrope).
|
||||||
|
pub fn needed_fonts(&self) -> Vec<u32> {
|
||||||
|
let mut out: Vec<u32> = Vec::new();
|
||||||
|
let mut seen: HashSet<u32> = HashSet::new();
|
||||||
|
for l in &self.lines {
|
||||||
|
if l.family == 0 || l.content.is_empty() || !seen.insert(font_key(l.family, l.style)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for s in style_chain(l.style & (STYLE_BOLD | STYLE_ITALIC)) {
|
||||||
|
let k = font_key(l.family, s);
|
||||||
|
if self.faces.contains_key(&k) || self.pending_fonts.iter().any(|(p, _)| *p == k) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if !self.tried.contains(&k) {
|
||||||
|
if !out.contains(&k) {
|
||||||
|
out.push(k);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out.sort_unstable();
|
||||||
|
out
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Zeilen dieser Familie neu setzen (eine Datei kam dazu).
|
||||||
|
fn invalidate(&mut self, family: u32) {
|
||||||
|
for (l, s) in self.lines.iter().zip(self.shaped.iter_mut()) {
|
||||||
|
if l.family == family {
|
||||||
|
*s = None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn ensure_state(&mut self, device: &wgpu::Device, queue: &wgpu::Queue) -> &mut State {
|
fn ensure_state(&mut self, device: &wgpu::Device, queue: &wgpu::Queue) -> &mut State {
|
||||||
if self.state.is_none() {
|
if self.state.is_none() {
|
||||||
// Nativ: Systemschriften als Rueckfall fuer Zeichen, die Inter nicht kennt (wie das SVG).
|
// Nativ: Systemschriften als Rueckfall fuer Zeichen, die Inter nicht kennt (wie das SVG).
|
||||||
let mut font_system = glyphon::FontSystem::new();
|
let mut font_system = glyphon::FontSystem::new();
|
||||||
|
for (key, sfnt) in std::mem::take(&mut self.pending_fonts) {
|
||||||
|
if let Some(face) = register_face(&mut font_system, sfnt) {
|
||||||
|
self.faces.insert(key, face);
|
||||||
|
}
|
||||||
|
}
|
||||||
if let Some(bytes) = self.font_bytes.take() {
|
if let Some(bytes) = self.font_bytes.take() {
|
||||||
let db = font_system.db_mut();
|
let db = font_system.db_mut();
|
||||||
let before: std::collections::HashSet<_> = db.faces().map(|f| f.id).collect();
|
let before: std::collections::HashSet<_> = db.faces().map(|f| f.id).collect();
|
||||||
@@ -130,6 +236,7 @@ impl GlyphText {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let family = self.family.clone();
|
let family = self.family.clone();
|
||||||
|
let faces = self.faces.clone();
|
||||||
let (vw, vh) = (viewport.0 as f32, viewport.1 as f32);
|
let (vw, vh) = (viewport.0 as f32, viewport.1 as f32);
|
||||||
// `ensure_state` leiht `self` exklusiv; Zeilen/Shaping-Cache daher vorher herausnehmen.
|
// `ensure_state` leiht `self` exklusiv; Zeilen/Shaping-Cache daher vorher herausnehmen.
|
||||||
let lines = std::mem::take(&mut self.lines);
|
let lines = std::mem::take(&mut self.lines);
|
||||||
@@ -160,11 +267,17 @@ impl GlyphText {
|
|||||||
let s = shaped[i].get_or_insert_with(|| {
|
let s = shaped[i].get_or_insert_with(|| {
|
||||||
let mut buffer = glyphon::Buffer::new(&mut st.font_system, glyphon::Metrics::new(REF_PX, REF_PX * 1.2));
|
let mut buffer = glyphon::Buffer::new(&mut st.font_system, glyphon::Metrics::new(REF_PX, REF_PX * 1.2));
|
||||||
buffer.set_size(&mut st.font_system, None, None);
|
buffer.set_size(&mut st.font_system, None, None);
|
||||||
let mut attrs = glyphon::Attrs::new().family(glyphon::Family::Name(&family));
|
// Gebuendelte Familie (Datei mit genau ihrem Namen/Gewicht/Neigung), sonst Inter.
|
||||||
if l.style & STYLE_BOLD != 0 {
|
let face = if l.family == 0 { None } else { style_chain(l.style).into_iter().find_map(|s| faces.get(&font_key(l.family, s))) };
|
||||||
attrs = attrs.weight(glyphon::Weight::BOLD);
|
let mut attrs = glyphon::Attrs::new().family(glyphon::Family::Name(face.map_or(family.as_str(), |f| f.name.as_str())));
|
||||||
|
let (bold, italic) = match face {
|
||||||
|
Some(f) => (f.weight >= 600, f.italic),
|
||||||
|
None => (l.style & STYLE_BOLD != 0, l.style & STYLE_ITALIC != 0),
|
||||||
|
};
|
||||||
|
if bold {
|
||||||
|
attrs = attrs.weight(face.map_or(glyphon::Weight::BOLD, |f| glyphon::Weight(f.weight)));
|
||||||
}
|
}
|
||||||
if l.style & STYLE_ITALIC != 0 {
|
if italic {
|
||||||
attrs = attrs.style(glyphon::Style::Italic);
|
attrs = attrs.style(glyphon::Style::Italic);
|
||||||
}
|
}
|
||||||
buffer.set_text(&mut st.font_system, &l.content, &attrs, glyphon::Shaping::Advanced, None);
|
buffer.set_text(&mut st.font_system, &l.content, &attrs, glyphon::Shaping::Advanced, None);
|
||||||
@@ -216,3 +329,45 @@ impl GlyphText {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// SFNT in die Schriftdatenbank laden und die neue Datei beschreiben (`None`: nicht lesbar).
|
||||||
|
fn register_face(fs: &mut glyphon::FontSystem, sfnt: Vec<u8>) -> Option<Face> {
|
||||||
|
let db = fs.db_mut();
|
||||||
|
let before: HashSet<_> = db.faces().map(|f| f.id).collect();
|
||||||
|
db.load_font_data(sfnt);
|
||||||
|
let f = db.faces().find(|f| !before.contains(&f.id))?;
|
||||||
|
Some(Face { name: f.families.first()?.0.clone(), weight: f.weight.0, italic: f.style != fontdb::Style::Normal })
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
fn line(content: &str, style: u32, family: u32) -> GlyphLine {
|
||||||
|
GlyphLine { x: 0.0, y: 0.0, content: content.into(), size_mm: 2.5, color: [0.0, 0.0, 0.0, 1.0], align: TextAlign::Left, style, family }
|
||||||
|
}
|
||||||
|
|
||||||
|
fn woff2(slug: &str, file: &str) -> Vec<u8> {
|
||||||
|
std::fs::read(std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join(format!("../../public/fonts/{slug}/{file}.woff2"))).unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// [226] Was fehlt, wird verlangt (je Familie und Schnitt einmal); Inter (0) nie; geliefertes und als fehlend
|
||||||
|
/// gemeldetes nicht erneut; fehlt ein Schnitt, kommt der naechste der Ersatzkette.
|
||||||
|
#[test]
|
||||||
|
fn benoetigte_schriften_und_ersatzkette() {
|
||||||
|
let mut g = GlyphText::new(wgpu::TextureFormat::Rgba8Unorm, 1);
|
||||||
|
g.set_lines(vec![line("a", 0, 0), line("b", 0, 15), line("c", STYLE_BOLD, 15), line("d", STYLE_BOLD, 15), line("e", STYLE_ITALIC, 7), line("", 0, 9)]);
|
||||||
|
let (serif, serif_bold, manrope_it, manrope) = (font_key(15, 0), font_key(15, STYLE_BOLD), font_key(7, STYLE_ITALIC), font_key(7, 0));
|
||||||
|
assert_eq!(g.needed_fonts(), vec![manrope_it, serif, serif_bold]);
|
||||||
|
assert!(g.add_font(15, 0, &woff2("source-serif-4", "source-serif-4-400-normal")).is_ok());
|
||||||
|
assert_eq!(g.needed_fonts(), vec![manrope_it, serif_bold]);
|
||||||
|
// Datei fehlt (404): Ersatz = aufrechter Schnitt derselben Familie.
|
||||||
|
g.mark_font_unavailable(7, STYLE_ITALIC);
|
||||||
|
assert_eq!(g.needed_fonts(), vec![manrope, serif_bold]);
|
||||||
|
// Unbrauchbare Bytes: kein Panic, Schluessel gilt als erledigt.
|
||||||
|
assert!(g.add_font(15, STYLE_BOLD, b"<html>nicht gefunden</html>").is_err());
|
||||||
|
g.mark_font_unavailable(7, 0);
|
||||||
|
assert_eq!(g.needed_fonts(), Vec::<u32>::new());
|
||||||
|
assert!(g.add_font(0, 0, &[]).is_err());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -586,6 +586,22 @@ impl Renderer {
|
|||||||
self.text.set_font(bytes);
|
self.text.set_font(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// [226] Schriftdatei (WOFF2/SFNT) fuer `key` = Familie << 8 | Schnitt (`glyph::font_key`) einspielen.
|
||||||
|
pub fn add_font(&mut self, key: u32, bytes: &[u8]) -> bool {
|
||||||
|
self.text.add_font(key >> 8, key & 0xff, bytes).is_ok()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// [226] Es gibt keine Datei fuer `key` (nicht weiter anfordern).
|
||||||
|
pub fn mark_font_unavailable(&mut self, key: u32) {
|
||||||
|
self.text.mark_font_unavailable(key >> 8, key & 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// [226] Schriftdateien (`font_key`), die die aktuellen Textzeilen noch brauchen.
|
||||||
|
pub fn needed_fonts(&self) -> Vec<u32> {
|
||||||
|
self.text.needed_fonts()
|
||||||
|
}
|
||||||
|
|
||||||
/// Stellt sicher, dass der dynamische Uniform-Puffer mindestens `count`
|
/// Stellt sicher, dass der dynamische Uniform-Puffer mindestens `count`
|
||||||
/// Bloecke fasst; realloziert (Puffer + Bind-Group) bei Bedarf.
|
/// Bloecke fasst; realloziert (Puffer + Bind-Group) bei Bedarf.
|
||||||
fn ensure_uniform_capacity(&mut self, device: &wgpu::Device, count: u64) {
|
fn ensure_uniform_capacity(&mut self, device: &wgpu::Device, count: u64) {
|
||||||
|
|||||||
@@ -430,6 +430,7 @@ mod tests {
|
|||||||
color: [0.0, 0.0, 0.0, 1.0],
|
color: [0.0, 0.0, 0.0, 1.0],
|
||||||
align,
|
align,
|
||||||
style,
|
style,
|
||||||
|
family: 0,
|
||||||
};
|
};
|
||||||
// Ansicht: x 0..4 m, y −1..1 m auf 360x180 px (1 Einheit = 1 px); 5 mm bei 1:100 = 0.5 m = 45 px.
|
// Ansicht: x 0..4 m, y −1..1 m auf 360x180 px (1 Einheit = 1 px); 5 mm bei 1:100 = 0.5 m = 45 px.
|
||||||
// Tinte = Abdunklung gegenueber dem Blatt (Rot-Kanal der Ecke oben links).
|
// Tinte = Abdunklung gegenueber dem Blatt (Rot-Kanal der Ecke oben links).
|
||||||
@@ -460,6 +461,60 @@ mod tests {
|
|||||||
assert!((3.0..5.0).contains(&ratio), "Zoom-Verhaeltnis {ratio}");
|
assert!((3.0..5.0).contains(&ratio), "Zoom-Verhaeltnis {ratio}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// [226] Schriftfamilien im Szenen-Pfad (Browser/WebGPU): dieselbe Zeile in Inter, einer Serifen- und einer
|
||||||
|
/// Festbreitenschrift sieht verschieden aus; eine nicht geladene Familie faellt auf Inter zurueck (pixelgleich).
|
||||||
|
/// Mit `DOSSIER_SHOTS=<Ordner>` schreibt der Test das Bild (`schriftfamilien.png`) zum Ansehen.
|
||||||
|
#[test]
|
||||||
|
fn schriftfamilien_im_glyphen_pass() {
|
||||||
|
use crate::glyph::font_key;
|
||||||
|
use crate::types::{Text, TextAlign, STYLE_BOLD, STYLE_ITALIC};
|
||||||
|
let mut r = match HeadlessRenderer::new() {
|
||||||
|
Ok(r) => r,
|
||||||
|
Err(e) => {
|
||||||
|
eprintln!("uebersprungen, kein Headless-Adapter: {e}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let font = |slug: &str, w: u32, it: &str| std::fs::read(std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join(format!("../../public/fonts/{slug}/{slug}-{w}-{it}.woff2"))).unwrap();
|
||||||
|
let text = |y: f32, family: u32, style: u32, s: &str| Text { pos: [0.2, y], content: s.into(), size_mm: 5.0, color: [0.0, 0.0, 0.0, 1.0], align: TextAlign::Left, style, family };
|
||||||
|
let img = |r: &mut HeadlessRenderer, texts: Vec<Text>| r.render_to_image(&Scene { texts, ..Default::default() }, 540, 330, ViewBox::new(0.0, -288.0, 540.0, 330.0), 100.0);
|
||||||
|
let ink_w = |i: &RgbaImage, y0: u32, y1: u32| {
|
||||||
|
let cols: Vec<u32> = (0..i.width).filter(|&x| (y0..y1).any(|y| i.pixels[((y * i.width + x) * 4) as usize] < 128)).collect();
|
||||||
|
cols.last().map_or(0, |l| l - cols[0])
|
||||||
|
};
|
||||||
|
let s = "Hamburgefons 17 m²";
|
||||||
|
let rows = |fam: [u32; 5]| vec![text(2.8, fam[0], 0, s), text(2.2, fam[1], 0, s), text(1.6, fam[2], 0, s), text(1.0, fam[3], STYLE_ITALIC, s), text(0.4, fam[4], STYLE_BOLD, s)];
|
||||||
|
// Noch nichts geladen: alles Inter.
|
||||||
|
let before = img(&mut r, rows([0, 15, 4, 15, 15]));
|
||||||
|
for (fam, style, file) in [(15, 0, ("source-serif-4", 400, "normal")), (4, 0, ("ibm-plex-mono", 400, "normal")), (15, STYLE_ITALIC, ("source-serif-4", 400, "italic")), (15, STYLE_BOLD, ("source-serif-4", 700, "normal"))] {
|
||||||
|
assert!(r.renderer.add_font(font_key(fam, style), &font(file.0, file.1, file.2)));
|
||||||
|
}
|
||||||
|
assert!(r.renderer.needed_fonts().is_empty());
|
||||||
|
let after = img(&mut r, rows([0, 15, 4, 15, 15]));
|
||||||
|
if let Ok(dir) = std::env::var("DOSSIER_SHOTS") {
|
||||||
|
std::fs::create_dir_all(&dir).unwrap();
|
||||||
|
std::fs::write(std::path::Path::new(&dir).join("schriftfamilien.png"), after.encode_png()).unwrap();
|
||||||
|
}
|
||||||
|
// Zeilenband je Zeile (5 mm bei 1:100 = 0.5 m = 45 px; Grundlinien bei 36 + 54 k px).
|
||||||
|
let band = |i: &RgbaImage, k: u32| ink_w(i, 2 + 54 * k, 48 + 54 * k);
|
||||||
|
let (inter0, inter1, inter2) = (band(&before, 0), band(&before, 1), band(&before, 2));
|
||||||
|
assert_eq!((inter0, inter0), (inter1, inter2), "ungeladene Familien = Inter");
|
||||||
|
let (a0, a1, a2) = (band(&after, 0), band(&after, 1), band(&after, 2));
|
||||||
|
assert_eq!(a0, inter0, "Inter bleibt");
|
||||||
|
assert!(a1 != inter0 && a2 != inter0 && a1 != a2, "Serif {a1}, Mono {a2}, Inter {a0}");
|
||||||
|
// Metrik des Kerns = Breite des Gezeichneten (Abweichung durch Kerning/Rundung < 4 %).
|
||||||
|
// Gleiche Quelle wie die Kern-Tabellen (`hmtx`, scripts/gen-text-metrics.py).
|
||||||
|
let adv_em = |slug: &str| {
|
||||||
|
let sfnt = crate::woff2::to_sfnt(&font(slug, 400, "normal")).unwrap();
|
||||||
|
let face = ttf_parser::Face::parse(&sfnt, 0).unwrap();
|
||||||
|
s.chars().map(|c| face.glyph_hor_advance(face.glyph_index(c).unwrap()).unwrap() as f64).sum::<f64>() / face.units_per_em() as f64
|
||||||
|
};
|
||||||
|
for (px, slug, fam) in [(a1, "source-serif-4", "Source Serif 4"), (a2, "ibm-plex-mono", "IBM Plex Mono")] {
|
||||||
|
let want = adv_em(slug) * 0.5 * 90.0;
|
||||||
|
assert!((px as f64 - want).abs() < want * 0.04, "{fam}: gezeichnet {px} px, gemessen {want}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn flache_ausgabe_wird_gelesen() {
|
fn flache_ausgabe_wird_gelesen() {
|
||||||
let mut id = 1;
|
let mut id = 1;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ pub mod shaders;
|
|||||||
pub mod tessellate;
|
pub mod tessellate;
|
||||||
pub mod text_lines;
|
pub mod text_lines;
|
||||||
pub mod types;
|
pub mod types;
|
||||||
|
pub mod woff2;
|
||||||
|
|
||||||
#[cfg(feature = "render")]
|
#[cfg(feature = "render")]
|
||||||
pub mod gpu;
|
pub mod gpu;
|
||||||
|
|||||||
@@ -16,7 +16,8 @@
|
|||||||
// Bogen [r, widthMm, dashLen, rgba] 7
|
// Bogen [r, widthMm, dashLen, rgba] 7
|
||||||
// Linie [widthMm, dashLen, z, rgba] 7
|
// Linie [widthMm, dashLen, z, rgba] 7
|
||||||
// Text [sizeMm, code, strOff, strLen, rgba] 8 (code: Ausrichtung 0 l,1 c,2 r im
|
// Text [sizeMm, code, strOff, strLen, rgba] 8 (code: Ausrichtung 0 l,1 c,2 r im
|
||||||
// unteren Byte, darueber der Schnitt: Bit 8 fett, Bit 9 kursiv, [194])
|
// unteren Byte, darueber der Schnitt: Bit 8 fett, Bit 9 kursiv, [194]; ab Bit 16 die
|
||||||
|
// Schriftfamilie, 0 = Inter, [226])
|
||||||
// Strings: str_bytes UTF-8-Bytes; Texte verweisen mit Byte-Offset und -Laenge hinein.
|
// Strings: str_bytes UTF-8-Bytes; Texte verweisen mit Byte-Offset und -Laenge hinein.
|
||||||
// `dashLen` 0 = durchgezogen (None). Punkte werden beim Lesen auf f32 gekuerzt (wie bisher
|
// `dashLen` 0 = durchgezogen (None). Punkte werden beim Lesen auf f32 gekuerzt (wie bisher
|
||||||
// beim JSON-Weg), Farben und Masse sind f32. Nicht-endliche Zahlen gelten als kaputte Daten.
|
// beim JSON-Weg), Farben und Masse sind f32. Nicht-endliche Zahlen gelten als kaputte Daten.
|
||||||
@@ -201,7 +202,8 @@ pub fn decode_scene(bytes: &[u8]) -> Result<Scene, String> {
|
|||||||
2 => TextAlign::Right,
|
2 => TextAlign::Right,
|
||||||
_ => return Err("Text: Ausrichtung unbekannt".into()),
|
_ => return Err("Text: Ausrichtung unbekannt".into()),
|
||||||
};
|
};
|
||||||
let style = code >> 8;
|
let style = (code >> 8) & 0xff;
|
||||||
|
let family = code >> 16;
|
||||||
if style & !(STYLE_BOLD | STYLE_ITALIC) != 0 {
|
if style & !(STYLE_BOLD | STYLE_ITALIC) != 0 {
|
||||||
return Err("Text: Schnitt unbekannt".into());
|
return Err("Text: Schnitt unbekannt".into());
|
||||||
}
|
}
|
||||||
@@ -210,7 +212,7 @@ pub fn decode_scene(bytes: &[u8]) -> Result<Scene, String> {
|
|||||||
let color = r.rgba()?;
|
let color = r.rgba()?;
|
||||||
let end = off.checked_add(len).filter(|&e| e <= strings.len()).ok_or("Text ausserhalb der Tabelle")?;
|
let end = off.checked_add(len).filter(|&e| e <= strings.len()).ok_or("Text ausserhalb der Tabelle")?;
|
||||||
let content = strings.get(off..end).ok_or("Text: Offset mitten im Zeichen")?.to_string();
|
let content = strings.get(off..end).ok_or("Text: Offset mitten im Zeichen")?.to_string();
|
||||||
scene.texts.push(Text { pos: pts.take(1)?[0], content, size_mm, color, align, style });
|
scene.texts.push(Text { pos: pts.take(1)?[0], content, size_mm, color, align, style, family });
|
||||||
}
|
}
|
||||||
if pts.next != n_pts || dashes.next != dashes.v.len() {
|
if pts.next != n_pts || dashes.next != dashes.v.len() {
|
||||||
return Err("Pools nicht vollstaendig verbraucht".into());
|
return Err("Pools nicht vollstaendig verbraucht".into());
|
||||||
@@ -245,9 +247,9 @@ mod tests {
|
|||||||
arcs: vec![Arc { center: [1.0, 1.0], from: [2.0, 1.0], to: [1.0, 2.0], r: 1.0, color: [1.0, 0.0, 0.0, 1.0], width_mm: 0.125, dash: None }],
|
arcs: vec![Arc { center: [1.0, 1.0], from: [2.0, 1.0], to: [1.0, 2.0], r: 1.0, color: [1.0, 0.0, 0.0, 1.0], width_mm: 0.125, dash: None }],
|
||||||
lines: vec![Line { a: [0.0, 0.0], b: [2600000.5, 1200000.25], color: [0.0, 0.5, 0.0, 1.0], width_mm: 0.35, dash: Some(vec![3.0, 1.0, 0.5, 1.0]), z: 4 }],
|
lines: vec![Line { a: [0.0, 0.0], b: [2600000.5, 1200000.25], color: [0.0, 0.5, 0.0, 1.0], width_mm: 0.35, dash: Some(vec![3.0, 1.0, 0.5, 1.0]), z: 4 }],
|
||||||
texts: vec![
|
texts: vec![
|
||||||
Text { pos: [1.0, 2.0], content: "Küche 12,5 m²".into(), size_mm: 2.5, color: [0.0, 0.0, 0.0, 1.0], align: TextAlign::Center, style: 0 },
|
Text { pos: [1.0, 2.0], content: "Küche 12,5 m²".into(), size_mm: 2.5, color: [0.0, 0.0, 0.0, 1.0], align: TextAlign::Center, style: 0, family: 0 },
|
||||||
Text { pos: [3.0, 4.0], content: String::new(), size_mm: 2.0, color: [0.0, 0.0, 0.0, 1.0], align: TextAlign::Right, style: 0 },
|
Text { pos: [3.0, 4.0], content: String::new(), size_mm: 2.0, color: [0.0, 0.0, 0.0, 1.0], align: TextAlign::Right, style: 0, family: 0 },
|
||||||
Text { pos: [5.0, 6.0], content: "A".into(), size_mm: 1.0, color: [0.0, 0.0, 1.0, 1.0], align: TextAlign::Left, style: 0 },
|
Text { pos: [5.0, 6.0], content: "A".into(), size_mm: 1.0, color: [0.0, 0.0, 1.0, 1.0], align: TextAlign::Left, style: 0, family: 0 },
|
||||||
],
|
],
|
||||||
line_ends: 0,
|
line_ends: 0,
|
||||||
}
|
}
|
||||||
@@ -362,6 +364,10 @@ mod tests {
|
|||||||
a[text0 + 4..text0 + 8].copy_from_slice(&(1u32 | (STYLE_BOLD | STYLE_ITALIC) << 8).to_le_bytes());
|
a[text0 + 4..text0 + 8].copy_from_slice(&(1u32 | (STYLE_BOLD | STYLE_ITALIC) << 8).to_le_bytes());
|
||||||
let s = decode_scene(&a).unwrap();
|
let s = decode_scene(&a).unwrap();
|
||||||
assert_eq!((s.texts[0].align, s.texts[0].style), (TextAlign::Center, STYLE_BOLD | STYLE_ITALIC));
|
assert_eq!((s.texts[0].align, s.texts[0].style), (TextAlign::Center, STYLE_BOLD | STYLE_ITALIC));
|
||||||
|
// [226] Familie ab Bit 16.
|
||||||
|
a[text0 + 4..text0 + 8].copy_from_slice(&(1u32 | STYLE_BOLD << 8 | 15 << 16).to_le_bytes());
|
||||||
|
let s = decode_scene(&a).unwrap();
|
||||||
|
assert_eq!((s.texts[0].style, s.texts[0].family), (STYLE_BOLD, 15));
|
||||||
a[text0 + 4..text0 + 8].copy_from_slice(&(1u32 | 4 << 8).to_le_bytes());
|
a[text0 + 4..text0 + 8].copy_from_slice(&(1u32 | 4 << 8).to_le_bytes());
|
||||||
assert!(decode_scene(&a).unwrap_err().contains("Schnitt"));
|
assert!(decode_scene(&a).unwrap_err().contains("Schnitt"));
|
||||||
}
|
}
|
||||||
@@ -429,7 +435,7 @@ mod roundtrip {
|
|||||||
}
|
}
|
||||||
for t in &s.texts {
|
for t in &s.texts {
|
||||||
wf(&mut rec, t.size_mm);
|
wf(&mut rec, t.size_mm);
|
||||||
w(&mut rec, t.align as u32 | (t.style << 8));
|
w(&mut rec, t.align as u32 | (t.style << 8) | (t.family << 16));
|
||||||
w(&mut rec, strs.len() as u32);
|
w(&mut rec, strs.len() as u32);
|
||||||
w(&mut rec, t.content.len() as u32);
|
w(&mut rec, t.content.len() as u32);
|
||||||
c(&mut rec, &t.color);
|
c(&mut rec, &t.color);
|
||||||
@@ -479,7 +485,7 @@ mod roundtrip {
|
|||||||
s.fills.push(FillPolygon { pts, color: [0.8, 0.8, 0.75, 1.0], z: (i % 50) as u32 });
|
s.fills.push(FillPolygon { pts, color: [0.8, 0.8, 0.75, 1.0], z: (i % 50) as u32 });
|
||||||
}
|
}
|
||||||
for i in 0..n_texts {
|
for i in 0..n_texts {
|
||||||
s.texts.push(Text { pos: [rnd() * 500.0, rnd() * 500.0], content: format!("Raum {i} 12,5 m²"), size_mm: 2.0, color: [0.0, 0.0, 0.0, 1.0], align: TextAlign::Center, style: 0 });
|
s.texts.push(Text { pos: [rnd() * 500.0, rnd() * 500.0], content: format!("Raum {i} 12,5 m²"), size_mm: 2.0, color: [0.0, 0.0, 0.0, 1.0], align: TextAlign::Center, style: 0, family: 0 });
|
||||||
}
|
}
|
||||||
s
|
s
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,17 +17,19 @@ pub struct GlyphLine {
|
|||||||
pub align: TextAlign,
|
pub align: TextAlign,
|
||||||
/// `STYLE_BOLD` | `STYLE_ITALIC`.
|
/// `STYLE_BOLD` | `STYLE_ITALIC`.
|
||||||
pub style: u32,
|
pub style: u32,
|
||||||
|
/// Schriftfamilie ([226]): 0 = Inter (eingebettet), sonst Kennung der gebuendelten Familie.
|
||||||
|
pub family: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&crate::types::Text> for GlyphLine {
|
impl From<&crate::types::Text> for GlyphLine {
|
||||||
fn from(t: &crate::types::Text) -> Self {
|
fn from(t: &crate::types::Text) -> Self {
|
||||||
GlyphLine { x: t.pos[0] as f64, y: t.pos[1] as f64, content: t.content.clone(), size_mm: t.size_mm, color: t.color, align: t.align, style: t.style }
|
GlyphLine { x: t.pos[0] as f64, y: t.pos[1] as f64, content: t.content.clone(), size_mm: t.size_mm, color: t.color, align: t.align, style: t.style, family: t.family }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Zeilen aus dem Format der Kern-Bindung `plan_screen_texts` (f64, little-endian):
|
/// Zeilen aus dem Format der Kern-Bindung `plan_screen_texts` (f64, little-endian):
|
||||||
/// `[n, (x, y, sizeMm, r, g, b, a, code, nUtf16)*, UTF-16-Einheiten…]`, `code` = Ausrichtung |
|
/// `[n, (x, y, sizeMm, r, g, b, a, code, nUtf16)*, UTF-16-Einheiten…]`, `code` = Ausrichtung |
|
||||||
/// Schnitt << 8. `None` bei kaputtem Puffer (nie Panic).
|
/// Schnitt << 8 | Familie << 16. `None` bei kaputtem Puffer (nie Panic).
|
||||||
pub fn lines_from_f64(f: &[f64]) -> Option<Vec<GlyphLine>> {
|
pub fn lines_from_f64(f: &[f64]) -> Option<Vec<GlyphLine>> {
|
||||||
let n = *f.first()?;
|
let n = *f.first()?;
|
||||||
if !(n.is_finite() && n >= 0.0 && n.fract() == 0.0) {
|
if !(n.is_finite() && n >= 0.0 && n.fract() == 0.0) {
|
||||||
@@ -64,6 +66,7 @@ pub fn lines_from_f64(f: &[f64]) -> Option<Vec<GlyphLine>> {
|
|||||||
color: [r[3] as f32, r[4] as f32, r[5] as f32, r[6] as f32],
|
color: [r[3] as f32, r[4] as f32, r[5] as f32, r[6] as f32],
|
||||||
align,
|
align,
|
||||||
style: (code >> 8) & (STYLE_BOLD | STYLE_ITALIC),
|
style: (code >> 8) & (STYLE_BOLD | STYLE_ITALIC),
|
||||||
|
family: (code >> 16) & 0xff,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Some(out)
|
Some(out)
|
||||||
@@ -89,7 +92,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn zeilen_aus_kern_puffer() {
|
fn zeilen_aus_kern_puffer() {
|
||||||
let (a, ua) = rec(1.0, 1.0 + 256.0, "Wohnen");
|
let (a, ua) = rec(1.0, 1.0 + 256.0 + (15 << 16) as f64, "Wohnen");
|
||||||
let (b, ub) = rec(2_600_000.25, 2.0, "17.01 m²");
|
let (b, ub) = rec(2_600_000.25, 2.0, "17.01 m²");
|
||||||
let mut f = vec![2.0];
|
let mut f = vec![2.0];
|
||||||
f.extend(a);
|
f.extend(a);
|
||||||
@@ -100,6 +103,8 @@ mod tests {
|
|||||||
assert_eq!(l.len(), 2);
|
assert_eq!(l.len(), 2);
|
||||||
assert_eq!((l[0].content.as_str(), l[0].align, l[0].style), ("Wohnen", TextAlign::Center, STYLE_BOLD));
|
assert_eq!((l[0].content.as_str(), l[0].align, l[0].style), ("Wohnen", TextAlign::Center, STYLE_BOLD));
|
||||||
assert_eq!((l[1].content.as_str(), l[1].align, l[1].style), ("17.01 m²", TextAlign::Right, 0));
|
assert_eq!((l[1].content.as_str(), l[1].align, l[1].style), ("17.01 m²", TextAlign::Right, 0));
|
||||||
|
// [226] Familie ab Bit 16 des Codes.
|
||||||
|
assert_eq!((l[0].family, l[1].family), (15, 0));
|
||||||
// Landeskoordinaten bleiben in doppelter Genauigkeit.
|
// Landeskoordinaten bleiben in doppelter Genauigkeit.
|
||||||
assert_eq!(l[1].x, 2_600_000.25);
|
assert_eq!(l[1].x, 2_600_000.25);
|
||||||
let bytes: Vec<u8> = f.iter().flat_map(|v| v.to_le_bytes()).collect();
|
let bytes: Vec<u8> = f.iter().flat_map(|v| v.to_le_bytes()).collect();
|
||||||
|
|||||||
@@ -161,6 +161,10 @@ pub struct Text {
|
|||||||
/// Schnitt ([194]): `STYLE_BOLD` | `STYLE_ITALIC` (Default: normal).
|
/// Schnitt ([194]): `STYLE_BOLD` | `STYLE_ITALIC` (Default: normal).
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub style: u32,
|
pub style: u32,
|
||||||
|
/// Schriftfamilie ([226]): 0 = eingebettetes Inter, sonst 1-basierter Index der gebuendelten Familien
|
||||||
|
/// (`src/text/fontList.ts`, `core::text_layout::FONT_FAMILIES`). Unbekannte/ungeladene → Inter.
|
||||||
|
#[serde(default)]
|
||||||
|
pub family: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Schnitt-Bit fett (`Text::style`, Szene: Kennung >> 8).
|
/// Schnitt-Bit fett (`Text::style`, Szene: Kennung >> 8).
|
||||||
|
|||||||
@@ -216,6 +216,23 @@ impl WebPlanRenderer {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// [226] Schriftdatei (WOFF2/SFNT) fuer `key` = Familie << 8 | Schnitt einspielen; `false` = unbrauchbar.
|
||||||
|
/// Die Zeilen dieser Familie werden beim naechsten `render` neu gesetzt.
|
||||||
|
pub fn add_font(&mut self, key: u32, bytes: &[u8]) -> bool {
|
||||||
|
self.renderer.add_font(key, bytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// [226] Zu `key` gibt es keine Datei (nicht weiter anfordern).
|
||||||
|
pub fn mark_font_unavailable(&mut self, key: u32) {
|
||||||
|
self.renderer.mark_font_unavailable(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// [226] Schriftdateien (`Familie << 8 | Schnitt`), die die aktuelle Szene noch braucht und die noch nicht
|
||||||
|
/// geliefert wurden; nach `set_scene_bin` abfragen, laden, per `add_font` einspielen.
|
||||||
|
pub fn needed_fonts(&self) -> Vec<u32> {
|
||||||
|
self.renderer.needed_fonts()
|
||||||
|
}
|
||||||
|
|
||||||
/// Aktuellen Ausschnitt (viewBox-Einheiten, Bildschirm-Raum) setzen. Aendert
|
/// Aktuellen Ausschnitt (viewBox-Einheiten, Bildschirm-Raum) setzen. Aendert
|
||||||
/// nur die Ortho-Matrix im naechsten `render` (kein Re-Tessellieren).
|
/// nur die Ortho-Matrix im naechsten `render` (kein Re-Tessellieren).
|
||||||
pub fn set_view_box(&mut self, x: f32, y: f32, w: f32, h: f32) {
|
pub fn set_view_box(&mut self, x: f32, y: f32, w: f32, h: f32) {
|
||||||
|
|||||||
@@ -0,0 +1,203 @@
|
|||||||
|
// WOFF2 -> SFNT (TrueType/OpenType) fuer den Glyphen-Pass ([226]): die gebuendelten Schriften
|
||||||
|
// (`public/fonts/<slug>/<slug>-<400|700>-<normal|italic>.woff2`) kommen als WOFF2 in die App (Browser-
|
||||||
|
// CSS), fontdb/cosmic-text lesen aber nur rohes SFNT. Dekodiert wird nach der W3C-Spezifikation
|
||||||
|
// (https://www.w3.org/TR/WOFF2/): Kopf, Tabellenverzeichnis, EIN Brotli-Strom, daraus die Tabellen.
|
||||||
|
//
|
||||||
|
// Grenze: Tabellen mit Transformation (`glyf`/`loca` Version 0, `hmtx` Version 1) werden NICHT
|
||||||
|
// zurueckgerechnet — die gebuendelten Dateien sind ohne Transformation gespeichert (fontTools
|
||||||
|
// `WOFF2FlavorData(transformedTables=set())`); ein transformiertes Paket und Sammlungen (TTC) liefern
|
||||||
|
// `Err` (der Aufrufer faellt dann auf Inter zurueck). Rohes SFNT (TTF/OTF) geht unveraendert durch.
|
||||||
|
// Nie Panic: jede Laengenangabe wird geprueft.
|
||||||
|
|
||||||
|
use std::io::Read;
|
||||||
|
|
||||||
|
/// Bekannte Tabellen-Tags (Spezifikation, Abschnitt 5.1), Index = Kennung 0..62.
|
||||||
|
const KNOWN_TAGS: [&[u8; 4]; 63] = [
|
||||||
|
b"cmap", b"head", b"hhea", b"hmtx", b"maxp", b"name", b"OS/2", b"post", b"cvt ", b"fpgm", b"glyf", b"loca", b"prep", b"CFF ", b"VORG",
|
||||||
|
b"EBDT", b"EBLC", b"gasp", b"hdmx", b"kern", b"LTSH", b"PCLT", b"VDMX", b"vhea", b"vmtx", b"BASE", b"GDEF", b"GPOS", b"GSUB", b"EBSC",
|
||||||
|
b"JSTF", b"MATH", b"CBDT", b"CBLC", b"COLR", b"CPAL", b"SVG ", b"sbix", b"acnt", b"avar", b"bdat", b"bloc", b"bsln", b"cvar", b"fdsc",
|
||||||
|
b"feat", b"fmtx", b"fvar", b"gvar", b"hsty", b"just", b"lcar", b"mort", b"morx", b"opbd", b"prop", b"trak", b"Zapf", b"Silf", b"Glat",
|
||||||
|
b"Gloc", b"Feat", b"Sill",
|
||||||
|
];
|
||||||
|
|
||||||
|
/// Obergrenze des entpackten Datenstroms (Schutz vor Brotli-Bomben); die Schriften sind < 1 MB.
|
||||||
|
const MAX_UNPACKED: usize = 32 << 20;
|
||||||
|
|
||||||
|
struct Reader<'a> {
|
||||||
|
b: &'a [u8],
|
||||||
|
p: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Reader<'_> {
|
||||||
|
fn take(&mut self, n: usize) -> Result<&[u8], String> {
|
||||||
|
let end = self.p.checked_add(n).filter(|&e| e <= self.b.len()).ok_or("WOFF2 abgeschnitten")?;
|
||||||
|
let s = &self.b[self.p..end];
|
||||||
|
self.p = end;
|
||||||
|
Ok(s)
|
||||||
|
}
|
||||||
|
fn u8(&mut self) -> Result<u8, String> {
|
||||||
|
Ok(self.take(1)?[0])
|
||||||
|
}
|
||||||
|
fn u32(&mut self) -> Result<u32, String> {
|
||||||
|
Ok(u32::from_be_bytes(self.take(4)?.try_into().unwrap()))
|
||||||
|
}
|
||||||
|
/// `UIntBase128`: 7 Bit je Byte, hoechstens 5 Byte, keine fuehrenden Nullen.
|
||||||
|
fn base128(&mut self) -> Result<u32, String> {
|
||||||
|
let mut v: u32 = 0;
|
||||||
|
for i in 0..5 {
|
||||||
|
let b = self.u8()?;
|
||||||
|
if i == 0 && b == 0x80 {
|
||||||
|
return Err("UIntBase128 mit fuehrender Null".into());
|
||||||
|
}
|
||||||
|
if v & 0xfe00_0000 != 0 {
|
||||||
|
return Err("UIntBase128 laeuft ueber".into());
|
||||||
|
}
|
||||||
|
v = (v << 7) | (b & 0x7f) as u32;
|
||||||
|
if b & 0x80 == 0 {
|
||||||
|
return Ok(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err("UIntBase128 zu lang".into())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Pruefsumme einer Tabelle (Summe der Big-Endian-u32, Rest mit Nullen aufgefuellt).
|
||||||
|
fn checksum(d: &[u8]) -> u32 {
|
||||||
|
let mut sum = 0u32;
|
||||||
|
for c in d.chunks(4) {
|
||||||
|
let mut w = [0u8; 4];
|
||||||
|
w[..c.len()].copy_from_slice(c);
|
||||||
|
sum = sum.wrapping_add(u32::from_be_bytes(w));
|
||||||
|
}
|
||||||
|
sum
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Schrift-Bytes (WOFF2 oder rohes SFNT) -> SFNT.
|
||||||
|
pub fn to_sfnt(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||||
|
match data.get(..4) {
|
||||||
|
Some(b"wOF2") => decode(data),
|
||||||
|
Some([0, 1, 0, 0]) | Some(b"OTTO") | Some(b"true") => Ok(data.to_vec()),
|
||||||
|
_ => Err("keine Schriftdatei (weder WOFF2 noch SFNT)".into()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn decode(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||||
|
let mut r = Reader { b: data, p: 4 };
|
||||||
|
let flavor = r.u32()?;
|
||||||
|
if flavor == u32::from_be_bytes(*b"ttcf") {
|
||||||
|
return Err("WOFF2-Sammlung (TTC) nicht unterstuetzt".into());
|
||||||
|
}
|
||||||
|
let _length = r.u32()?;
|
||||||
|
let num_tables = u16::from_be_bytes(r.take(2)?.try_into().unwrap()) as usize;
|
||||||
|
r.take(2 + 4)?; // reserved, totalSfntSize
|
||||||
|
let comp_size = r.u32()? as usize;
|
||||||
|
r.take(2 + 2 + 5 * 4)?; // Version, Metadaten (Offset, Laenge, Originallaenge), Privatdaten
|
||||||
|
if num_tables == 0 || num_tables > 256 {
|
||||||
|
return Err("WOFF2: unplausible Tabellenzahl".into());
|
||||||
|
}
|
||||||
|
// Tabellenverzeichnis: (tag, Laenge im entpackten Strom).
|
||||||
|
let mut dir: Vec<([u8; 4], usize)> = Vec::with_capacity(num_tables);
|
||||||
|
for _ in 0..num_tables {
|
||||||
|
let flags = r.u8()?;
|
||||||
|
let tag = if flags & 0x3f == 0x3f { r.take(4)?.try_into().unwrap() } else { *KNOWN_TAGS[(flags & 0x3f) as usize] };
|
||||||
|
let version = flags >> 6;
|
||||||
|
let orig = r.base128()? as usize;
|
||||||
|
// glyf/loca: Version 3 = ohne Transformation; alle anderen: Version 0 = ohne.
|
||||||
|
let transformed = if &tag == b"glyf" || &tag == b"loca" { version != 3 } else { version != 0 };
|
||||||
|
if transformed {
|
||||||
|
return Err(format!("WOFF2: Tabelle {} ist transformiert (nicht unterstuetzt)", String::from_utf8_lossy(&tag)));
|
||||||
|
}
|
||||||
|
dir.push((tag, orig));
|
||||||
|
}
|
||||||
|
let comp = r.take(comp_size)?;
|
||||||
|
let total: usize = dir.iter().try_fold(0usize, |a, (_, l)| a.checked_add(*l)).filter(|&t| t <= MAX_UNPACKED).ok_or("WOFF2: Tabellen zu gross")?;
|
||||||
|
let mut raw = Vec::with_capacity(total);
|
||||||
|
brotli_decompressor::Decompressor::new(comp, 4096)
|
||||||
|
.take(MAX_UNPACKED as u64 + 1)
|
||||||
|
.read_to_end(&mut raw)
|
||||||
|
.map_err(|e| format!("WOFF2: Brotli: {e}"))?;
|
||||||
|
if raw.len() != total {
|
||||||
|
return Err("WOFF2: entpackte Laenge passt nicht zum Verzeichnis".into());
|
||||||
|
}
|
||||||
|
// SFNT: Kopf (12) + Verzeichnis (16 je Tabelle, nach Tag sortiert) + Tabellen (4-Byte-ausgerichtet).
|
||||||
|
let mut order: Vec<usize> = (0..dir.len()).collect();
|
||||||
|
order.sort_by_key(|&i| dir[i].0);
|
||||||
|
let mut starts = Vec::with_capacity(dir.len());
|
||||||
|
let mut off = 0usize;
|
||||||
|
for (_, l) in &dir {
|
||||||
|
starts.push(off);
|
||||||
|
off += l;
|
||||||
|
}
|
||||||
|
let n = dir.len();
|
||||||
|
let mut out = Vec::with_capacity(12 + 16 * n + total + 4 * n);
|
||||||
|
let mut pow = 1usize;
|
||||||
|
let mut log = 0u16;
|
||||||
|
while pow * 2 <= n {
|
||||||
|
pow *= 2;
|
||||||
|
log += 1;
|
||||||
|
}
|
||||||
|
out.extend_from_slice(&flavor.to_be_bytes());
|
||||||
|
out.extend_from_slice(&(n as u16).to_be_bytes());
|
||||||
|
out.extend_from_slice(&((pow * 16) as u16).to_be_bytes());
|
||||||
|
out.extend_from_slice(&log.to_be_bytes());
|
||||||
|
out.extend_from_slice(&((n * 16 - pow * 16) as u16).to_be_bytes());
|
||||||
|
let mut data_off = 12 + 16 * n;
|
||||||
|
for &i in &order {
|
||||||
|
let (tag, len) = dir[i];
|
||||||
|
let body = &raw[starts[i]..starts[i] + len];
|
||||||
|
out.extend_from_slice(&tag);
|
||||||
|
out.extend_from_slice(&checksum(body).to_be_bytes());
|
||||||
|
out.extend_from_slice(&(data_off as u32).to_be_bytes());
|
||||||
|
out.extend_from_slice(&(len as u32).to_be_bytes());
|
||||||
|
data_off += (len + 3) & !3;
|
||||||
|
}
|
||||||
|
for &i in &order {
|
||||||
|
let (_, len) = dir[i];
|
||||||
|
out.extend_from_slice(&raw[starts[i]..starts[i] + len]);
|
||||||
|
out.resize(out.len() + ((4 - len % 4) % 4), 0);
|
||||||
|
}
|
||||||
|
Ok(out)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
fn fonts_dir() -> std::path::PathBuf {
|
||||||
|
std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../public/fonts")
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn alle_gebuendelten_schriften_dekodieren() {
|
||||||
|
let mut n = 0;
|
||||||
|
for dir in std::fs::read_dir(fonts_dir()).unwrap() {
|
||||||
|
for f in std::fs::read_dir(dir.unwrap().path()).unwrap() {
|
||||||
|
let p = f.unwrap().path();
|
||||||
|
if p.extension().and_then(|e| e.to_str()) != Some("woff2") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let sfnt = to_sfnt(&std::fs::read(&p).unwrap()).unwrap_or_else(|e| panic!("{}: {e}", p.display()));
|
||||||
|
let tables = u16::from_be_bytes([sfnt[4], sfnt[5]]) as usize;
|
||||||
|
// `head`: Magic 0x5F0F3CF5 bei Offset 12 der Tabelle.
|
||||||
|
let head = (0..tables)
|
||||||
|
.map(|k| &sfnt[12 + 16 * k..12 + 16 * k + 16])
|
||||||
|
.find(|r| &r[..4] == b"head")
|
||||||
|
.unwrap_or_else(|| panic!("{}: ohne head", p.display()));
|
||||||
|
let off = u32::from_be_bytes(head[8..12].try_into().unwrap()) as usize;
|
||||||
|
assert_eq!(&sfnt[off + 12..off + 16], &[0x5f, 0x0f, 0x3c, 0xf5], "{}", p.display());
|
||||||
|
n += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert!(n >= 50, "nur {n} Schriften gefunden");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn rohes_sfnt_geht_durch_und_muell_wird_abgelehnt() {
|
||||||
|
let ttf = include_bytes!("../assets/Inter.ttf");
|
||||||
|
assert_eq!(to_sfnt(ttf).unwrap(), ttf);
|
||||||
|
assert!(to_sfnt(b"").is_err());
|
||||||
|
assert!(to_sfnt(b"wOF2").is_err());
|
||||||
|
assert!(to_sfnt(b"wOF2\0\0\0\0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").is_err());
|
||||||
|
assert!(to_sfnt(b"hello world").is_err());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -286,6 +286,44 @@ fn native2d_scene_texts(app: tauri::AppHandle, request: tauri::ipc::Request<'_>)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// [226] Schriftdatei fuer den Glyphen-Pass der Flaeche: Body = WOFF2/SFNT-Bytes (leer = Datei gibt es nicht),
|
||||||
|
/// Header `x-font-key` = Familie << 8 | Schnitt.
|
||||||
|
#[tauri::command]
|
||||||
|
fn native2d_font(app: tauri::AppHandle, request: tauri::ipc::Request<'_>) -> Result<bool, String> {
|
||||||
|
#[cfg(all(feature = "native2d", target_os = "macos"))]
|
||||||
|
{
|
||||||
|
let key: u32 = request
|
||||||
|
.headers()
|
||||||
|
.get("x-font-key")
|
||||||
|
.and_then(|v| v.to_str().ok())
|
||||||
|
.and_then(|v| v.parse().ok())
|
||||||
|
.ok_or("x-font-key fehlt")?;
|
||||||
|
let tauri::ipc::InvokeBody::Raw(bytes) = request.body() else {
|
||||||
|
return Err("Rohdaten erwartet".into());
|
||||||
|
};
|
||||||
|
return Ok(native_embed::add_font(&app, key, bytes));
|
||||||
|
}
|
||||||
|
#[cfg(not(all(feature = "native2d", target_os = "macos")))]
|
||||||
|
{
|
||||||
|
let _ = (app, request);
|
||||||
|
Ok(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// [226] Schriftdateien (`Familie << 8 | Schnitt`), die die gesetzten Textzeilen noch brauchen.
|
||||||
|
#[tauri::command]
|
||||||
|
fn native2d_needed_fonts(app: tauri::AppHandle) -> Vec<u32> {
|
||||||
|
#[cfg(all(feature = "native2d", target_os = "macos"))]
|
||||||
|
{
|
||||||
|
return native_embed::needed_fonts(&app);
|
||||||
|
}
|
||||||
|
#[cfg(not(all(feature = "native2d", target_os = "macos")))]
|
||||||
|
{
|
||||||
|
let _ = app;
|
||||||
|
Vec::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
fn native2d_frame(app: tauri::AppHandle, view: serde_json::Value, paper_scale: f64, clear: Option<[f64; 3]>, dash_scale: Option<f64>) -> Result<(), String> {
|
fn native2d_frame(app: tauri::AppHandle, view: serde_json::Value, paper_scale: f64, clear: Option<[f64; 3]>, dash_scale: Option<f64>) -> Result<(), String> {
|
||||||
#[cfg(all(feature = "native2d", target_os = "macos"))]
|
#[cfg(all(feature = "native2d", target_os = "macos"))]
|
||||||
@@ -362,6 +400,8 @@ pub fn run() {
|
|||||||
native2d_frame,
|
native2d_frame,
|
||||||
native2d_texts,
|
native2d_texts,
|
||||||
native2d_scene_texts,
|
native2d_scene_texts,
|
||||||
|
native2d_font,
|
||||||
|
native2d_needed_fonts,
|
||||||
push_native_scene,
|
push_native_scene,
|
||||||
push_native_walls,
|
push_native_walls,
|
||||||
acquire_project_lock,
|
acquire_project_lock,
|
||||||
@@ -385,6 +425,8 @@ pub fn run() {
|
|||||||
native2d_frame,
|
native2d_frame,
|
||||||
native2d_texts,
|
native2d_texts,
|
||||||
native2d_scene_texts,
|
native2d_scene_texts,
|
||||||
|
native2d_font,
|
||||||
|
native2d_needed_fonts,
|
||||||
acquire_project_lock,
|
acquire_project_lock,
|
||||||
release_project_lock,
|
release_project_lock,
|
||||||
save_atomic,
|
save_atomic,
|
||||||
|
|||||||
@@ -252,6 +252,32 @@ pub fn set_scene_texts(app: &AppHandle, bytes: &[u8], n: f64) -> bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// [226] Schriftdatei (WOFF2/SFNT) fuer `key` = Familie << 8 | Schnitt in den Glyphen-Pass einspielen und neu
|
||||||
|
/// zeichnen; leere `bytes` = es gibt keine Datei (nicht weiter anfordern). `false` = Flaeche fehlt oder unbrauchbar.
|
||||||
|
pub fn add_font(app: &AppHandle, key: u32, bytes: &[u8]) -> bool {
|
||||||
|
match app.state::<EmbedState>().0.lock().unwrap().as_mut() {
|
||||||
|
Some(e) => {
|
||||||
|
let ok = if bytes.is_empty() {
|
||||||
|
e.renderer.mark_font_unavailable(key);
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
e.renderer.add_font(key, bytes)
|
||||||
|
};
|
||||||
|
draw(e);
|
||||||
|
ok
|
||||||
|
}
|
||||||
|
None => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// [226] Schriftdateien (`Familie << 8 | Schnitt`), die die gesetzten Textzeilen noch brauchen.
|
||||||
|
pub fn needed_fonts(app: &AppHandle) -> Vec<u32> {
|
||||||
|
match app.state::<EmbedState>().0.lock().unwrap().as_ref() {
|
||||||
|
Some(e) => e.renderer.needed_fonts(),
|
||||||
|
None => Vec::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Geaenderte Bereiche eines Puffers einspielen und ihn unter neuer ID fuehren.
|
/// Geaenderte Bereiche eines Puffers einspielen und ihn unter neuer ID fuehren.
|
||||||
pub fn patch(app: &AppHandle, from: u32, to: u32, ranges: &[(u64, u64)], bytes: &[u8]) -> bool {
|
pub fn patch(app: &AppHandle, from: u32, to: u32, ranges: &[(u64, u64)], bytes: &[u8]) -> bool {
|
||||||
match app.state::<EmbedState>().0.lock().unwrap().as_mut() {
|
match app.state::<EmbedState>().0.lock().unwrap().as_mut() {
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import { describe, expect, it } from "vitest";
|
||||||
|
import { existsSync } from "node:fs";
|
||||||
|
import { TEXT_FONTS } from "./fontList";
|
||||||
|
import { fontFileUrl, loadFontFile } from "./glyphFonts";
|
||||||
|
|
||||||
|
describe("glyphFonts", () => {
|
||||||
|
it("jeder Schlüssel zeigt auf eine vorhandene Datei (ausser fehlenden Schnitten)", () => {
|
||||||
|
const missing: string[] = [];
|
||||||
|
for (let id = 2; id <= TEXT_FONTS.length; id++) {
|
||||||
|
for (let style = 0; style < 4; style++) {
|
||||||
|
const url = fontFileUrl((id << 8) | style)!;
|
||||||
|
expect(url).toMatch(/^\/fonts\/[a-z0-9-]+\/[a-z0-9-]+-(400|700)-(normal|italic)\.woff2$/);
|
||||||
|
if (!existsSync(`public${url}`)) missing.push(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Nur die Kursiv-Schnitte der Familien ohne Kursivdatei fehlen (Manrope, Outfit, Space Grotesk).
|
||||||
|
expect(missing.every((u) => /manrope|outfit|space-grotesk/.test(u) && u.includes("italic"))).toBe(true);
|
||||||
|
expect(fontFileUrl(0)).toBeNull();
|
||||||
|
expect(fontFileUrl(1 << 8)).toBeNull();
|
||||||
|
expect(fontFileUrl(99 << 8)).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("lädt je Schlüssel einmal; 404 und Netzfehler ergeben null", async () => {
|
||||||
|
let calls = 0;
|
||||||
|
const ok = (async () => {
|
||||||
|
calls++;
|
||||||
|
return new Response(new Uint8Array([1, 2, 3]));
|
||||||
|
}) as unknown as typeof fetch;
|
||||||
|
const key = (15 << 8) | 1;
|
||||||
|
expect(Array.from((await loadFontFile(key, ok))!)).toEqual([1, 2, 3]);
|
||||||
|
await loadFontFile(key, ok);
|
||||||
|
expect(calls).toBe(1);
|
||||||
|
const nf = (async () => new Response("x", { status: 404 })) as unknown as typeof fetch;
|
||||||
|
expect(await loadFontFile((14 << 8) | 2, nf)).toBeNull();
|
||||||
|
const boom = (async () => {
|
||||||
|
throw new Error("offline");
|
||||||
|
}) as unknown as typeof fetch;
|
||||||
|
expect(await loadFontFile((13 << 8) | 3, boom)).toBeNull();
|
||||||
|
expect(await loadFontFile(0)).toBeNull();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
// Schriftdateien für den GPU-Glyphen-Pass ([226]): render2d zeichnet Texte mit der gebündelten Familie der
|
||||||
|
// Zeile (Szenenformat: Kennung = Index in `TEXT_FONTS` + 1, 0 = Inter) und fordert die Dateien lazy an
|
||||||
|
// (`needed_fonts`, Schlüssel = Familie << 8 | Schnitt, Bit 0 fett, Bit 1 kursiv). Hier: Schlüssel → URL → Bytes.
|
||||||
|
// Die Dateien sind dieselben WOFF2 wie im CSS (`public/fonts`, `fonts.css`); render2d entpackt sie selbst.
|
||||||
|
|
||||||
|
import { TEXT_FONTS } from "./fontList";
|
||||||
|
|
||||||
|
export const FONT_STYLE_BOLD = 1;
|
||||||
|
export const FONT_STYLE_ITALIC = 2;
|
||||||
|
|
||||||
|
/** `Familie << 8 | Schnitt` → URL der WOFF2-Datei (`null` für Inter/unbekannte Kennung). */
|
||||||
|
export function fontFileUrl(key: number): string | null {
|
||||||
|
const family = key >>> 8;
|
||||||
|
const style = key & 0xff;
|
||||||
|
const name = family >= 2 ? TEXT_FONTS[family - 1] : undefined;
|
||||||
|
if (!name) return null;
|
||||||
|
const slug = name.toLowerCase().replace(/\s+/g, "-");
|
||||||
|
const weight = style & FONT_STYLE_BOLD ? 700 : 400;
|
||||||
|
const slant = style & FONT_STYLE_ITALIC ? "italic" : "normal";
|
||||||
|
return `/fonts/${slug}/${slug}-${weight}-${slant}.woff2`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const cache = new Map<number, Promise<Uint8Array | null>>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bytes der Schriftdatei zu `key` laden (je Schlüssel einmal, auch bei Fehlschlag). `null` = es gibt keine
|
||||||
|
* (404, Netz-/Dateifehler): der Pass bleibt dann bei der Ersatz-Variante bzw. Inter. Lokale App-Dateien,
|
||||||
|
* kein Netzabruf nach aussen (daher `fetch` statt `netFetch`).
|
||||||
|
*/
|
||||||
|
export function loadFontFile(key: number, fetchFn: typeof fetch = fetch): Promise<Uint8Array | null> {
|
||||||
|
let p = cache.get(key);
|
||||||
|
if (!p) {
|
||||||
|
const url = fontFileUrl(key);
|
||||||
|
p = url
|
||||||
|
? fetchFn(url).then(
|
||||||
|
async (r) => (r.ok ? new Uint8Array(await r.arrayBuffer()) : null),
|
||||||
|
() => null,
|
||||||
|
)
|
||||||
|
: Promise.resolve(null);
|
||||||
|
cache.set(key, p);
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@ import type { Primitive } from "../../core";
|
|||||||
import { NativeGl, type NativeInvoke } from './nativeGl';
|
import { NativeGl, type NativeInvoke } from './nativeGl';
|
||||||
import { readCssColor } from './cssColor';
|
import { readCssColor } from './cssColor';
|
||||||
import { NativeFrameQueue } from './nativeFrameQueue';
|
import { NativeFrameQueue } from './nativeFrameQueue';
|
||||||
|
import { loadFontFile } from '../../text/glyphFonts';
|
||||||
import { NativeTextSync } from "../../core";
|
import { NativeTextSync } from "../../core";
|
||||||
import { planTextEntries, planScreenTexts } from "../../core";
|
import { planTextEntries, planScreenTexts } from "../../core";
|
||||||
|
|
||||||
@@ -97,6 +98,24 @@ export function useNativePlanRenderer(
|
|||||||
const textScaleRef = useRef(100);
|
const textScaleRef = useRef(100);
|
||||||
const sceneTextsRetries = useRef(0);
|
const sceneTextsRetries = useRef(0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [226] Schriftfamilien der gesetzten Zeilen: die Fläche nennt die Dateien, die ihr fehlen
|
||||||
|
* (`native2d_needed_fonts`), die Webview liefert die Bytes (`native2d_font`, leer = gibt es nicht) und fragt
|
||||||
|
* erneut, bis nichts mehr fehlt (Ersatzkette bei fehlendem Schnitt). Nicht auf dem Mac geprüft.
|
||||||
|
*/
|
||||||
|
const feedFonts = useCallback(async (invoke: NativeInvoke) => {
|
||||||
|
for (let round = 0; round < 8; round++) {
|
||||||
|
const needed = (await invoke('native2d_needed_fonts').catch(() => [])) as number[];
|
||||||
|
if (!Array.isArray(needed) || needed.length === 0) return;
|
||||||
|
await Promise.all(
|
||||||
|
needed.map(async (key) => {
|
||||||
|
const bytes = (await loadFontFile(key)) ?? new Uint8Array(0);
|
||||||
|
await invoke('native2d_font', bytes, { headers: { 'x-font-key': String(key) } }).catch(() => {});
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
const pushSceneTexts = useCallback(function push(plan: Plan | null) {
|
const pushSceneTexts = useCallback(function push(plan: Plan | null) {
|
||||||
const invoke = invokeRef.current;
|
const invoke = invokeRef.current;
|
||||||
if (!invoke || !plan || sceneTextsDisabled.current) return;
|
if (!invoke || !plan || sceneTextsDisabled.current) return;
|
||||||
@@ -114,6 +133,7 @@ export function useNativePlanRenderer(
|
|||||||
if (ok === true) {
|
if (ok === true) {
|
||||||
sceneTextsRetries.current = 0;
|
sceneTextsRetries.current = 0;
|
||||||
setSceneTexts(true);
|
setSceneTexts(true);
|
||||||
|
void feedFonts(invoke);
|
||||||
} else {
|
} else {
|
||||||
// Fläche (noch) nicht bereit: etwas später erneut versuchen (höchstens ein paar Mal).
|
// Fläche (noch) nicht bereit: etwas später erneut versuchen (höchstens ein paar Mal).
|
||||||
sceneTextsSent.current = null;
|
sceneTextsSent.current = null;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
import { useCallback, useEffect, useRef, useState } from "react";
|
import { useCallback, useEffect, useRef, useState } from "react";
|
||||||
import type { Plan } from "../../core";
|
import type { Plan } from "../../core";
|
||||||
import { planSceneBin } from "../../core";
|
import { planSceneBin } from "../../core";
|
||||||
|
import { loadFontFile } from "../../text/glyphFonts";
|
||||||
import { type WebPlanRendererLike, WasmPlanRendererSession } from "./wasmRendererSession";
|
import { type WebPlanRendererLike, WasmPlanRendererSession } from "./wasmRendererSession";
|
||||||
|
|
||||||
interface ViewBox {
|
interface ViewBox {
|
||||||
@@ -73,6 +74,7 @@ function sessionFor(canvas: HTMLCanvasElement): CanvasSession {
|
|||||||
const session = new WasmPlanRendererSession<Plan>({
|
const session = new WasmPlanRendererSession<Plan>({
|
||||||
create: () => createRenderer(canvas),
|
create: () => createRenderer(canvas),
|
||||||
encode: (plan) => planSceneBin(plan),
|
encode: (plan) => planSceneBin(plan),
|
||||||
|
loadFont: (key) => loadFontFile(key),
|
||||||
onReadyChange: (r) => listeners.forEach((l) => l(r)),
|
onReadyChange: (r) => listeners.forEach((l) => l(r)),
|
||||||
});
|
});
|
||||||
cs = { session, listeners };
|
cs = { session, listeners };
|
||||||
|
|||||||
@@ -74,6 +74,25 @@ class FakeRenderer implements WebPlanRendererLike {
|
|||||||
free(): void {
|
free(): void {
|
||||||
this.freed = true;
|
this.freed = true;
|
||||||
}
|
}
|
||||||
|
/** [226] Schriften, die die Szene braucht; `add_font` erfüllt sie, `mark_font_unavailable` streicht sie. */
|
||||||
|
wanted: number[] = [];
|
||||||
|
fonts: Record<number, number> = {};
|
||||||
|
needed_fonts(): number[] {
|
||||||
|
this.enter("needed");
|
||||||
|
this.leave();
|
||||||
|
return this.wanted.filter((k) => !(k in this.fonts));
|
||||||
|
}
|
||||||
|
add_font(key: number, bytes: Uint8Array): boolean {
|
||||||
|
this.enter(`font:${key}`);
|
||||||
|
this.fonts[key] = bytes.length;
|
||||||
|
this.leave();
|
||||||
|
return bytes.length > 0;
|
||||||
|
}
|
||||||
|
mark_font_unavailable(key: number): void {
|
||||||
|
this.enter(`nofont:${key}`);
|
||||||
|
this.fonts[key] = -1;
|
||||||
|
this.leave();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const frame = (x: number): PlanFrame => ({
|
const frame = (x: number): PlanFrame => ({
|
||||||
@@ -84,7 +103,7 @@ const frame = (x: number): PlanFrame => ({
|
|||||||
height: 100,
|
height: 100,
|
||||||
});
|
});
|
||||||
|
|
||||||
function setup(opts: { maxRecoveries?: number; failCreate?: () => boolean; now?: () => number } = {}) {
|
function setup(opts: { maxRecoveries?: number; failCreate?: () => boolean; now?: () => number; loadFont?: (key: number) => Promise<Uint8Array | null> } = {}) {
|
||||||
const made: FakeRenderer[] = [];
|
const made: FakeRenderer[] = [];
|
||||||
const ready: boolean[] = [];
|
const ready: boolean[] = [];
|
||||||
const warnings: string[] = [];
|
const warnings: string[] = [];
|
||||||
@@ -101,6 +120,7 @@ function setup(opts: { maxRecoveries?: number; failCreate?: () => boolean; now?:
|
|||||||
}),
|
}),
|
||||||
encode: (s) => new TextEncoder().encode(s.name),
|
encode: (s) => new TextEncoder().encode(s.name),
|
||||||
onReadyChange: (r) => ready.push(r),
|
onReadyChange: (r) => ready.push(r),
|
||||||
|
loadFont: opts.loadFont,
|
||||||
warn: (m) => warnings.push(m),
|
warn: (m) => warnings.push(m),
|
||||||
maxRecoveries: opts.maxRecoveries,
|
maxRecoveries: opts.maxRecoveries,
|
||||||
recoveryWindowMs: 1000,
|
recoveryWindowMs: 1000,
|
||||||
@@ -134,6 +154,29 @@ describe("WasmPlanRendererSession", () => {
|
|||||||
expect(made[0].calls.at(-1)).toBe("render");
|
expect(made[0].calls.at(-1)).toBe("render");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("[226] fordert fehlende Schriften an, spielt sie ein und zeichnet neu; fehlende Dateien werden gemeldet", async () => {
|
||||||
|
const asked: number[] = [];
|
||||||
|
const { session, made, settle } = setup({
|
||||||
|
loadFont: async (k) => {
|
||||||
|
asked.push(k);
|
||||||
|
return k === (7 << 8) ? null : new Uint8Array([1, 2]);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
session.start();
|
||||||
|
await settle();
|
||||||
|
made[0].wanted = [(15 << 8) | 1, 7 << 8];
|
||||||
|
session.setScene({ name: "A" });
|
||||||
|
session.draw(frame(1));
|
||||||
|
await settle();
|
||||||
|
expect(asked.sort()).toEqual([7 << 8, (15 << 8) | 1]);
|
||||||
|
expect(made[0].fonts).toEqual({ [(15 << 8) | 1]: 2, [7 << 8]: -1 });
|
||||||
|
// Nach dem Einspielen wurde neu gezeichnet; nichts wird zweimal angefordert.
|
||||||
|
expect(made[0].calls.filter((c) => c === "render").length).toBeGreaterThanOrEqual(2);
|
||||||
|
session.setScene({ name: "B" });
|
||||||
|
await settle();
|
||||||
|
expect(asked.length).toBe(2);
|
||||||
|
});
|
||||||
|
|
||||||
it("Szene und Ausschnitt vor dem Start gehen nicht verloren", async () => {
|
it("Szene und Ausschnitt vor dem Start gehen nicht verloren", async () => {
|
||||||
const { session, made, settle } = setup();
|
const { session, made, settle } = setup();
|
||||||
session.start();
|
session.start();
|
||||||
|
|||||||
@@ -32,6 +32,12 @@ export interface WebPlanRendererLike {
|
|||||||
set_dash_scale?(n: number): void;
|
set_dash_scale?(n: number): void;
|
||||||
resize(w: number, h: number): void;
|
resize(w: number, h: number): void;
|
||||||
render(): void;
|
render(): void;
|
||||||
|
/** [226] Schriftdateien (Familie << 8 | Schnitt), die die Szene noch braucht. */
|
||||||
|
needed_fonts?(): ArrayLike<number>;
|
||||||
|
/** [226] Schriftdatei (WOFF2/SFNT) einspielen; false = unbrauchbar. */
|
||||||
|
add_font?(key: number, bytes: Uint8Array): boolean;
|
||||||
|
/** [226] Zu `key` gibt es keine Datei. */
|
||||||
|
mark_font_unavailable?(key: number): void;
|
||||||
/** true, sobald das WebGPU-Gerät verloren ist (dann zeichnet der Renderer nichts mehr). */
|
/** true, sobald das WebGPU-Gerät verloren ist (dann zeichnet der Renderer nichts mehr). */
|
||||||
is_lost(): boolean;
|
is_lost(): boolean;
|
||||||
/** Rückruf beim Geräteverlust (aus dem `device.lost`-Promise). */
|
/** Rückruf beim Geräteverlust (aus dem `device.lost`-Promise). */
|
||||||
@@ -55,6 +61,8 @@ export interface SessionOptions<S> {
|
|||||||
create(): Promise<WebPlanRendererLike>;
|
create(): Promise<WebPlanRendererLike>;
|
||||||
/** Szene → Binärpuffer (`planSceneBin`). */
|
/** Szene → Binärpuffer (`planSceneBin`). */
|
||||||
encode(scene: S): Uint8Array;
|
encode(scene: S): Uint8Array;
|
||||||
|
/** [226] Bytes der Schriftdatei zu `key` (Familie << 8 | Schnitt) holen; `null` = gibt es nicht. */
|
||||||
|
loadFont?(key: number): Promise<Uint8Array | null>;
|
||||||
/** Bereitschaft geändert (false → Aufrufer zeichnet über SVG). */
|
/** Bereitschaft geändert (false → Aufrufer zeichnet über SVG). */
|
||||||
onReadyChange(ready: boolean): void;
|
onReadyChange(ready: boolean): void;
|
||||||
warn?(msg: string, e?: unknown): void;
|
warn?(msg: string, e?: unknown): void;
|
||||||
@@ -80,6 +88,8 @@ export class WasmPlanRendererSession<S> {
|
|||||||
private disposed = false;
|
private disposed = false;
|
||||||
/** Zeitpunkte der Neuaufbauten im laufenden Fenster. */
|
/** Zeitpunkte der Neuaufbauten im laufenden Fenster. */
|
||||||
private recoveries: number[] = [];
|
private recoveries: number[] = [];
|
||||||
|
/** [226] Schriftdateien, die gerade geladen werden. */
|
||||||
|
private fontsLoading = new Set<number>();
|
||||||
private _ready = false;
|
private _ready = false;
|
||||||
private readonly maxRecoveries: number;
|
private readonly maxRecoveries: number;
|
||||||
|
|
||||||
@@ -149,6 +159,7 @@ export class WasmPlanRendererSession<S> {
|
|||||||
}
|
}
|
||||||
this.renderer = r;
|
this.renderer = r;
|
||||||
this.uploaded = undefined;
|
this.uploaded = undefined;
|
||||||
|
this.fontsLoading.clear();
|
||||||
r.set_lost_callback?.(() => {
|
r.set_lost_callback?.(() => {
|
||||||
if (this.renderer === r) this.fail(new Error("WebGPU-Gerät verloren"), true);
|
if (this.renderer === r) this.fail(new Error("WebGPU-Gerät verloren"), true);
|
||||||
});
|
});
|
||||||
@@ -164,6 +175,45 @@ export class WasmPlanRendererSession<S> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [226] Schriften, die die Szene braucht und der Renderer noch nicht hat, laden und einspielen; danach
|
||||||
|
* neu zeichnen (und erneut fragen: fehlt ein Schnitt, kommt der nächste der Ersatzkette). Aufruf im
|
||||||
|
* `flush` (Renderer frei); die Antworten kommen asynchron, nie mitten in einem Aufruf.
|
||||||
|
*/
|
||||||
|
private requestFonts(r: WebPlanRendererLike): void {
|
||||||
|
const load = this.opts.loadFont;
|
||||||
|
if (!load || !r.needed_fonts) return;
|
||||||
|
for (const key of Array.from(r.needed_fonts())) {
|
||||||
|
if (this.fontsLoading.has(key)) continue;
|
||||||
|
this.fontsLoading.add(key);
|
||||||
|
load(key).then(
|
||||||
|
(bytes) => this.fontArrived(r, key, bytes),
|
||||||
|
() => this.fontArrived(r, key, null),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fontArrived(r: WebPlanRendererLike, key: number, bytes: Uint8Array | null): void {
|
||||||
|
this.fontsLoading.delete(key);
|
||||||
|
if (this.disposed || this.renderer !== r) return;
|
||||||
|
if (this.inCall) {
|
||||||
|
// Kann bei synchron erfüllten Schein-Ladern vorkommen: nach dem Aufruf nachholen.
|
||||||
|
Promise.resolve().then(() => this.fontArrived(r, key, bytes));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.inCall = true;
|
||||||
|
try {
|
||||||
|
if (!bytes || !r.add_font?.(key, bytes)) r.mark_font_unavailable?.(key);
|
||||||
|
} catch (e) {
|
||||||
|
this.inCall = false;
|
||||||
|
this.fail(e, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.inCall = false;
|
||||||
|
this.requestFonts(r);
|
||||||
|
this.flush(true);
|
||||||
|
}
|
||||||
|
|
||||||
/** Renderer ausgefallen: verwerfen und (im Budget) neu aufbauen. */
|
/** Renderer ausgefallen: verwerfen und (im Budget) neu aufbauen. */
|
||||||
private fail(e: unknown, healthy: boolean): void {
|
private fail(e: unknown, healthy: boolean): void {
|
||||||
const old = this.renderer;
|
const old = this.renderer;
|
||||||
@@ -213,6 +263,7 @@ export class WasmPlanRendererSession<S> {
|
|||||||
if (bytes) {
|
if (bytes) {
|
||||||
r.set_scene_bin(bytes);
|
r.set_scene_bin(bytes);
|
||||||
this.uploaded = scene;
|
this.uploaded = scene;
|
||||||
|
this.requestFonts(r);
|
||||||
}
|
}
|
||||||
const f = this.frame;
|
const f = this.frame;
|
||||||
if (drawFrame && f) {
|
if (drawFrame && f) {
|
||||||
|
|||||||
Reference in new issue
Block a user