diff --git a/webssh/static/js/main.js b/webssh/static/js/main.js index f28e231..61af627 100644 --- a/webssh/static/js/main.js +++ b/webssh/static/js/main.js @@ -34,6 +34,17 @@ var wssh = {}; } }()); +const findFont = (iterator, familyName) => { + if (iterator === undefined) { + return undefined; + } + while (iterator.next()) { + if (iterator.family() === familyName) { + return iterator; + } + } + return undefined; +} jQuery(function($){ var status = $('#status'), @@ -46,7 +57,9 @@ jQuery(function($){ title_element = document.querySelector('title'), form_id = '#connect', debug = document.querySelector(form_id).noValidate, - custom_font = document.fonts ? document.fonts.values().next().value : undefined, + fonts = document.fonts; + custom_font_family_name = $("body").attr("data-wssh-custom-font-family-name", ""); + custom_font = findFont(fonts, custom_font_family_name), default_fonts, DISCONNECTED = 0, CONNECTING = 1, diff --git a/webssh/templates/index.html b/webssh/templates/index.html index 3268c38..91c67d0 100644 --- a/webssh/templates/index.html +++ b/webssh/templates/index.html @@ -36,7 +36,7 @@ {% end %} -
+