Commit 14243906 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

Make the iemgui font-selection dropdown functional

parent e751223b
......@@ -233,9 +233,9 @@
</td>
<td data-i18n="[title]iem.prop.font_tt">
<select name="font-style">
<option>Font Number 0</option>
<option>Font #1</option>
<option>Font 2</option>
<option>DejaVu Sans Mono</option>
<option>Helvetica</option>
<option>Times</option>
</select>
</td>
<td colspan="4">
......@@ -435,8 +435,9 @@ function apply() {
slot7 = 0;
}
var font_style = document.getElementsByName('font-style')[0].value;
if (font_style !== null) { font_style = 0; }
var font_style = document.getElementsByName('font-style')[0].
selectedIndex;
// if (font_style !== null) { font_style = 0; }
var font_size = document.getElementsByName('font-size')[0].value;
if (font_size === '') { font_size = 0; }
......@@ -545,6 +546,8 @@ function populate_form(attr_array) {
// The attr here is a string, so we need to
// force it to number, hence the "+" below
elem[0].checked = +attr_array[i+1];
} else if (elem[0].type === 'select-one') {
elem[0].selectedIndex = +attr_array[i+1];
} else {
elem[0].value = attr_array[i+1];
}
......
......@@ -2767,7 +2767,7 @@ function iemgui_font_height(name, size) {
}
function iemgui_fontfamily(name) {
var family;
var family = "DejaVu Sans Mono";
if (name === "DejaVu Sans Mono") {
family = "DejaVu Sans Mono"; // probably should add some fallbacks here
}
......@@ -2777,6 +2777,7 @@ function iemgui_fontfamily(name) {
else if (name === "times") {
family = "'Times New Roman', 'DejaVu Serif', 'FreeSerif', serif";
}
return family;
}
function gui_iemgui_label_new(cid, tag, x, y, color, text, fontname, fontweight,
......@@ -2842,13 +2843,15 @@ function gui_iemgui_label_select(cid, tag, is_selected) {
}
}
function gui_iemgui_label_font(cid, tag, font) {
function gui_iemgui_label_font(cid, tag, fontname, fontweight, fontsize) {
gui_post("googoo: fontsize is " + fontsize);
var svg_text = get_item(cid, tag + 'label');
// This has to wait until we remove the tcl formatting
// that Pd uses for font name/size
// configure_item(svg_text, {
// font: font
// });
configure_item(svg_text, {
'font-family': iemgui_fontfamily(fontname),
'font-weight': fontweight,
'font-size': fontsize + 'px',
transform: 'translate(0,' + iemgui_font_height(fontname, fontsize) / 2 + ')'
});
}
function gui_create_mycanvas(cid,tag,color,x1,y1,x2_vis,y2_vis,x2,y2) {
......
......@@ -270,10 +270,12 @@ void iemgui_label_font(t_iemgui *x, t_symbol *s, int ac, t_atom *av)
{
//sys_vgui(".x%lx.c itemconfigure %lxLABEL -font %s\n",
// glist_getcanvas(x->x_glist), x, iemgui_font(x));
gui_vmess("gui_iemgui_label_font", "xxs",
gui_vmess("gui_iemgui_label_font", "xxssi",
glist_getcanvas(x->x_glist),
x,
iemgui_font(x));
iemgui_typeface(x),
sys_fontweight,
x->x_fontsize);
iemgui_shouldvis(x, IEM_GUI_DRAW_MODE_CONFIG);
}
}
......@@ -1013,10 +1015,12 @@ void iemgui_label_draw_config(t_iemgui *x) {
// "-fill $pd_colors(selection) -text {%s} \n",
// canvas, x, iemgui_font(x),
// x->x_lab!=s_empty?x->x_lab->s_name:"");
gui_vmess("gui_iemgui_label_font", "xxs",
gui_vmess("gui_iemgui_label_font", "xxssi",
glist_getcanvas(x->x_glist),
x,
iemgui_font(x));
iemgui_typeface(x),
sys_fontweight,
x->x_fontsize);
gui_vmess("gui_iemgui_label_set", "xxs",
glist_getcanvas(x->x_glist),
x,
......@@ -1033,10 +1037,12 @@ void iemgui_label_draw_config(t_iemgui *x) {
// "-fill #%6.6x -text {%s} \n",
// canvas, x, iemgui_font(x),
// x->x_lcol, x->x_lab!=s_empty?x->x_lab->s_name:"");
gui_vmess("gui_iemgui_label_font", "xxs",
gui_vmess("gui_iemgui_label_font", "xxssi",
glist_getcanvas(x->x_glist),
x,
iemgui_font(x));
iemgui_typeface(x),
sys_fontweight,
x->x_fontsize);
gui_vmess("gui_iemgui_label_set", "xxs",
glist_getcanvas(x->x_glist),
x,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment