Discussion:
When saved as SVG, SB units are in points; could SVG unit kind be configurable by a script?
Dave Crossland
2009-01-20 15:40:08 UTC
Permalink
Hi,

After a chat with Ricardo I thought I could take a crack at using
ShoeBot to create some print design page layouts.

Here is a modified /usr/share/shoebot/examples/var/VarText.bot for
generating type specimens (previews) for printing;

-- 8< --
#var("tx",TEXT,"abcdefghijklmnopqrstuvwxyz")
#var("sz",NUMBER,100,10,200)

size(298,210);
colorrange(255)

def draw():
background(255)
fontFilename = "/usr/share/fonts/liberation/LiberationSans-Regular.ttf'"
font(fontFilename)

# fontsize(sz)
# text(tx,10,HEIGHT-((HEIGHT/5)*3))

fontsize(60)
text("adhesion",10,HEIGHT-60)

fontsize(18.7)
text("abcdefghijklmnopqrstuvwxyz",10,HEIGHT-30)

fontsize(9)
text("This is "+str(fontFilename),10,HEIGHT-10)
-- 8< --

However, when I run this and, if it runs okay, open it in Inkscape -

$ sbot typeSpecimenMaker.bot -o output.svg && inkscape output.svg

- then the size() is of course in points instead of pixels.

I tried to search the sourcecode, but can see no way to change PT to
MM. I guess because it is a Cairo default that needs to be overridden
somewhere.

Does anyone have any suggestions? :-)
--
Regards,
Dave
ricardo lafuente
2009-01-20 16:43:56 UTC
Permalink
Nodebox has a pretty neat way of solving the units issue:
http://nodebox.net/code/index.php/Reference_|_size()
just a few conversion constants to be multiplied to the point sizes;
i'll try to get this in shoebot today
Post by Dave Crossland
Hi,
After a chat with Ricardo I thought I could take a crack at using
ShoeBot to create some print design page layouts.
Here is a modified /usr/share/shoebot/examples/var/VarText.bot for
generating type specimens (previews) for printing;
-- 8< --
#var("tx",TEXT,"abcdefghijklmnopqrstuvwxyz")
#var("sz",NUMBER,100,10,200)
size(298,210);
colorrange(255)
background(255)
fontFilename = "/usr/share/fonts/liberation/LiberationSans-Regular.ttf'"
font(fontFilename)
# fontsize(sz)
# text(tx,10,HEIGHT-((HEIGHT/5)*3))
fontsize(60)
text("adhesion",10,HEIGHT-60)
fontsize(18.7)
text("abcdefghijklmnopqrstuvwxyz",10,HEIGHT-30)
fontsize(9)
text("This is "+str(fontFilename),10,HEIGHT-10)
-- 8< --
However, when I run this and, if it runs okay, open it in Inkscape -
$ sbot typeSpecimenMaker.bot -o output.svg && inkscape output.svg
- then the size() is of course in points instead of pixels.
I tried to search the sourcecode, but can see no way to change PT to
MM. I guess because it is a Cairo default that needs to be overridden
somewhere.
Does anyone have any suggestions? :-)
ricardo lafuente
2009-01-20 17:57:06 UTC
Permalink
turns out we had the unit thing, but our size() check in gtkui.py needed
some tweaking in order to support expressions in parameters, e.g.
size(3*cm, 3*cm),

stuff like size(random(0,100), random(0,100)) doesn't work yet because
of some string parsing intricacies in there, i'm on it now.

Francesco, i hope i didn't break anything there :)

i tested it a bit with the example scripts and it seems to be working...
Post by ricardo lafuente
http://nodebox.net/code/index.php/Reference_|_size()
just a few conversion constants to be multiplied to the point sizes;
i'll try to get this in shoebot today
Post by Dave Crossland
Hi,
After a chat with Ricardo I thought I could take a crack at using
ShoeBot to create some print design page layouts.
Here is a modified /usr/share/shoebot/examples/var/VarText.bot for
generating type specimens (previews) for printing;
-- 8< --
#var("tx",TEXT,"abcdefghijklmnopqrstuvwxyz")
#var("sz",NUMBER,100,10,200)
size(298,210);
colorrange(255)
background(255)
fontFilename =
"/usr/share/fonts/liberation/LiberationSans-Regular.ttf'"
font(fontFilename)
# fontsize(sz)
# text(tx,10,HEIGHT-((HEIGHT/5)*3))
fontsize(60)
text("adhesion",10,HEIGHT-60)
fontsize(18.7)
text("abcdefghijklmnopqrstuvwxyz",10,HEIGHT-30)
fontsize(9)
text("This is "+str(fontFilename),10,HEIGHT-10)
-- 8< --
However, when I run this and, if it runs okay, open it in Inkscape -
$ sbot typeSpecimenMaker.bot -o output.svg && inkscape output.svg
- then the size() is of course in points instead of pixels.
I tried to search the sourcecode, but can see no way to change PT to
MM. I guess because it is a Cairo default that needs to be overridden
somewhere.
Does anyone have any suggestions? :-)
_______________________________________________
Shoebot-devel mailing list
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
Dave Crossland
2009-01-20 18:08:31 UTC
Permalink
Post by ricardo lafuente
i tested it a bit with the example scripts and it seems to be working...
Great!

