Add font family choice to the text widget, move toolbar below the editor
Build and push server image / test (push) Successful in 29s
Build and push server image / build-and-push (push) Successful in 2m1s
Build and push server image / deploy (push) Successful in 51s

Six more vendored families alongside the existing Noto Sans (Inter,
Source Sans 3, Noto Serif, Crimson Text, Arvo, IBM Plex Mono -- sans/
serif/slab/mono variety), all OFL-licensed with their own per-family
license file in app/fonts/ since each has a different copyright holder.
Static Regular/Bold/Italic/BoldItalic builds only -- variable-font-only
families (Inter and Source Sans's current Google Fonts releases, plus
Playfair Display/Lora/Merriweather) were skipped in favor of static
builds from their own upstream repos, keeping every family's loading
code uniform with what was already there. Considered but deliberately
left out: Georgia -- a proprietary Microsoft core font, not freely
redistributable, unlike everything else vendored here.

Also moves the bold/italic/underline/color toolbar below the
contenteditable box per request, and reorders the dialog's Settings
card to a more natural family-then-size order.

Fixes a latent migration bug this surfaced: migration 20 (static image
widget) used Base.metadata.create_all, which creates every table
declared in Base.metadata that's missing, not just its own new one --
harmless when nothing else pending, but once TextWidgetConfig existed
it would silently pre-create text_widget_configs (in whatever shape
models.py currently declares) before migration 21 got a turn, so
migration 21's own CREATE TABLE (or a later ALTER TABLE adding
font_family) would collide with a table create_all had already leaked
into existence. Both migrations 20 and 21 now use raw, frozen CREATE
TABLE SQL instead, matching migration 17's existing precedent for
exactly this reason.
This commit is contained in:
Thomas Faour
2026-07-25 16:05:22 +00:00
parent 3735c5bfa7
commit edbd90745b
39 changed files with 659 additions and 36 deletions
+17
View File
@@ -100,6 +100,23 @@ def test_render_respects_alignment(db_session):
assert img.size == (200, 100)
def test_render_supports_every_font_family(db_session):
for family in widgets.text.FONT_FAMILIES:
frame, widget = _make_widget(db_session, content=[[_run("The quick brown fox")]], font_family=family)
img = widgets.text.render(db_session, frame, widget, 250, 100)
assert img.size == (250, 100)
def test_render_falls_back_to_default_family_for_an_unrecognized_value(db_session):
"""A stale/tampered font_family value (e.g. a family removed in a
later release) never crashes render() -- falls back to the default
the same way an unrecognized align/display_mode value does
elsewhere in this codebase."""
frame, widget = _make_widget(db_session, content=[[_run("hi")]], font_family="does-not-exist")
img = widgets.text.render(db_session, frame, widget, 200, 100)
assert img.size == (200, 100)
def test_no_button_actions():
"""Fixed authored text -- nothing to advance/back/check."""
assert widgets.text.ACTIONS == {}