CodeEditApp / CodeEditApp/CodeEditSourceEditor

✨ Allow configuring the line number font

Aperta Adatta ai principianti
#376 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Swift
Stelle
719
Fork
160
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### Description

`SourceEditorConfiguration.Appearance.font` configures the editor text font, but the line-number gutter replaces it with `font.rulerFont` in `didSetOnController`. There is currently no public API for choosing the exact font and point size used by line numbers.

A use case is an editor configured with Monaco 12 pt that should also render its line numbers in Monaco 12 pt. At present, this requires maintaining a fork and changing:

```swift
controller.gutterView.font = font.rulerFont
```

A backward-compatible API could be:

```swift
public var lineNumberFont: NSFont?
```

The current behavior could remain the default:

```swift
controller.gutterView.font = lineNumberFont ?? font.rulerFont
```

### Alternatives Considered

- Making `GutterView.font` public. Keeping the option in `Appearance` seems preferable because it avoids exposing the view implementation.
- Always using `Appearance.font` for the gutter. This would change the existing default appearance, so an optional override is safer.

### Additional Context

This request is different from #58 and #157: those issues addressed the default ruler font appearance and proportional scaling. This request is specifically about allowing API consumers to override that default.

Observed on current `main` at revision `1fa4d3c`.

### Screenshots

Not applicable.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Start at SourceEditorConfiguration.Appearance.font and its didSetOnController handling, then inspect GutterView.font to understand how the ruler font is assigned. Add the proposed optional lineNumberFont API while preserving font.rulerFont as the default, and verify that consumers can override the gutter font without changing existing appearance behavior.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
swift
Ambito
desktop-dev
Tipo di issue
Funzionalità
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Attiva
Chiarezza
Specificata chiaramente
Idoneità per principianti
76/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.