title: Android full justify and auto-hyphenation with Hyphenator.js
body: <p>I'm trying to fully justify text in Android with auto-hyphenation. I have achieved full justification using a WebView as explained <a href="https://stackoverflow.com/questions/1292575/android-textview-justify-text/4314724#4314724">here</a>. I have read a couple of threads on auto-hyphenation in Android, but none of them apply to WebViews. I've tried using the new CSS3 hyphens:auto (including -webkit-hyphens:auto), but Android WebKit does not support it yet. </p>
  
  <p>I've found a blog post <a href="http://smarter-than-the-average-pierre.blogspot.ch/2011/10/bad-android-typography-tale-of-text.html?showComment=1359645234484#c4633403689292386631" rel="nofollow noreferrer">here</a> that mentions using the Hyphenator JavaScript, but I have no idea how to implement it (JavaScript and HTML are next on the to do list). Due to the size of the .js file, I don't want to simply use <code>webView.loadUrl("javascript:someFunction()");</code></p>
  
  <p>Here is the code I am currently using:</p>
  
  <pre><code>public class TestWebView extends Activity {
  @Override
  public void onCreate (Bundle savedState) {
      WebView webView;
      super.onCreate(savedState);
      webView = new WebView(this);
      setContentView(webView);
      WebSettings webSettings = webView.getSettings();
      webSettings.setJavaScriptEnabled(true);
      webView.loadUrl("file:///android_asset/WorkingExample.html");
      }
  }
  </code></pre>
  
  <p>Here is the HTML:</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd"&gt;
  &lt;html lang="en"&gt;
      &lt;head&gt;
          &lt;title&gt;Hyphenator.js&lt;/title&gt;
          &lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"&gt;
          &lt;style type="text/css"&gt;
              body {
                  width:30%;
                  margin-left:35%;
                  margin-right:35%;
              }
              .text {
                  text-align:justify;
              }
      &lt;/style&gt;
      &lt;script src="Hyphenator.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          Hyphenator.config({
              displaytogglebox : true,
              minwordlength : 4
          });
          Hyphenator.run();
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h1&gt;Example of using Hyphenator.js&lt;/h1&gt;
          &lt;h2&gt;Deutsch&lt;/h2&gt;
          &lt;p class="hyphenate text" lang="de"&gt;Deutschsprachige Beispieltexte haben natürlicherweise längere Wortzusammensetzungen als englischsprachige. Aber auch &lt;span lang="en"&gt;“hyphenation”&lt;/span&gt; ist ein ziemlich langes Kompositum.&lt;/p&gt;
          &lt;p class="hyphenate text" lang="de"&gt;Verändern Sie die Fenstergrösse um den Effekt der Silbentrennung zu sehen.&lt;/p&gt;
          &lt;h2&gt;English&lt;/h2&gt;
          &lt;p class="hyphenate text" lang="en"&gt;English words are shorter in the average then german words. &lt;span lang="de"&gt;«Silbentrennungsalgorithmus»&lt;/span&gt; for example is quite long.&lt;/p&gt;
          &lt;p class="hyphenate text" lang="en"&gt;Resize the window to see hyphenation in effect.&lt;/p&gt;
          &lt;h2&gt;Links&lt;/h2&gt;
          &lt;p class="hyphenate text" lang="en"&gt;Not only words but also links like &lt;a href="http://code.google.com/p/hyphenator/"&gt;http://code.google.com/p/hyphenator/&lt;/a&gt; are processed. But in a special manner (using zero width space).&lt;/p&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Stored alongside the html file is the Hyphenator.js file. Opening the HTML file in my computer browser works as expected, but on the phone I'm getting no luck:<img src="https://i.stack.imgur.com/DbO8v.jpg" alt="Computer browser (FF) vs WebView">
  Eventually, I want the text to be generated dynamically, but just getting this to work would be a huge help. Thanks.</p>