------art_19192_2420855.1221119711311
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hello

I think this is the time to show what RubyX11 can do.

You need the X11 directory from the RubyX11-0.6.pre1, ruby 1.8, and an X server.

The program is not as simple as with Shoes but it requires no binary
extension - you could run it in JRuby as well.

Unfortunately RubyX11 is not complete, and likely will never be. As I
understand it people went from server-side font rendering to
client-side font rendering for X11 applications. This means that you
cannot do the font rendering effectively to a remote display, the
letters rendered by different applications suck in different ways, and
you cannot write a simple client library for X that would also render
text reasonably.

OK, enough complaints about lack of design in X protocols.

You can find the program attached. If you run it without parameters it
asks for them interactively in the terminal.

It is sort of a cheat - the X11 interfacing is merged form two RubyX11
examples, I only had to write the method that calculates the points of
the graph and fix window resizing.

Thanks

Michal

------art_19192_2420855.1221119711311
Content-Type: application/x-ruby; name=q176.rb
Content-Transfer-Encoding: base64
X-Attachment-Id: f_fkz30ggw
Content-Disposition: attachment; filename=q176.rb

IyEvdXNyL2Jpbi9lbnYgcnVieQojCiMJQ29weXJpZ2h0IChjKSAyMDAwIGJ5IE1hdGhpZXUgQm91
Y2hhcmQKIwlSZWxlYXNlZCB1bmRlciB0aGUgTEdQTAojCiMgICAgICAgVXBkYXRlZCB0byBwbG90
IGZ1bmN0aW9ucyAoYykgMjAwOCBieSBNaWNoYWwgU3VjaGFuZWsKCiRzaG93X2xpbmVzID0gdHJ1
ZQokc2hvd19kb3RzID0gdHJ1ZQoKaW5jbHVkZSBNYXRoCmV4dGVuZCBNYXRoCgpkZWYgZ2V0bGlu
ZSBzdHIKICAgICAgICBTVERFUlIucHV0cyBzdHIKICAgICAgICByZXR1cm4gU1RESU4uZ2V0cwpl
bmQKCiRmbiA9IEFSR1ZbMF0KClNUREVSUi5wdXRzICJVc2FnZTogI3skMH0gW2Z1bmN0aW9uXSBb
eHJhbmdlXSBbeXJhbmdlXSIKU1RERVJSLnB1dHMgIkFsbCBwYXJlbWV0ZXJzIGFyZSBldmFsZWQg
Ynkg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R0aCA9PiAxLAojCTpsaW5lX3N0eWxlID0+IDpEb3VibGVE
YXNoLAogICAgICAgIDpjYXBfc3R5bGUgPT4gOlJvdW5kLAogICAgICAgIDpqb2luX3N0eWxlID0+
IDpSb3VuZCkKJGcyLmNyZWF0ZSgkdywkZ2NpbmZvKQokZyA9IFgxMTo6R3JhcGhpY3NPbkRyYXdh
YmxlWyR3LCRnMl0KCiRkLndhaXRfZm9yIHsKICAgICAgICAkY21hcC5hbGxvY19jb2xvcihYMTE6
OlJHQlsiI2ZmZiJdKSB7fGZvbywkY29sb3JfdmVydGV4fH0KICAgICAgICAkY21hcC5hbGxvY19j
b2xvcihYMTE6OlJHQlsiIzBhNCJdKSB7fGZvbywkY29sb3JfZWRnZXx9CiAgICAgICAgJGNtYXAu
YWxsb2NfY29sb3IoWDExOjpSR0JbIiMwMDAiXSkge3xmb28sJGNvbG9yX2JnfH0KfQoKZGVmIHdz
aXplCiAgICAgICAgJHcuZ2V0X2dlb21ldHJ5KCkucmVjdC5zaXplCmVuZAoKY2xhc3MgQXJyYXkK
ICAgICAgICBkZWYgc3BsaXQgYnk9bmlsCiAgICAgICAgICAgICAgICBwYXJ0cz1bXQogICAgICAg
ICAgICAgICAgY3Vycj1bXQogICAgICAgICAgICAgICAgc2VsZi5lYWNoe3xlfAogICAgICAgICAg
ICAgICAgICAgICAgICBpZiBlID09PSBieSB0aGVuCiAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgcGFydHMgPDwgY3VyciBpZiBjdXJyLmxlbmd0aCA+IDAKICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICBjdXJyID0gW10KICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1cnIgPDwgZQogICAgICAgICAgICAgICAgICAg
ICAgICBlbmQKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHBhcnRzIDw8IGN1cnIg
aWYgY3Vyci5sZW5ndGggPiAwC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ID0gdHJhbnNmb3JtIGlmIHJlc2l6ZWQKICAgICAg
ICAkdy5jbGVhcl9hcmVhKFgxMTo6UmVjdFtYMTE6OlBvaW50WzAsMF0sd3NpemVdKSBpZiByZXNp
emVkCiAgICAgICAgcGxvdF9wYXJ0cygkY29sb3JfdmVydGV4LCRjb2xvcl9lZGdlLHApIGlmIHJl
cGFpbnQgb3IgcmVzaXplZAoKICAgICAgICAkZC5mbHVzaAogICAgICAgICMgbm90ZTogZG9uJ3Qg
dXNlIGRlbGF5ID09IDAgaW4gSU8uc2VsZWN0CiAgICAgICAgJGQueHJlY2VpdmVfbWFueSBpZiBJ
Ty5zZWxlY3QgWyRkLnNvY2tdLFtdLFtdLDAuMQplbmQKCg------art_19192_2420855.1221119711311--