r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Linux] group for linux REBOL users

Andreas
2-Mar-2011
[4028]
If the Unity launcher (at least I think that's how the launchbar 
in the netbook thing is called) still uses .desktop files, it's probably 
only a matter of finding the associated .desktop file and modifying 
it to use Terminal=true
BrianH
2-Mar-2011
[4029]
Or rather making associated desktop files. It turns out that the 
menu editor included is for the GNOME menu, not the Unity menu. There 
is no editor for the Unity menu. I'm going to try to figure out what 
needs to be done.
MaxV
8-Mar-2011
[4030]
Did you try http://www.maxvessi.net/rebsite/Linux/??
ddharing
8-Mar-2011
[4031]
Does anyone do anonymous pipes with REBOL? I've found that when doing 
an "insert system/ports/output my-data", that it won't actuallly 
send "my-data" until you halt or quit. Is there a way to force it 
to send so the script can continue to do other things and send more 
data later?
MaxV
8-Mar-2011
[4032]
call
 function is not eough?
call "cp source.txt dest.txt"
Gregg
8-Mar-2011
[4033]
Have you tried UPDATE? Not sure on anonymous pipes though.
ddharing
8-Mar-2011
[4034x2]
Gregg, I tried that and it generates an error -- Cannot use updae 
on this type port
MaxV, It is possible to use call, but then the scripit would be executing 
like CGI. I wanted to pipe two REBOL scripts from the command line 
and have the first script periodically send data to the second. Of 
course I could use a socket, but that's a little more complex.
Maxim
8-Mar-2011
[4036x2]
actually, using sockets is really simple.
I mean, its probably less hassle and you'd already have it working 
by now  ;-) 


I mean TCP server/clients can be as little as 5 lines each in rebol.
ddharing
8-Mar-2011
[4038x2]
Maxim, you're absolutely right. I am just thinking in terms of being 
pipe friendly on the Linux command line.
You know, the Unix way of doing things.
Maxim
8-Mar-2011
[4040x2]
did you try looking at the port states?
don't know what can be manipulated on the i/o ports
ddharing
8-Mar-2011
[4042]
I'm not an expert on the port object, so I'm continuing to do research.
Geocaching
8-Mar-2011
[4043x3]
Hello, I encounter a problem with the draw dialect under linux (rebol/view 
2.7.8). I have tried the following code from the official documentation: 
view layout [
    box black 100x100 effect [
        draw [
            pen red
            line 30x30 50x20 70x70 40x50

            pen blue
            box 20x20 80x80

            fill-pen 0.100.0
            box 20x60 40x80

            pen white
            text 8x25 "Example"

            fill-pen gold
            flood 2x2
        ]
    ]
]
Under windows, the text appears properly; but under linux, nothing 
appears.
Actally, it seems that the interpretation of the draw dialect stops 
when encountering the 'text.
Pekr
8-Mar-2011
[4046]
might be a font problem? Better wait for some real experts, though 
...
Geocaching
8-Mar-2011
[4047]
When you try this under linux
view layout [
    box snow 100x100 effect [
        draw [
            pen black
            text 10x10 "Red Box:"
            pen red
            fill-pen red
            box 10x30 80x50
        ]
    ]
]


Only the snow box appears! Nothing is drawn into it... and rebol 
does not launch an error.

THis confirms that the interpretation of the dialect is stopped when 
the 'text is reached.

Under windows, no problem!
Cyphre
8-Mar-2011
[4048]
Under linux you need to setup the font object to be able use text 
rendered by DRAW dialect. So something like this should work:

my-font: make face/font [

 name: "/usr/share/fonts/truetype/freefont/FreeSans.ttf"   ;replace 
 with your path to font you want to use
	size: 12
]

view layout [
    box snow 100x100 effect [
        draw [
	font my-font
            pen black
            text 10x10 "Red Box:"
            pen red
            fill-pen red
            box 10x30 80x50
        ]
    ]
]
Geocaching
8-Mar-2011
[4049]
Cyphre... THANKS SO MUCH!! It works...


But now, how I can make my script working on both linux and windows 
with the same fonts look and feel?
Cyphre
8-Mar-2011
[4050]
you can put the os specific setup into something like:

switch system/version/4 [
	4 [ ;Linux

	]
	3 [ ;Windows

	]
]
MaxV
9-Mar-2011
[4051]
What is the default Font for Rebol? I could add this font package 
in Rebol linux installer.
Oldes
9-Mar-2011
[4052]
Better to choose a font which works on Linux... last time I used 
Rebol/View on linux, the default font look was very bad.
Cyphre
9-Mar-2011
[4053]
yes, I'd suggest to choose some nice looking font(prefferably free 
one, but depends on you) on Linux and then use it with the app on 
all systems.
MaxV
9-Mar-2011
[4054]
But newbies need a working rebol on Linux., then they will choose 
their font. So, what is the default font on Rebol?
Oldes
9-Mar-2011
[4055x2]
On windows I think it's arial
You can check it on linux using:
? system/view/vid/vid-styles/text/font
Cyphre
9-Mar-2011
[4057]
MaxV: the problem on Linux is that there is no easy way how to get 
font path just by giving the font name + font type.( Windows does 
that automatically)

If you know how to do it in Linux so it works on all distributions 
that would be helpful.

