From e3fc312c8e31b4c99e3ecbdcbb890ffc2dc51f05 Mon Sep 17 00:00:00 2001 From: cel Date: Mon, 13 Mar 2017 22:08:53 -0400 Subject: render symbols for dillo --- lib/render.js | 10 +++++++++- static/styles.css | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/render.js b/lib/render.js index ed60216..ef77f35 100644 --- a/lib/render.js +++ b/lib/render.js @@ -80,6 +80,14 @@ Render.prototype.emoji = function (emoji) { }) : name } +function fixSymbols(str) { + // Dillo doesn't do fallback fonts, so specifically render fancy characters + // with Symbola + return str.replace(/[^\u0000-\u00ff]+/, function ($0) { + return '' + $0 + '' + }) +} + Render.prototype.markdown = function (text, mentions) { if (!text) return '' var mentionsObj = this._mentions = {} @@ -92,7 +100,7 @@ Render.prototype.markdown = function (text, mentions) { }) var out = marked(String(text), this.markedOpts) delete this._mentions - return out + return fixSymbols(out) } Render.prototype.imageUrl = function (ref) { diff --git a/static/styles.css b/static/styles.css index 8a7129b..fd23b82 100644 --- a/static/styles.css +++ b/static/styles.css @@ -8,6 +8,10 @@ section { padding: 1ex; } +.symbol { + font-family: Symbola; +} + .ssb-post img { max-width: 100%; width: 640px; -- cgit v1.2.3