diff --git a/Fonts/accid.txf b/Fonts/accid.txf new file mode 100644 index 000000000..e09cd24ff Binary files /dev/null and b/Fonts/accid.txf differ diff --git a/Fonts/monoMMM_5.txf b/Fonts/monoMMM_5.txf index 8b070dbd7..3ee39a79b 100644 Binary files a/Fonts/monoMMM_5.txf and b/Fonts/monoMMM_5.txf differ diff --git a/Nasal/multiplayer.nas b/Nasal/multiplayer.nas index d4b970ad5..b58e35cc9 100644 --- a/Nasal/multiplayer.nas +++ b/Nasal/multiplayer.nas @@ -157,23 +157,23 @@ var dialog = { me.toggle_unit(); # set to imperial # # "private" - var font = ""; - if (getprop("/sim/gui/current-syle")) - font = {name: "FIXED_8x13" }; - else - font = { name: "AvantGarde-Demi.txf"}; + me.font = { name: getprop("/sim/gui/selected-style/fonts/mp-list/name") or "FIXED_8x13", + size: getprop("/sim/gui/selected-style/fonts/mp-list/size") or 20, + slant: getprop("/sim/gui/selected-style/fonts/mp-list/slant") or 0, + }; - me.header = ["chat", " callsign"," code"," model", " brg", func dialog.dist_hdr, func dialog.alt_hdr ~ " ", "ignore" ~ " "]; + me.header = ["chat", " callsign"," code"," model", " brg", func dialog.dist_hdr, func dialog.alt_hdr ~ " ", "ver", "ignore" ~ " "]; me.columns = [ { type: "button", legend: "", halign: "right", callback: "multiplayer.compose_message", "pref-height": 14, "pref-width": 14 }, - { type: "text", property: "callsign", format: " %s", label: "-----------", halign: "fill" , font: font }, - { type: "text", property: "id-code", format: " %s", label: "-----", halign: "fill" , font: font }, - { type: "text", property: "model-short", format: "%s", label: "--------------", halign: "fill" , font: font }, - { type: "text", property: "bearing-to", format: " %3.0f", label: "----", halign: "right", font: font }, - { type: "text", property: func dialog.dist_node, format:" %8.2f", label: "---------", halign: "right", font: font }, - { type: "text", property: func dialog.alt_node, format:" %7.0f", label: "---------", halign: "right", font: font }, + { type: "text", property: "callsign", format: " %s", label: "-----------", halign: "fill" , font: me.font }, + { type: "text", property: "id-code", format: " %s", label: "-----", halign: "fill" , font: me.font }, + { type: "text", property: "model-short", format: " %s", label: "--------------", halign: "fill" , font: me.font }, + { type: "text", property: "bearing-to", format: " %3.0f", label: "----", halign: "right", font: me.font }, + { type: "text", property: func dialog.dist_node, format:" %8.2f", label: "---------", halign: "right", font: me.font }, + { type: "text", property: func dialog.alt_node, format:" %7.0f", label: "---------", halign: "right", font: me.font }, + { type: "text", property: "sim/multiplay/protocol-version", format: " %s", label: "--", halign: "fill" , font: me.font }, { type: "checkbox", property: "controls/invisible", callback: "multiplayer.dialog.toggle_ignore", - argprop: "callsign", label: "---------", halign: "right", font: font }, + argprop: "callsign", label: "---------", halign: "right", font: me.font }, ]; me.cs_warnings = {}; me.name = "who-is-online"; @@ -193,6 +193,7 @@ var dialog = { me.dialog = gui.dialog[me.name] = gui.Widget.new(); me.dialog.set("name", me.name); me.dialog.set("dialog-name", me.name); + me.dialog.set("font", me.font.name); if (me.x != nil) me.dialog.set("x", me.x); if (me.y != nil) @@ -233,6 +234,8 @@ var dialog = { var col = 0; foreach (var h; me.header) { var w = content.addChild("text"); +w.node.setValues({ "font" : me.font}); + var l = typeof(h) == "func" ? h() : h; w.node.setValues({ "label": l, "row": row, "col": col, halign: me.columns[col].halign }); w = content.addChild("hrule"); diff --git a/Nasal/screen.nas b/Nasal/screen.nas index 1fbdc3683..e11e53b75 100644 --- a/Nasal/screen.nas +++ b/Nasal/screen.nas @@ -30,8 +30,8 @@ var sanitize = func(s, newline = 0) { -var theme_font = nil; - +var theme_font = getprop("/sim/gui/selected-style/fonts/message-display/name") or "HELVETICA_14"; +var theme_fontsize = getprop("/sim/gui/selected-style/fonts/message-display/size") or 13; # screen.window @@ -133,10 +133,11 @@ var window = { me.dialog.set("y", me.y); me.dialog.set("layout", "vbox"); me.dialog.set("default-padding", 2); + if (me.font != nil) - me.dialog.setFont(me.font); + me.dialog.setFont(me.font, me.fontsize); elsif (theme_font != nil) - me.dialog.setFont(theme_font); + me.dialog.setFont(theme_font, theme_fontsize); me.dialog.setColor(me.bg[0], me.bg[1], me.bg[2], me.bg[3]); @@ -209,7 +210,7 @@ var window = { # # var dpy = screen.display.new(20, 10); # x/y coordinate # dpy.setcolor(1, 0, 1); # magenta (default: white) -# dpy.setfont("SANS_12B"); # see $FG_ROOT/gui/styles/*.xml +# dpy.setfont("SANS_12B",12); # see $FG_ROOT/gui/styles/*.xml # # dpy.add("/position/latitude-deg", "/position/longitude-deg"); # dpy.add(props.globals.getNode("/orientation").getChildren()); @@ -244,7 +245,8 @@ var display = { m.x = x; m.y = y; m.tags = show_tags; - m.font = "HELVETICA_14"; + m.font = getprop("/sim/gui/selected-style/fonts/message-display/name") or "HELVETICA_14"; + m.fontsize = getprop("/sim/gui/selected-style/fonts/message-display/size") or 13; m.color = [1, 1, 1, 1]; m.tagformat = "%s"; m.format = "%.12g"; @@ -266,8 +268,9 @@ var display = { me.redraw(); me; }, - setfont : func(font) { + setfont : func(font, size=13) { me.font = font; + me.fontsize = size; me.redraw(); me; }, @@ -278,7 +281,7 @@ var display = { me.dialog.set("y", me.y); me.dialog.set("layout", "vbox"); me.dialog.set("default-padding", 2); - me.dialog.setFont(me.font); + me.dialog.setFont(me.font, me.fontsize); me.dialog.setColor(0, 0, 0, 0); foreach (var e; me.entries) { @@ -416,8 +419,7 @@ _setlistener("/sim/signals/nasal-dir-initialized", func { }); setlistener("/sim/gui/current-style", func { - var theme = getprop("/sim/gui/current-style"); - theme_font = getprop("/sim/gui/style[" ~ theme ~ "]/fonts/message-display/name"); + theme_font = getprop("/sim/gui/selected-style/fonts/message-display/name"); }, 1); log = window.new(nil, -30, 10, 10); diff --git a/Nasal/string.nas b/Nasal/string.nas index 8ac44dc51..61772419e 100644 --- a/Nasal/string.nas +++ b/Nasal/string.nas @@ -44,6 +44,18 @@ var trim = func(s, lr = 0, istrim = nil) { return r < l ? "" : substr(s, l, r - l + 1); } +## +# truncate at the first match +# +# string.truncateAt("file.xml", ".xml"); # "file.xml" -> "file" +# string.truncateAt("file.xml", ".txt"); # "file.xml" -> "file.xml" +# +var truncateAt = func(src, match){ + var pos = find(match,src); + if (pos>=0) + return substr(src,0,pos); + return src; +} ## # return string converted to lower case letters diff --git a/gui/dialogs/chat-menu.xml b/gui/dialogs/chat-menu.xml index a9d0a8554..00be7451b 100644 --- a/gui/dialogs/chat-menu.xml +++ b/gui/dialogs/chat-menu.xml @@ -7,10 +7,10 @@ vbox false 1 - - HELVETICA_12 - - + + sim/gui/selected-style/fonts/gui-small + + 0 0 0 diff --git a/gui/dialogs/chat.xml b/gui/dialogs/chat.xml index f6350b25b..adb24dd23 100644 --- a/gui/dialogs/chat.xml +++ b/gui/dialogs/chat.xml @@ -81,7 +81,7 @@ 1 - FIXED_9x15 + sim/gui/selected-style/fonts/gui-small diff --git a/gui/dialogs/doc-browser.xml b/gui/dialogs/doc-browser.xml index ffe3052e6..93a02ffe2 100644 --- a/gui/dialogs/doc-browser.xml +++ b/gui/dialogs/doc-browser.xml @@ -62,7 +62,7 @@ falsee false - FIXED_8x13 + sim/gui/selected-style/fonts/fixed /sim/gui/dialogs/doc-browser/edit diff --git a/gui/dialogs/fps.xml b/gui/dialogs/fps.xml index 738976044..1bd4c2ee3 100644 --- a/gui/dialogs/fps.xml +++ b/gui/dialogs/fps.xml @@ -7,8 +7,8 @@ hbox 2 - HELVETICA_12 - + sim/gui/selected-style/fonts/gui-small + 0 0 diff --git a/gui/dialogs/frame-latency.xml b/gui/dialogs/frame-latency.xml index c811c8c9d..e0830dfbf 100644 --- a/gui/dialogs/frame-latency.xml +++ b/gui/dialogs/frame-latency.xml @@ -7,8 +7,8 @@ hbox 0 - HELVETICA_12 - + sim/gui/selected-style/fonts/gui-small + 0 0 diff --git a/gui/dialogs/lso-view.xml b/gui/dialogs/lso-view.xml index 709dd9010..f8904ce38 100644 --- a/gui/dialogs/lso-view.xml +++ b/gui/dialogs/lso-view.xml @@ -62,8 +62,8 @@ 1 - HELVETICA_14 - + sim/gui/selected-style/fonts/gui-large + + + 0.9 + 0.6 + 0.0 + 1.0 + - - 1.0 - 1.0 - 1.0 - 1.0 - + + 0.9 + 0.6 + 0.0 + 1.0 + - - 1.0 - 0.7 - 0.0 - 0.7 - + + 0.41 + 0.4 + 0.42 + 1.0 + - - 1.0 - 0.7 - 0.0 - 1.0 - + + 1.0 + 0.7 + 0.0 + 0.7 + - - 1.0 - 0.7 - 0.0 - 1.0 - + + 1.0 + 0.7 + 0.0 + 1.0 + - - 0.9 - 0.6 - 0.0 - 1.0 - + + 1.0 + 0.7 + 0.0 + 0.7 + - - 0.9 - 0.6 - 0.0 - 1.0 - + + 0.9 + 0.6 + 0.0 + 1.0 + - + + 0.3 + 0.0 + 0.0 + 1.0 + - - 1.0 - 0.9 - 0.0 - + + 1.0 + 0.0 + 0.0 + 1.0 + - - 0.0 - 0.0 - 0.0 - - + + + + 1.0 + 1.0 + 1.0 + 1.0 + + + + 1.0 + 0.7 + 0.0 + 0.7 + + + + 1.0 + 0.7 + 0.0 + 1.0 + + + + 1.0 + 0.7 + 0.0 + 1.0 + + + + 0.9 + 0.6 + 0.0 + 1.0 + + + + 0.9 + 0.6 + 0.0 + 1.0 + + + + + + 1.0 + 0.9 + 0.0 + + + + 0.0 + 0.0 + 0.0 + + diff --git a/gui/styles/tortola.xml b/gui/styles/tortola.xml index f3ceb7bbe..19f35c9d5 100644 --- a/gui/styles/tortola.xml +++ b/gui/styles/tortola.xml @@ -1,7 +1,7 @@ - - Tortola + Tortola - - - AvantGarde-Demi.txf - + + + + accid.txf + 16 + 0 + - - HELVETICA_18 - + + AvantGarde-Demi.txf + 15 + 0 + + + AvantGarde-Demi.txf + 12 + + + AvantGarde-Demi.txf + 12 + - - Helvetica-BoldOblique.txf - - - + + AvantGarde-Demi.txf + 12 + - - - - 0.21 - 0.212 - 0.221 - 0.8 - + + AvantGarde-Demi.txf + 11 + + + accid.txf + 20 + 0 + + + accid.txf + 17 + 0 + - - 0.9 - 0.9 - 0.9 - 0.9 - + + monoMMM_5.txf + 6 + + + monoMMM_5.txf + 6 + - - 0.21 - 0.212 - 0.221 - 1.0 - + + accid.txf + 16 + 0 + - + + accid.txf + 16 + 0 + - - 0.0 - 0.0 - 0.0 - 1.0 - + - - 0.0 - 0.0 - 0.0 - 1.0 - + + + + 0.21 + 0.212 + 0.221 + 0.8 + - - 0.0 - 0.0 - 0.0 - 1.0 - + + 0.9 + 0.9 + 0.9 + 0.9 + - - 0.0 - 0.0 - 0.0 - 1.0 - + + 0.21 + 0.212 + 0.221 + 1.0 + - - 0.51 - 0.511 - 0.61 - 1.0 - + - - 0.31 - 0.312 - 0.321 - 0.8 - + + 0.0 + 0.0 + 0.0 + 1.0 + - - 0.31 - 0.312 - 0.321 - 0.8 - + + 0.0 + 0.0 + 0.0 + 1.0 + - - 0.31 - 0.312 - 0.321 - 0.8 - + + 0.0 + 0.0 + 0.0 + 1.0 + - - 0.31 - 0.312 - 0.321 - 0.8 - + + 0.0 + 0.0 + 0.0 + 1.0 + - - 0.31 - 0.312 - 0.321 - 0.8 - + + 0.51 + 0.511 + 0.61 + 1.0 + - - 0.31 - 0.312 - 0.321 - 0.8 - + + 0.31 + 0.312 + 0.321 + 0.8 + - - - 0.51 - 0.511 - 0.61 - 1.0 - + + 0.31 + 0.312 + 0.321 + 0.8 + - - 0.51 - 0.511 - 0.61 - 1.0 - + + 0.31 + 0.312 + 0.321 + 0.8 + - - 0.51 - 0.511 - 0.61 - 1.0 - + + 0.31 + 0.312 + 0.321 + 0.8 + - - 0.51 - 0.511 - 0.61 - 1.0 - + + 0.31 + 0.312 + 0.321 + 0.8 + - - 0.51 - 0.511 - 0.61 - 1.0 - + + 0.31 + 0.312 + 0.321 + 0.8 + - - 0.571 - 0.57 - 0.57 - 1.0 - + + + 0.51 + 0.511 + 0.61 + 1.0 + - - 0.571 - 0.57 - 0.57 - 1.0 - + + 0.51 + 0.511 + 0.61 + 1.0 + - - 0.371 - 0.37 - 0.37 - 1.0 - + + 0.51 + 0.511 + 0.61 + 1.0 + - - 0.31 - 0.312 - 0.321 - 1.0 - + + 0.51 + 0.511 + 0.61 + 1.0 + - - 0.31 - 0.312 - 0.321 - 1.0 - + + 0.51 + 0.511 + 0.61 + 1.0 + - - 0.31 - 0.312 - 0.321 - 1.0 - + + 0.571 + 0.57 + 0.57 + 1.0 + - - - 1.0 - 0.0 - 0.0 - 1.0 - + + 0.571 + 0.57 + 0.57 + 1.0 + - - 0.21 - 0.212 - 0.221 - 1.0 - + + 0.371 + 0.37 + 0.37 + 1.0 + - - 0.21 - 0.212 - 0.221 - 1.0 - + + 0.31 + 0.312 + 0.321 + 1.0 + - - - 0.23 - 0.232 - 0.231 - 1.0 - + + 0.31 + 0.312 + 0.321 + 1.0 + - - 0.21 - 0.212 - 0.221 - 1.0 - + + 0.31 + 0.312 + 0.321 + 1.0 + - - 0.21 - 0.212 - 0.221 - 1.0 - + + + 1.0 + 0.0 + 0.0 + 1.0 + - - 0.23 - 0.232 - 0.231 - 1.0 - + + 0.21 + 0.212 + 0.221 + 1.0 + - + + 0.21 + 0.212 + 0.221 + 1.0 + - - 1.0 - 0.9 - 0.0 - + + + 0.23 + 0.232 + 0.231 + 1.0 + - - 0.0 - 0.0 - 0.0 - - + + 0.21 + 0.212 + 0.221 + 1.0 + + + + 0.21 + 0.212 + 0.221 + 1.0 + + + + 0.23 + 0.232 + 0.231 + 1.0 + + + + + + 1.0 + 0.9 + 0.0 + + + + 0.0 + 0.0 + 0.0 + +