Did you pull the http://freehg.org/u/hva/ variants yet?

I'm using http://freehg.org/u/hva/shoebot-i18/ for this text stuff,
the Pango support is a priority for the new release I think :-)
Dave Crossland
2009-01-20 18:08:53 UTC
Permalink
Post by Dave Crossland
Did you pull the http://freehg.org/u/hva/ variants yet?
(and others, not just to single out HVA :-)
architetto francesco fantoni <hva - hermanitos verdes architetti>
2009-01-20 18:10:35 UTC
Permalink
yes, it definitely needed some hacking there: my size parsing code was
rather crappy... I knew it.
Post by ricardo lafuente
turns out we had the unit thing, but our size() check in gtkui.py needed
some tweaking in order to support expressions in parameters, e.g.
size(3*cm, 3*cm),
stuff like size(random(0,100), random(0,100)) doesn't work yet because
of some string parsing intricacies in there, i'm on it now.
Francesco, i hope i didn't break anything there :)
i tested it a bit with the example scripts and it seems to be working...
Post by ricardo lafuente
http://nodebox.net/code/index.php/Reference_|_size()
just a few conversion constants to be multiplied to the point sizes;
i'll try to get this in shoebot today
Post by Dave Crossland
Hi,
After a chat with Ricardo I thought I could take a crack at using
ShoeBot to create some print design page layouts.
Here is a modified /usr/share/shoebot/examples/var/VarText.bot for
generating type specimens (previews) for printing;
-- 8< --
#var("tx",TEXT,"abcdefghijklmnopqrstuvwxyz")
#var("sz",NUMBER,100,10,200)
size(298,210);
colorrange(255)
background(255)
fontFilename =
"/usr/share/fonts/liberation/LiberationSans-Regular.ttf'"
font(fontFilename)
# fontsize(sz)
# text(tx,10,HEIGHT-((HEIGHT/5)*3))
fontsize(60)
text("adhesion",10,HEIGHT-60)
fontsize(18.7)
text("abcdefghijklmnopqrstuvwxyz",10,HEIGHT-30)
fontsize(9)
text("This is "+str(fontFilename),10,HEIGHT-10)
-- 8< --
However, when I run this and, if it runs okay, open it in Inkscape -
$ sbot typeSpecimenMaker.bot -o output.svg && inkscape output.svg
- then the size() is of course in points instead of pixels.
I tried to search the sourcecode, but can see no way to change PT to
MM. I guess because it is a Cairo default that needs to be overridden
somewhere.
Does anyone have any suggestions? :-)
_______________________________________________
Shoebot-devel mailing list
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
_______________________________________________
Shoebot-devel mailing list
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
ricardo lafuente
2009-01-20 19:12:20 UTC
Permalink
had to back out my other changeset since i messed up Francesco's size()
parser;

but i believe it works properly now, even with complicated expressions