(Maybe it would be enough to write some parser in rebol to get the 
font information from some place in the system, but I have no time 
to investigate this as I'm not using Linux for desktop stuff.)
MaxV
9-Mar-2011
[4058x2]
? system/view/vid/vid-styles/text/font
helvetica
so, is it enogh  having helvetica font?
No, I made a link to FreeSans.ttf this way:
ln -s FreeSans.ttf helvetica.ttf
but it doesn't work.
I think that the path is wrong. The standard linux path  now is:
/usr/share/fonts/truetype/freefont/

so if Rebol path would be /usr/share/fonts/truetype/freefont/FreeSans.ttf 
, we have resolved all problems!
Is there a way to know Rebol font path?
Maxim
9-Mar-2011
[4060]
rebol uses system fonts, so its the other way round, is there a way 
to know system font path.  on linux  no one has done any in-depth 
assessment if there is a single way to find out what are the installed 
fonts for *any* linux.
Tomc
10-Mar-2011
[4061]
I tend to use thing like  
stderr: open/direct/binary %/dev/stderr
but am no longer petending to care about windows portability
MaxV
10-Mar-2011
[4062]
My other question is: why Rebol find the fonts path for all dialects 
 except DRAW?
BrianH
10-Mar-2011
[4063x2]
R2 uses different methods to do regular graphics and Draw. Draw is 
done only with AGG, the rest of View is not. The font code is different.
For R3, all graphics are done with AGG. Don't know yet about the 
font support on Linux.
MaxV
10-Mar-2011
[4065]
May you explain me why this works under Linux and no font PATH is 
requested? 
REBOL [
	title: "SW-like scroller by Cyphre"
	author: [cyphre-:-seznam-:-cz]
]

scr-size: 640x220
scrl: scr-size * 0x1
c1: scrl
c2: as-pair scr-size/x / 2.5 scr-size/y / 5
c3: as-pair scr-size/x - (scr-size/x / 2.5) c2/y

view/new layout [
	origin 0

 bx: box scr-size effect [draw [] gradcol 0x-1 sky black] with [feel: 
 none]
]

while [not empty? system/view/screen-face/pane][
	scrl/2: scrl/2 - 1

 img: to-image t-face: make face [edge: none color: black size: scr-size 
 text: system/license font: make font [size: 20 style: 'bold color: 
 white] para: make para [scroll: scrl]]
	if scrl/y < - second size-text t-face [
		scrl/y: c1/y
	]
	bx/effect/draw: [
		pen black
		fill-pen black
		box 0x0 scr-size
		image img c2 c3 scr-size c1
	]
	show bx
	wait 0
]

???????
Cyphre
10-Mar-2011
[4066x2]
To clarify the 'font issue' a bit:

In REBOL2 there are two different 'font engines':
engine1:  is used when you set face/text field
engine2:  is used when you use face/effect: [draw [text "..."]]


On Windows both engines use the same OS functions for the font handling. 
Therefore no differencies are seen at the script level. 


On Linux the Engine1 us using some X-windows api and the Engine2 
is using FreeType2 library. 

The X-windows font api doesn't support antialiasing and the font 
output in general is not so nice (depending on the distro).

The FreeType2 lib has better font quality output and also supports 
antialiasing but you have to know the full-path to the font file.


Currently noone suggested any efficient method how to get the 'font 
path' in unified way (considering the 'mess' between different Linux 
distros). 

When I tried to investigate a bit someone pointed me to the FontConfig 
lib that should take care of this problem on Linux. But:

1. I don'r know if the fontconfig is really widely supported and 
what other 'framewrorks' are possible on the rest of distros that 
don't have fontconfig...

2. I don't know how easy/hard is to get the info from fontconfig, 
havent studied it

3. as I said I'm not using Linux for desktop stuff so it is nto my 
high-priority item.


Another solution is to intorduce something like global font-path 
in the Rebol system object which would be used for the font lookup. 
This variable could be set individually by user or author of the 
rebol program. We could also provide some font-name/type->font-file 
matching table but that would take some research as well and won't 
work for all setups. But at least something.


So If anyone here from the 'Linux power users' group knows a good 
solution or even propose a prototype of the solution I believe Carl 
will be glad for your help.
MaxV: regarding the example question above: the answer is easy: in 
this example the font is rendered using the 'Engine1' (see the msg 
above) then the output is cvonverted to bitmap(image) and the image 
is rendered as texture using perspective  transformation. So in the 
end the 'Engine2' is not used in the example in any way.
MaxV
10-Mar-2011
[4068x2]
I noticed a difference between Linux and Windows:
Widndows: ?  system/view/vid/vid-styles/text/font    == "arial"

Linux: ?  system/view/vid/vid-styles/text/font    == "helvetica" 
 
Is it normal?
However Mandriva, Suse/Novell, Fedora/RedHat, Ubuntu use the followings:
/usr/X11R6/lib/X11/fonts/truetype/feefont
/usr/share/fonts/truetype/freefont
I think it could be fixed.
Cyphre
10-Mar-2011
[4070]
font differences: ofcourse Arial doesn't exist on Linux...unless 
you install MS fonts. See my note about  'matching table'...such 
stuff is definitely needed.
MaxV
10-Mar-2011
[4071x3]
Or an alert message "/usr/share/fonts/... not found!"
Even helvetica doesn't exist!
Copyright Adobe 1994-1997
Cyphre
10-Mar-2011
[4074]
MaxV: It's all about writin a proposal 'how to solve the font issues 
on Linux' then it can be discussed in some more serious way and in 
the end it can be implemented in future releases of R2. So there 
is nothing that blocks you to do the research and propose a solution.
MaxV
10-Mar-2011
[4075]
OK
Cyphre
10-Mar-2011
[4076]
But as I see from your wondering about different font names etc. 
I feel you are realizing this won't be an easy task ;) Anyway, if 
you want to be helpful, just go for it!
Andreas
10-Mar-2011
[4077]
http://behdad.org/text/may provide some interesting background reading