rjkroege / edwood

Go version of Plan9 Acme Editor
Other
384 stars 34 forks source link

Support display of styled text #70

Open rjkroege opened 6 years ago

rjkroege commented 6 years ago

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

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

I'd like to support fonts of differing sizes.

sirnewton01 commented 6 years ago

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 commented 6 years ago

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

rjkroege commented 6 years ago

I note the following.

rjkroege commented 6 years ago

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

sirnewton01 commented 6 years ago

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.