cosmic-text
cosmic-text copied to clipboard
WIP Multiple font size / line height spans
Current status: Almost done. Working, with some fixes for the editing required.
Fixes #64
Implement specifying multiple font sizes and/or line heights.
https://github.com/pop-os/cosmic-text/assets/38416468/60009d8f-74cf-410f-9c12-9ccff4979110
TODO:
- [x] fix scrolling
- [x] implement
enum LineHeight
- [x] cache
line_heights()
- [x] retire
Metrics
- [x] rebase
- [ ] migrate example editor-orbclient
- [ ] fix bug empty buffer does not render cursor
- [ ] fix bug empty buffer has default Attrs
- [ ] support rescaling font sizes on demand, perhaps via mutable access to spans of Attrs
- [ ] migrate example editor-test
- [ ] migrate example editor-libcosmic (NOTE: does not compile on Windows with pinned version of
iced
(incompatible API)) - [ ] migrate example terminal (NOTE: does not compile on Windows with
termion
, see https://github.com/pop-os/cosmic-text/pull/129) - [ ] migrate tests
- [ ] migrate benches
- [ ] migrate vi feature
- [ ] fix editor action Vertical
- [ ] fix some editor actions not redrawing
- [x] tidy up
- [ ] docs and PR write-up
Future work:
- Split
Attrs
:color_opt
,metadata
,font_size
,line_height
-
Buffer
should have a defaultAttrs
- Convenience method for updating all spans of
Attrs
in aBuffer
- Handle start-of-line
Attrs
more carefully
Questions:
- Should the
Hash
impl ofAttrs
include line height? - Should
Metrics
be restored as a property ofAttrs
, with definitionMetrics { font_size: f32, line_height: LineHeight }
?
Linking my PR that continues this PR: https://github.com/tigregalis/cosmic-text/pull/1