[PD-dev] glist font vs. default font - how to measure?

federico mescalinum at gmail.com
Mon Sep 3 00:14:08 CEST 2007


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 at 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
>




More information about the Pd-dev mailing list