Hello! I am currently investigating REBOL to see if I can use it for the development of (small) platform-independent programs. Graphics capabilities will be an important point. Some stuff is working already, but I can't achieve anti-aliased text under Mac OS X! Using the most recent View release of REBOL 2 for Mac OS X, I am trying s.th. like Code: view layout [ box 200x160 effect [draw [ pen black text 10x20 "Test" ]] ] with lots of variations (with/without font specification, various pen/fill-pen/line-width settings etc.) The "effect" seems to work under Windows, but not under Mac OS X. I even tried the tip found at http://www.compkarori.com/vanilla/display/AGG (after adapting it to Mac OS X with its differnt font paths), but never got any display. Adding a "line" command displayed that line, though - thus, I am quite certain that my commands should be basically correct. Does anybody have any ideas? Thanks in advance for any help!
See http://www.rebol.org/ml-display-thread.r?m=rmlMYDC Rebol lacks access to the glyph data on OSX so can not do the antiaiiased text. It does not look as though this will be ever fixed for Rebol2, and you may have to wait for Rebol3.
Graham, thanks for your quick response! That sounds bad! Proper text rendering is a major feature - aliased text just looks terribly ugly (especially when compared to other applications running on the same desktop that use anti-aliased fonts...) This makes it really difficult for me to use REBOL 2 - and REBOL 3 seems to be far away from an official relase.
Let's do something about the fonts, pleeeease ;( I got the chance to use Rebol in a project, but it's a serious drawback. How could we solve it? We really should congregate and solving this somehow. I would rather have a Rebol 2 with proper fonts than a Rebol 3 with no TTF support... -- @onetom
SOLUTION Linux has the same problem with DRAW and font. (but VID and all other work). On Linux (and on MacOS,that now it's a Linux flavor), try this: Code: fnt1: make face/font [ name: "/usr/share/fonts/truetype/freefont/FreeSans.ttf" size: 12 ] view layout [ box 200x160 effect [draw [ font fnt1 text "Test" ]] ] Try to use the correct path for fnt1 on your OS. Regards
Universal solution If you need to write a script for MAC, Linux and Windows, AND you need to use DRAW: you can make a test to know what OS is and set the correct font path: Code: if system/version/4 = 4 [ print "It's LINUX"] if system/version/4 = 3 [ print "It's Windows"] if system/version/4 = 2 [ print "It's MacOS"] if system/version/4 = 7 [ print "It's FreeBSD"] if system/version/4 = 9 [ print "It's OpenBSD"]
MacOS is not a Linux flavour. Rebol is not using X11 under Mac. Maybe it should have an X11 version... better than nothing. And of course the mentioned snippet doesn't work. It's been mentioned at a lot of places but it applies ONLY to Linux. for the record: curl -O ftp://ftp.gnu.org/pub/gnu/freefont/freefont-ttf-20100919.tar.gz tar zxvf freefont-ttf-20100919.tar.gz cat > font.r <<-"EOF" REBOL [] fnt1: make face/font [ name: "/Users/onetom/rebol/freefont-20100919/FreeSans.ttf" size: 12 ] view layout [ box 200x160 effect [draw [ font fnt1 text 10x20 "Test" ]] ] EOF rebview font.r Doesn't draw anything, just a gray rectangle. But I know it for several years. Now I'm in a situation where I would have the chance of using Rebol finally as a primary tool for my work, but I can't, because of this long standing issue. (Library support doesn't seem to work either, otherwise I would have hacked freetype in somehow. We have even written a BDF bitmap font renderer with my friend; it's on rebol.org. We started an iPhone Simulator-like thing too. I will open source it soon. It also stalled because of this font issue. My heart is bleeding... Rebol is almost the perfect solution to so many things. I wouldn't mind the ugly and limited VID dialect, the lack of UTF-8, the unusable path syntax for the body-of an-object, etc etc) Let's gather and do somethings about it! u can reach me at hermantamas at gmail
Did you try this? Code: fnt1: make face/font [ name: "/Users/onetom/rebol/freefont-20100919/FreeSans.ttf" size: 12 ] view layout [ box 200x160 effect [ draw [ font fnt1 pen black text "test" line 0x0 200x160 ]]] Does the line appear?
Good. On Linux, if font path is wrong, all items after text don't appear. This means that you can do whatever you want, but if you are on MacOS, text must be positioned in another way. see this: Code: a: layout [at 0x0 text "Hello!"] a/offset: 0x0 view layout [b: box 100x100 effect [draw [ line 0x0 100x100]] button "click me" [b/pane: a show b] ] ...Ok, it's not very nice, but it works. The other solution is: making a script that convert text in path: Input: Code: view layout [box 300x300 effect [draw [ line 0x0 100x100 pen red text 20x20 "HELLO" ]]] Output Code: view layout [ box 300x300 effect [ draw [ line 0x0 100x100 pen red shape [move 20x20 'vline 10 'move 0x-5 'hline 5 'move 0x5 'vline -10 'move 0x10 'move 5x0 'vline -10 'hline 5 'move 0x5 'hline -5 'move 0x5 'hline 5 'move 5x-10 'vline 10 'hline 5 'move 5x-10 'vline 10 'hline 5 'move 5x0 'hline 5 'vline -10 'hline -5 'vline 10 ]]]] Now you have H, E , L and O done!