diff --git a/rhino/text_editor.py b/rhino/text_editor.py index 9a9bb17..e1a8e79 100644 --- a/rhino/text_editor.py +++ b/rhino/text_editor.py @@ -148,7 +148,10 @@ class TextEditorBridge(panel_base.BaseBridge): te.Plane = plane # Rich-Text (Phase 2) wenn vorhanden + nicht-trivial, sonst Plain - rtf = _runs_to_rtf(runs, st.get("font") or "Helvetica") if runs else None + rtf = _runs_to_rtf( + runs, + st.get("font") or "Helvetica", + base_size_m=float(st.get("size") or 0.2)) if runs else None applied_rtf = False if rtf: try: @@ -282,9 +285,11 @@ def _rtf_escape(s): return "".join(out) -def _runs_to_rtf(runs, default_font): +def _runs_to_rtf(runs, default_font, base_size_m=0.20): """Konvertiert Format-Runs in Rhinos RTF-Dialekt. Runs ist Liste von - dicts mit Keys text/font/bold/italic/underline/sup/sub/color.""" + dicts mit Keys text/font/bold/italic/underline/sup/sub/color/fontSizePx. + base_size_m: TextEntity.TextHeight (in m). Frontend rendert 1m = 100px, + also entspricht base_size_m * 100 dem "Standard" \\fs20 in RTF.""" if not runs: return None # Triviale Runs (alle plain, ein Font) → kein RTF noetig nontrivial = False @@ -322,8 +327,8 @@ def _runs_to_rtf(runs, default_font): parts.append("}") parts.append("\\pard") - # Editor Default-Font-Size in px (siehe TextEditorApp Editor-div: 14px) - BASE_PX = 14 + # Frontend rendert 1m = 100px; Standard-Run-Size ist base_size_m * 100 + BASE_PX = max(1.0, base_size_m * 100.0) for run in runs: codes = [] codes.append("\\f{}".format(font_idx(run.get("font") or default_font))) diff --git a/src/TextEditorApp.jsx b/src/TextEditorApp.jsx index e0836b3..052b49e 100644 --- a/src/TextEditorApp.jsx +++ b/src/TextEditorApp.jsx @@ -20,10 +20,11 @@ const SIZE_PRESETS = [0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.50, 0.70, 1.00] const BAR_H = 22 -function Pill({ children, onClick, active, disabled, title, style }) { +function Pill({ children, onClick, onMouseDown, active, disabled, title, style }) { return (