Home   Archive   Permalink

Rebol and fonts

Hi! I'm trying make for my own use a stylesheet that looks less retina-searing than the default styles from the 90's.
I have made some progress with colors and thinner borders and such, but several issues stemming from my general ignorance remain still.
For one thing, I caught some references to antialiasing from the source, but couldn't find anything about it from the docs. Only something about drawing vectorial fonts with AGG.
Secondly, how does one style sub-elements. For example http://pastebin.com/raw.php?i=yGJazRaB
Third, what would be the rational way to reduce repetition. Right now, the color and edge rules are repeat for every element that needs them. How could this be made shorter?
Thanks if you can clarify any of these at all!

posted by:   luminarious     11-Feb-2011/7:54:17-8:00

First question:
In REBOL 2, there are really two graphics engines, which is put together in a way that is a bit silly:
The first one is View, which is used for drawing user interface elements. It's the engine you use, when you are writing code to stylize UI elements differently, like in your example. The problem is that it doesn't support anti-aliased fonts at all and can't do rich text. The upside is that it supports adjusted and centered text. Worse is, that if you enable ClearType in Windows, the fonts will sometimes appear with pixel artifacts.
The second one is AGG, which works as a subset of View and can be used inside a face as an effect option. It supports anti-aliasing, but there is just about zero font metrix information available to you, so you can't wrap, flow or center text easily. This engine can't do rich text either. It is possible to add it, by "borrowing" View's methods but it's slow.
REBOL 3 solves this by getting rid of the first engine, making AGG the View engine and adding full support for font metrics, adjustments and rich text everywhere.
Second question:
This depends if the item is dynamically generated during layout, but you can much of the time do:
text-list: text-list with [edge: make edge [size: 1x1]]
Third question:
There are many tricks that work on different levels. You can do something like:
my-edge: [size: 1x1 color: red]
stylize [
    button: button edge my-edge
Also, I tend to use stylize/master, so you don't have to manually add the style sheet to every layout. Then it will be global for all layouts.

posted by:   Henrik     11-Feb-2011/8:23:28-8:00

Thank you Henrik! The stylize/master tip is very good. The R3 improvements seem very nice, but also barelyover the horizon.
Basically, I should just accept that until R3 arrives, all Rebol programs look fugly.
Is there anything I can do to hasten the coming of that day?

posted by:   luminarious     11-Feb-2011/13:01:29-8:00

I happen to work very closely with the people who are building the GUI system for R3 and the best thing to do right now is to download and test it:
It's still heavily under development.

posted by:   Henrik     11-Feb-2011/13:35:12-8:00

You can try alternative gui systems for R2, try GLASS and REBGUI. Their looks are more modern than VID.
Look at this very good looking application made with Rebol: PhotosReViewer
So I don't think "all Rebol programs look ugly" :)

posted by:   Endo     14-Feb-2011/3:58:52-8:00