Hi Joe,
Outstanding research!
I've been flailing around a similar problem with dim lights of success here and there.
We all know that there are issues with your long-in-the-tooth erlguten library.
I've pulled out the font management and copy-fitting routines, made slight modifications, and have been building up a page-layout program. At the moment I'm focusing on PDF, but many underlying concepts apply to HTML and desktop GUIs as well.
So first thing I'd note, is that you may be dealing with an even more general problem than you think-- e.g. how to display content in a 2D space for most effective communication of intent between content creator and consumer. In the case of GUIs, the roles of content creator and consumer shift back and forth like a ping pong game.
Print graphic designers have long experience and established techniques for approaching the problem.
They first divide the 2D space into a page grid--- essentially a composition of boxes. You'll find many approaches and theories of how best to design page grids on the web.
Turns our that boxes can be comprehensively represented as maps in Erlang. Taken a step further, no reason why a box can't be moved, re dimensioned, scaled, etc., in an Erlang process.
Box parameters include xy position of upper-left corner in the 2D space, width, height, and various other application-specific parameters--- borders, background color/image, content, etc.
With this thought in mind, I've been working on a box language to efficiently define a page grid in Erlang. What I have works, but no doubt can be improved and optimized.
Next thought is what goes into each box in the page grid--- text, images, graphics, Erlang functions... Hey, "widgets" if you will.
Most all of this can be abstractly defined without regard to media--- print or video.
Box mind-set can be focused down on widgets.
A widget is a composition of visual elements in a contained space. Visual elements include text, icons, boxes, etc. Text and icons can be abstractly represented as boxes. Boxes all the way down.
So, my fantasy---
1. Perfect the box language--- may be two versions: a) text description; b) point, click, and drag
2. Perfect an abstract language to define content elements
3. Define the base visual/functional elements of the content language
4. Develop libraries of base elements for both print and video display
If we're smart and shrewd, we end up with an efficient way to generate both print and video display pages in a common language that effectively communicates intent.
I know that this is all warmed-over-soup. Just watch a handful of TV commercials to see how effectively graphic designers convey intent in 2D spaces or consider the communication issues in 3D CAD programs and how they've been resolved.
But I want to do it in Erlang and am currently working in my clumsy way to do so.
All the best,
Lloyd
When I wrote ex11 (a graphics experiment) I realised that
3D objects with behaviour are *really* just 2-D objects + time.
A button is just a rectangle with a shadow draw round it. When you
click it it moves down and the shadow changes, a little while later it returns
to its original position.
I wanted to make a tabbed widget - now you might think that I could
combine buttons in some kind of hbox - well yes you can but it looks
terrible. No a tabbed widget viewed as a 2D drawing is "just" a line
that moves up and down and a few shadows in the appropriate places.
So the way to make a tabbed widget is *not* to compose a hbox of buttons
but to draw the outline of what you want in 2D and make some regions that
are sensitive to mouse clicks.
The abstractions you think you need (buttons, sliders) are not the ones that
are useful from a compositional point of view.
This is actually why I like SVG - there are two abstractions path and group
- path draws a curve. Group glues objects and has an optional affine
transformation. All other SVG objects (rectangles, circles, lines,
...) can
be constructed from paths and groups.
Postscript is another *great* and not very well understood language -
display postscript would be great for GUIs but which is sadly not used.
It's crazy - in the browser it's really easy to mock up an interface
with SVG or a canvas or by adding things to the DOM - but on the
desktop it's a pain in the whatnot.
The answer is *not* to bundle the entire browser into a stand alone app
but to strip out the good parts and make a minimal system with only
the good parts (which in my mind is *just* a drawing surface, can a canvas
or SVG responsive widget) a small scripting language (say Lua or JS) and
a communication method (say JSON) and transport mechanism (say TCP)
This (of course) is what we do not do :-) - instead everything that has ever
seen the light of day is bundled into the browser and the parts cannot be
easily separated.
Cheers
/Joe
> ...a minimal system with only
> the good parts (which in my mind is *just* a drawing surface, can a canvas
> or SVG responsive widget) a small scripting language (say Lua or JS) and
> a communication method (say JSON) and transport mechanism (say TCP)
Sounds a bit like X11. But X11 isn't exactly minimal of course.
Interestingly there's a shift away from this model with Mir and
Wayland. From my understanding this is to make better use of modern
graphics hardware; shaders etc.
A canvas model is really great for graphics experiments. If someone
could port something like Processing.org to Erlang, that would be
really neat. But for applications I do like a native look and feel.
--Albin
On 27/07/17 12:45 PM, Albin Stigö wrote:
> I think NeXT and OpenStep used display postscript? Cocoa evolved from
> NeXT but they moved away from display postscript for performance
> reasons. A lot has happened since then so maybe the time has come for
> display postscript?
Before Display Postscript (developed for Apple)
there was NeWS. See the NeWS book at
http://bitsavers.trailing-edge.com/pdf/sun/NeWS/The_NeWS_Book_1989.pdf
Programming in a concurrent OO extension of Postscript never really
appealed to me, and the performance issues of thread decades ago
probably look quite different today with GPUs.