just pushed changes to the dev tree
Post by architetto francesco fantoni <hva - hermanitos verdes architetti>
yes, it definitely needed some hacking there: my size parsing code was
rather crappy... I knew it.
Post by ricardo lafuente
turns out we had the unit thing, but our size() check in gtkui.py needed
some tweaking in order to support expressions in parameters, e.g.
size(3*cm, 3*cm),
stuff like size(random(0,100), random(0,100)) doesn't work yet because
of some string parsing intricacies in there, i'm on it now.
Francesco, i hope i didn't break anything there :)
i tested it a bit with the example scripts and it seems to be working...
Post by ricardo lafuente
http://nodebox.net/code/index.php/Reference_|_size()
just a few conversion constants to be multiplied to the point sizes;
i'll try to get this in shoebot today
Post by Dave Crossland
Hi,
After a chat with Ricardo I thought I could take a crack at using
ShoeBot to create some print design page layouts.
Here is a modified /usr/share/shoebot/examples/var/VarText.bot for
generating type specimens (previews) for printing;
-- 8< --
#var("tx",TEXT,"abcdefghijklmnopqrstuvwxyz")
#var("sz",NUMBER,100,10,200)
size(298,210);
colorrange(255)
background(255)
fontFilename =
"/usr/share/fonts/liberation/LiberationSans-Regular.ttf'"
font(fontFilename)
# fontsize(sz)
# text(tx,10,HEIGHT-((HEIGHT/5)*3))
fontsize(60)
text("adhesion",10,HEIGHT-60)
fontsize(18.7)
text("abcdefghijklmnopqrstuvwxyz",10,HEIGHT-30)
fontsize(9)
text("This is "+str(fontFilename),10,HEIGHT-10)
-- 8< --
However, when I run this and, if it runs okay, open it in Inkscape -
$ sbot typeSpecimenMaker.bot -o output.svg && inkscape output.svg
- then the size() is of course in points instead of pixels.
I tried to search the sourcecode, but can see no way to change PT to
MM. I guess because it is a Cairo default that needs to be overridden
somewhere.
Does anyone have any suggestions? :-)
_______________________________________________
Shoebot-devel mailing list
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
_______________________________________________
Shoebot-devel mailing list
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
_______________________________________________
Shoebot-devel mailing list
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
Dave Crossland
2009-01-20 19:32:12 UTC
Permalink
Post by ricardo lafuente
had to back out my other changeset since i messed up Francesco's size()
parser;
but i believe it works properly now, even with complicated expressions
just pushed changes to the dev tree
Great!

Btw, when Ricardo merges in other's freehg.org (etc) trees, I think we
should be careful to remove them :-)
architetto francesco fantoni <hva - hermanitos verdes architetti>
2009-01-20 22:45:18 UTC
Permalink
great! seems to work very well!
thanks for fixing it.
Post by ricardo lafuente
had to back out my other changeset since i messed up Francesco's size()
parser;
but i believe it works properly now, even with complicated expressions
just pushed changes to the dev tree
Post by architetto francesco fantoni <hva - hermanitos verdes architetti>
yes, it definitely needed some hacking there: my size parsing code was
rather crappy... I knew it.
Post by ricardo lafuente
turns out we had the unit thing, but our size() check in gtkui.py needed
some tweaking in order to support expressions in parameters, e.g.
size(3*cm, 3*cm),
stuff like size(random(0,100), random(0,100)) doesn't work yet because
of some string parsing intricacies in there, i'm on it now.
Francesco, i hope i didn't break anything there :)
i tested it a bit with the example scripts and it seems to be working...
Post by ricardo lafuente
http://nodebox.net/code/index.php/Reference_|_size()
just a few conversion constants to be multiplied to the point sizes;
i'll try to get this in shoebot today
Post by Dave Crossland
Hi,
After a chat with Ricardo I thought I could take a crack at using
ShoeBot to create some print design page layouts.
Here is a modified /usr/share/shoebot/examples/var/VarText.bot for
generating type specimens (previews) for printing;
-- 8< --
#var("tx",TEXT,"abcdefghijklmnopqrstuvwxyz")
#var("sz",NUMBER,100,10,200)
size(298,210);
colorrange(255)
background(255)
fontFilename =
"/usr/share/fonts/liberation/LiberationSans-Regular.ttf'"
font(fontFilename)
# fontsize(sz)
# text(tx,10,HEIGHT-((HEIGHT/5)*3))
fontsize(60)
text("adhesion",10,HEIGHT-60)
fontsize(18.7)
text("abcdefghijklmnopqrstuvwxyz",10,HEIGHT-30)
fontsize(9)
text("This is "+str(fontFilename),10,HEIGHT-10)
-- 8< --
However, when I run this and, if it runs okay, open it in Inkscape -
$ sbot typeSpecimenMaker.bot -o output.svg && inkscape output.svg
- then the size() is of course in points instead of pixels.
I tried to search the sourcecode, but can see no way to change PT to
MM. I guess because it is a Cairo default that needs to be overridden
somewhere.
Does anyone have any suggestions? :-)
_______________________________________________
Shoebot-devel mailing list
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
_______________________________________________
Shoebot-devel mailing list
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
_______________________________________________
Shoebot-devel mailing list
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
_______________________________________________
Shoebot-devel mailing list
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
Loading...