diff src/name/blackcap/clipman/Main.kt @ 14:0cd912d29184

Better cope with Swing's idiosyncrasies.
author David Barts <n5jrn@me.com>
date Mon, 20 Jan 2020 22:59:04 -0800
parents fe0fcfc8b2aa
children 732f92dc3bc6
line wrap: on
line diff
--- a/src/name/blackcap/clipman/Main.kt	Mon Jan 20 21:53:15 2020 -0800
+++ b/src/name/blackcap/clipman/Main.kt	Mon Jan 20 22:59:04 2020 -0800
@@ -115,6 +115,7 @@
                                 add(stdLabel("Styled text"))
                                 val (html, style) = preproc(contents.html)
                                 val hek = HTMLEditorKit().apply {
+                                    style.addStyleSheet(styleSheet)
                                     styleSheet = style
                                 }
                                 add(ClipText().apply {
@@ -150,8 +151,8 @@
 
     private fun preproc(html: String): Pair<String, StyleSheet> {
         val sty = StyleSheet().apply {
-            addRule("html { font-family: serif; font-size: %d; }".format(PROP_SIZE))
-            addRule("code, kbd, pre, samp { font-family: monospace; font-size: %d; }".format(MONO_SIZE))
+            addRule("head, body { font-family: serif; font-size: %d; }".format(PROP_SIZE))
+            addRule("code, kbd, pre, samp, tt { font-family: monospace; font-size: %d; }".format(MONO_SIZE))
         }
         val scrubbed = Jsoup.parse(html).run {
             select("style").forEach {