Forums > MaxMSP

Scripting font and font size


dhk
May 7, 2007 | 1:50 pm

Hello,

Is it possible to set (and change) font and font size of objects like comment and ubumenu using thispatcher or (preferably) js? Looking at text versions of patchers, it appears that there’s a many-digits number at the end of the comment description which determines the font settings. Is there a way to code and decode this number in a predictable way, so I can set any font and any size? Or an other, more straightforward way?

Dag Henning


May 7, 2007 | 3:24 pm

I tried out a couple things, seems to me that when you leave out:

#P window setfont "Sans Serif" 9.;

but do do paste this:

#P window linecount 1;
#P comment 40 100 100 196617 comment;
#P comment 150 100 100 196628 comment;
#P comment 260 100 100 196644 comment;
#P window clipboard copytext comment #E;
#P window clipboard copycount 1;

that font sizes do work.
the last two digits – 8 gives the font size.
scripting works:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 197 245 280 196617 script new donkey comment 260 200 200 196644 comment;
#N thispatcher;
#Q end;
#P newobj 197 268 61 196617 thispatcher;
#P connect 1 0 0 0;
#P window clipboard copycount 2;

I haven’t found out anything about font faces tho. They influence the magic number greatly, but I don’t know in what way.


May 7, 2007 | 5:52 pm

I think the magic numbers also refer to entire font sets, as going up one will increase the font size through a number of sizes, then switch to the next font in the list. As far as a map, that would take some time…

-CJ


May 8, 2007 | 9:09 am


Viewing 4 posts - 1 through 4 (of 4 total)