diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index eed828ef9cc400963b9aff98125490db36832084..7c652dbf51f1a56e1a09556fbbcc55f0ce3bd2e7 100644 --- a/pd/nw/pdgui.js +++ b/pd/nw/pdgui.js @@ -2096,8 +2096,7 @@ function gui_canvas_updateline(cid,tag,x1,y1,x2,y2,yoff) { configure_item(cord, { d: d_array.join(" ") }); } -function gui_text_new(canvasname, myname, type, isselected, left_margin, top_margin, - bottom_margin, pix_high, text, font) { +function gui_text_new(canvasname, myname, type, isselected, x, y, text, font) { // gui_post("font is " + font); var g = get_gobj(canvasname, myname); @@ -2106,8 +2105,8 @@ function gui_text_new(canvasname, myname, type, isselected, left_margin, top_mar // at the top-right corner of the text's bbox. SVG uses the baseline. // There's probably a programmatic way to do this, but for now-- fudge factors // based on the DejaVu Sans Mono font. :) - x: left_margin, - y: pix_high - bottom_margin - top_margin - 1, + x: x, + y: y, // Turns out we can't do 'hanging' baseline // because it's borked when scaled. Bummer... // 'dominant-baseline': 'hanging', diff --git a/pd/src/g_rtext.c b/pd/src/g_rtext.c index 4d95967709487257a584589d903dbd992ec18536..66cf49ca509816233cd6e006d20fc42a3bf3bc41 100644 --- a/pd/src/g_rtext.c +++ b/pd/src/g_rtext.c @@ -362,13 +362,14 @@ static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp, // dispx + LMARGIN, dispy + TMARGIN, // outchars_b, tempbuf, sys_hostfontsize(font), // (glist_isselected(x->x_glist, ((t_gobj*)x->x_text)) ? "$pd_colors(selection)" : "$pd_colors(text)")); - gui_vmess("gui_text_new", "sssiiiiisi", + gui_vmess("gui_text_new", "sssiiisi", canvas_tag(canvas), x->x_tag, rtext_gettype(x)->s_name, glist_isselected(x->x_glist, ((t_gobj*)x->x_text)), LMARGIN, - TMARGIN, - BMARGIN, - pixhigh, + pixhigh - BMARGIN - TMARGIN - 1, +// TMARGIN, +// BMARGIN, +// pixhigh, // dispx + LMARGIN, // dispy + TMARGIN, tempbuf, diff --git a/pd/src/g_text.c b/pd/src/g_text.c index 609ac682f58b75b600d636ec3bc8ef98855c4f3b..854a1ce7570022d8182c1b907019f885ee383505 100644 --- a/pd/src/g_text.c +++ b/pd/src/g_text.c @@ -1159,33 +1159,6 @@ static void gatom_param(t_gatom *x, t_symbol *sel, int argc, t_atom *argv) } /* ---------------- gatom-specific widget functions --------------- */ -static void gatom_getwherelabel_delme(t_gatom *x, t_glist *glist, int *xp, int *yp) -{ - int x1, y1, x2, y2; - text_getrect(&x->a_text.te_g, glist, &x1, &y1, &x2, &y2); - if (x->a_wherelabel == ATOM_LABELLEFT) - { - *xp = x1 - 3 - - strlen(canvas_realizedollar(x->a_glist, x->a_label)->s_name) * - sys_fontwidth(glist_getfont(glist)); - *yp = y1 + 2; - } - else if (x->a_wherelabel == ATOM_LABELRIGHT) - { - *xp = x2 + 2; - *yp = y1 + 2; - } - else if (x->a_wherelabel == ATOM_LABELUP) - { - *xp = x1 - 1; - *yp = y1 - 1 - sys_fontheight(glist_getfont(glist));; - } - else - { - *xp = x1 - 1; - *yp = y2 + 3; - } -} static void gatom_getwherelabel(t_gatom *x, t_glist *glist, int *xp, int *yp) { @@ -1193,25 +1166,25 @@ static void gatom_getwherelabel(t_gatom *x, t_glist *glist, int *xp, int *yp) text_getrect(&x->a_text.te_g, glist, &x1, &y1, &x2, &y2); if (x->a_wherelabel == ATOM_LABELLEFT) { - *xp = 3 - + *xp = -3 - strlen(canvas_realizedollar(x->a_glist, x->a_label)->s_name) * sys_fontwidth(glist_getfont(glist)); - *yp = 2 + sys_fontheight(glist_getfont(glist)); + *yp = y2 - y1 - 4; } else if (x->a_wherelabel == ATOM_LABELRIGHT) { - *xp = x2 - x1 + 2; - *yp = y2 - y1 + 2; + *xp = x2 - x1 + 3; + *yp = y2 - y1 - 4; } else if (x->a_wherelabel == ATOM_LABELUP) { *xp = -1; - *yp = -1; + *yp = -3; } else { *xp = -1; - *yp = y2 - y1 + 3; + *yp = y2 - y1 + sys_fontheight(glist_getfont(glist)); } } @@ -1248,15 +1221,13 @@ static void gatom_vis(t_gobj *z, t_glist *glist, int vis) // canvas_realizedollar(x->a_glist, x->a_label)->s_name, // sys_hostfontsize(glist_getfont(glist)), // "$pd_colors(text)"); - gui_vmess("gui_text_new", "sssiiiiisi", + gui_vmess("gui_text_new", "sssiiisi", canvas_tag(glist_getcanvas(glist)), rtext_gettag(y), "gatom", 0, x1, // left margin y1, // top margin - 0, // bottom margin - sys_fontwidth(glist_getfont(glist)), canvas_realizedollar(x->a_glist, x->a_label)->s_name, sys_hostfontsize(glist_getfont(glist)) );