Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support display of styled text #70

Open
rjkroege opened this issue Jun 23, 2018 · 8 comments
Open

Support display of styled text #70

rjkroege opened this issue Jun 23, 2018 · 8 comments
Labels
enhancement New feature or request

Comments

@rjkroege
Copy link
Owner

Summary of idea: Edwood should permit an external program to set styles (bold, italics, etc.) on ranges of text. Use cases would include

  • implementing an external program to do syntax highlighting
  • showing coloured diffs in win
  • show the go coverage tool heat map in the buffer
  • (simplistic) markdown previewer
  • mark spelling mistakes in comments

External program would connect to the Edwood (aka Acme) filesystem and write style data to one of the special files. i.e.:

; 9p ls acme/2
addr
body
ctl
data
editout
errors
event
rdsel
tag
wrsel
xdata

would get two new entries:

; 9p ls acme/2
addr
body
bodystyle
ctl
data
editout
errors
event
rdsel
tag
tagstyle
wrsel
xdata

or something like that. And styling could be written to the bodystyle or tagstyle files.

@rjkroege rjkroege added the enhancement New feature or request label Jun 23, 2018
@rjkroege
Copy link
Owner Author

I will note in passing based that this enhancement will require extensive changes probably extending into devdraw if we wish to support varying line heights.

@sirnewton01
Copy link

Are varying line heights the only change required in devdraw? I wouldn't initially expect that bold/italic/colouring would affect the heights, but perhaps I'm missing something.

@rjkroege
Copy link
Owner Author

rjkroege commented Sep 5, 2018

I'd like to support fonts of differing sizes.

@sirnewton01
Copy link

The reason I ask is that I'm curious whether edwood would work or continue to work in plan 9 with a change to the draw interface. Perhaps that is not a design goal for this project, but I thought I would ask.

@fhs
Copy link
Contributor

fhs commented Sep 5, 2018

Support for Plan 9 and other OSes should be a goal. I've opened #115 (Plan 9 support) and #116 (Windows support).

@rjkroege
Copy link
Owner Author

rjkroege commented Sep 6, 2018

I note the following.

  • I haven't decided how I'm going to do the implementation but I'm going to try to do the simplest thing.
  • I'd like to keep on supporting the existing devdraw protocol if only because I like incremental progress. That would let this work on Plan9.
  • Folk-wisdom and benchmarking show that the devdraw protocol is not very performant drawing many small rects whether they're glyphs or simply blits.
  • Heavy use of styles that change line heights (imagine using this style capability to show godoc pages with roughly the same styling as they have in a webpage) will need more glyph draws and small blits than the current frame implementation.
  • Even the current Edwood implementation draws too much and is sluggish with selection repaint (selection flicker #56). Styles will make this worse. But I'd like to make it fast.
  • I was imagining someday an alternative devdraw implementation that would offer a protocol extension to greatly speed up drawing styled text and the draw package would use it when available.
  • There's no reason not to have such a devdraw run also on windows etc.

@rjkroege
Copy link
Owner Author

rjkroege commented Sep 6, 2018

Hm. Then again, maybe duitdraw or something like that is a better approach.

@sirnewton01
Copy link

Thank you for the clarification. I would like to give this a try on Plan 9/9front at some point. I'm personally ok with using 9front and even proposing or working on extensions to draw there. I think that it would be interesting to be able to auto-probe whether the draw(3) files support the extensions or not before using the new commands. Maybe even 3D graphics commands could work this way some day in the future.

In terms of styled text and godoc styling I don't know if I would need variable heights. I personally would be quite happy to have a little colour, some bold/underline similar to man pages in Linux/Mac. Kind of in between the pure text godoc and the HTML godoc. Full and rich styling is something that PDF viewers and web browsers excel along with all of the baggage that comes with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants