cosmic-text icon indicating copy to clipboard operation
cosmic-text copied to clipboard

WIP Multiple font size / line height spans

Open tigregalis opened this issue 1 year ago • 1 comments

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 default Attrs
  • Convenience method for updating all spans of Attrs in a Buffer
  • Handle start-of-line Attrs more carefully

Questions:

  • Should the Hash impl of Attrs include line height?
  • Should Metrics be restored as a property of Attrs, with definition Metrics { font_size: f32, line_height: LineHeight }?

tigregalis avatar Jul 04 '23 12:07 tigregalis

Linking my PR that continues this PR: https://github.com/tigregalis/cosmic-text/pull/1

nicoburns avatar Nov 17 '23 15:11 nicoburns