Skip to content

Conversation

@sreya
Copy link
Contributor

@sreya sreya commented Dec 4, 2025

fixes #73

sreya added 3 commits December 4, 2025 00:34
Implement runtime font size and family changes via options proxy,
matching xterm.js API behavior.

Changes:
- Wire up fontSize option changes to renderer.setFontSize()
- Wire up fontFamily option changes to renderer.setFontFamily()
- Add handleFontChange() helper that:
  - Clears active selection (pixel positions changed)
  - Resizes canvas to match new font metrics
  - Forces full re-render
- Add tests for font change behavior

Usage:
  term.options.fontSize = 20;  // Dynamic resize
  term.options.fontFamily = 'Courier New';

Note: Font changes keep cols/rows constant (canvas grows/shrinks).
Use FitAddon.fit() after font change to recalculate grid dimensions.
Standalone demo page that allows testing:
- Font size changes via slider (8-32px)
- Font family changes via dropdown
- Refit to container after font change
- Test pattern for visual verification

Shows real-time metrics: cols, rows, cell dimensions, canvas size.
No server required - works with just 'bun run dev'.
Implement runtime font size and family changes via options proxy,
matching xterm.js API behavior.

Changes:
- Wire up fontSize option changes to renderer.setFontSize()
- Wire up fontFamily option changes to renderer.setFontFamily()
- Add handleFontChange() helper that:
  - Clears active selection (pixel positions changed)
  - Resizes canvas to match new font metrics
  - Forces full re-render
- Add tests for font change behavior

Usage:
  term.options.fontSize = 20;  // Dynamic resize
  term.options.fontFamily = 'Courier New';

Note: Font changes keep cols/rows constant (canvas grows/shrinks).
Use FitAddon.fit() after font change to recalculate grid dimensions.
@sreya sreya force-pushed the dynamic-font-resize-support branch from 285eed8 to 0cf9735 Compare December 4, 2025 06:50
@sreya sreya merged commit e879eef into main Dec 4, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resizing font after "open()"

1 participant