hi all, I re-subscribed today to this list, and now I'm learning the gui part of pd externals.
I've almost finished my first gui external, just I don't know how to specify the current(canvas) font with the Tk's -font option (since Tk wants a string, while pd uses integers).
actually I'm doing that (in CLASSNAME_new()):
int font = glist_getfont(x->x_glist); int width = sys_fontwidth(font); int height = sys_fontheight(font);
but it seems (at least the width - perhaps it's a coincidence) that metrics are wrong.
right now I do not pass *ANY* option to [.x%c.c create text ...]. which font is that one in glist measured by sys_font*() ?
I've checked out other externals, but I see every one picks an arbitrary font and arbitrary sizes :S
I hope there's a better way...
best regards, Federico
I reply to myself. it seems that using:
-font -*-courier-bold--normal--%d-*
with %d = glist_getfont(glist)
gives a coherent measure.
anyone can confirm that?
On 9/2/07, federico mescalinum@gmail.com wrote:
hi all, I re-subscribed today to this list, and now I'm learning the gui part of pd externals.
I've almost finished my first gui external, just I don't know how to specify the current(canvas) font with the Tk's -font option (since Tk wants a string, while pd uses integers).
actually I'm doing that (in CLASSNAME_new()):
int font = glist_getfont(x->x_glist); int width = sys_fontwidth(font); int height = sys_fontheight(font);
but it seems (at least the width - perhaps it's a coincidence) that metrics are wrong.
right now I do not pass *ANY* option to [.x%c.c create text ...]. which font is that one in glist measured by sys_font*() ?
I've checked out other externals, but I see every one picks an arbitrary font and arbitrary sizes :S
I hope there's a better way...
best regards, Federico
Actually, I think the preferred way of specifying the font would be to use Tk font specs rather than X11 font specs. They are easier anyway. I replaced all the X11 font specs in Pd-extended using Tk font specs.
They are like this:
"font size style", i.e.: courier 12 bold monaco 24 bold helvetica 12 (blank style means normal)
.hc
On Sep 2, 2007, at 6:14 PM, federico wrote:
I reply to myself. it seems that using:
-font -*-courier-bold--normal--%d-*
with %d = glist_getfont(glist)
gives a coherent measure.
anyone can confirm that?
On 9/2/07, federico mescalinum@gmail.com wrote:
hi all, I re-subscribed today to this list, and now I'm learning the gui part of pd externals.
I've almost finished my first gui external, just I don't know how to specify the current(canvas) font with the Tk's -font option (since Tk wants a string, while pd uses integers).
actually I'm doing that (in CLASSNAME_new()):
int font = glist_getfont(x->x_glist); int width = sys_fontwidth(font); int height = sys_fontheight(font);
but it seems (at least the width - perhaps it's a coincidence) that metrics are wrong.
right now I do not pass *ANY* option to [.x%c.c create text ...]. which font is that one in glist measured by sys_font*() ?
I've checked out other externals, but I see every one picks an arbitrary font and arbitrary sizes :S
I hope there's a better way...
best regards, Federico
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
------------------------------------------------------------------------ ----
All mankind is of one author, and is one volume; when one man dies, one chapter is not torn out of the book, but translated into a better language; and every chapter must be so translated.... -John Donne
On Tue, 4 Sep 2007, Hans-Christoph Steiner wrote:
Actually, I think the preferred way of specifying the font would be to use Tk font specs rather than X11 font specs. They are easier anyway. I replaced all the X11 font specs in Pd-extended using Tk font specs.
They are like this:
"font size style", i.e.: courier 12 bold monaco 24 bold helvetica 12 (blank style means normal)
This is not the case with Tk 8.5. If you want to support all fonts that Tk 8.5 supports, you have to use X11 font specs, because Tk font specs are now reserved to TrueType fonts.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada