nodebox-gl weird textpath() on Win7 32bit+py2.6+pyglet1.1.4

23 views
Skip to first unread message

est

unread,
Nov 10, 2010, 11:44:20 PM11/10/10
to NodeBox for OpenGL
Hi guys,

I tried to port some libraries (graph and colors) for nodebox-gl, made
some basic patches to make them work, so I tested a simple code


from nodebox.graphics import *
import os, sys; sys.path.insert(0,
os.path.abspath(os.path.join(context.__file__, '../../libraries/')))
from nodebox.graphics.context import ximport
from random import uniform
graph = ximport("graph")
size(475, 400)
def draw(canvas):
g = graph.create(distance=0.5)
for service in ('FriendFeed', 'Twitter', 'Hacker News', 'Last.fm',
'Delicious', 'Google Reader', 'Flickr', 'Reddit'):
g.add_node(service, radius=5)
# connect services with FriendFeed
for service in ('Twitter', 'Last.fm', 'Delicious', 'Google
Reader', 'Flickr'):
g.add_edge(service, "FriendFeed", length=uniform(50,100))
g.styles.apply()
g.solve()
g.draw()
canvas.run(draw)

Here is the result.

http://i.imgur.com/xc7ET.png

Why the text rendering is so terrible?
Where should I start if I want to fix it?

Thanks in advance!

btw How to add more glyphs for other fonts?

(I re-posted this topic via Google Groups web UI because I suspect the
previous one I sent from my Gmail didn't work)

est

unread,
Nov 10, 2010, 4:42:41 AM11/10/10
to nodebox-f...@googlegroups.com
Hi guys,

I tried to port some libraries (graph and colors) for nodebox-gl, made
some basic patches to make them work, so I tested a simple code


from nodebox.graphics import *
import os, sys; sys.path.insert(0,
os.path.abspath(os.path.join(context.__file__, '../../libraries/')))
from nodebox.graphics.context import ximport
from random import uniform
graph = ximport("graph")
size(475, 400)
def draw(canvas):
g = graph.create(distance=0.5)
for service in ('FriendFeed', 'Twitter', 'Hacker News', 'Last.fm',
'Delicious', 'Google Reader', 'Flickr', 'Reddit'):
g.add_node(service, radius=5)
# connect services with FriendFeed
for service in ('Twitter', 'Last.fm', 'Delicious', 'Google
Reader', 'Flickr'):
g.add_edge(service, "FriendFeed", length=uniform(50,100))
g.styles.apply()
g.solve()
g.draw()
canvas.run(draw)

See attachment for result. Why the text rendering is so terrible?

2010-11-10_173155.png

Tom De Smedt

unread,
Nov 19, 2010, 12:40:47 PM11/19/10
to NodeBox for OpenGL
Graphs are part of NOGL since version 1.5, so you don't need an
external library anymore.
See: http://www.cityinabottle.org/nodebox/physics/#graph

- Is the text always rendered like this, or only when you draw graphs?
If so, try using the Graph class bundled in NOGL.
- Is the text rendered like this for any font? (could you try out some
default Windows font like Times New Roman or Arial)

Glyphs:
You only need to add glyph path info if you want to use textpath()
with a specific font (I believe the Graph library which you ported
uses textpath()). This can be done by adjusting and running the script
font/glyph.py in NodeBox for Mac OS X (http://nodebox.net). Useful
comments can be found in that script. Let me know if it works.
>  2010-11-10_173155.png
> 58KViewDownload
Reply all
Reply to author
Forward
0 new messages