PageRenderTime 25ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/_site/hatchshow-a-jquery-typesetting-plugin/index.html

https://github.com/charliepark/charliepark.github.com
HTML | 77 lines | 66 code | 10 blank | 1 comment | 0 complexity | 9b11155d2a2b80a749c2eaa3efdc9b70 MD5 | raw file
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="description" content="A jQuery typesetting plugin I wrote. It balances measures. Named for the poster shop. (from Charlie Park)">
  6. <link rel="alternate" href="http://charliepark.org/feed/" type="application/rss+xml">
  7. <meta name="viewport" content="width=device-width">
  8. <meta name="apple-mobile-web-app-capable" content="yes">
  9. <link rel="openid2.provider" href="https://www.google.com/accounts/o8/ud" />
  10. <!-- old OpenID credentials; keep around for a bit longer <link rel="openid.server" href="http://charliepark.mp/server" /> <link rel="openid.delegate" href="http://charliepark.mp/"> -->
  11. <title>HATCHSHOW.js</title>
  12. <link href="/stylesheets/screen.css" media="screen" rel="stylesheet" type="text/css">
  13. </head>
  14. <body>
  15. <header>
  16. <h2 class="site_title"><a href="/">Charlie Park</a> <span style="color:#ccc;font-size:19px;"></span></h2>
  17. <ul id="nav"><li class="nav_list_item" style="text-align:left"><a class="nav_list_link" href="/about">about me</a></li><li class="nav_list_item" style="left:2px;"><a class="nav_list_link" href="/projects">projects</a></li><li class="nav_list_item" style="text-align:right"><a class="nav_list_link" href="/archives">archives</a></li></ul>
  18. </header>
  19. <section id="main_content">
  20. <h1 class="post_title">HATCHSHOW.js</h1>
  21. <div class="meta_wrapper"><time datetime="2012-10-02">October 2, 2012</time><ul class="tag_list_in_post"><li class="inline tag_list_item"><a class="tag_list_link" href="/tag/a thing I made">a thing I made</a></li><li class="inline tag_list_item"><a class="tag_list_link" href="/tag/jQuery">jQuery</a></li><li class="inline tag_list_item"><a class="tag_list_link" href="/tag/front-end stuff">front-end stuff</a></li></ul></div>
  22. <p><img src="http://charliepark.org/images/hatchshow-a-jquery-typesetting-plugin/hatchshowprint_jc.jpg" style="margin:0 auto" /></p>
  23. <p>Ive always loved the posters from <a href="http://countrymusichalloffame.org/historical-posters/">HATCH SHOW PRINT</a>. You can see one above. See how they expand the type size until it fills the line? (Johnny is a smaller size than Cash, and the fabulous is even smaller.) I love that.</p>
  24. <p>About a year ago, I was working on Monotask and wanted to make a way to dynamically create text that resized, based on the width of its container and the amount of text on the line. Typesetting and JavaScript are two of my favorite things why not combine them? So I made a jQuery plugin: <a href="http://charliepark.org/hatchshow/">HATCHSHOW.js</a> I put a page up for it, and shared it on Twitter, but I realized I never posted it here on the blog. So this is a post to rectify that.</p>
  25. <p>Click on the image here to go check out <a href="http://charliepark.org/hatchshow/">HATCHSHOW.js</a>.</p>
  26. <p><a href="http://charliepark.org/hatchshow/"><img src="http://charliepark.org/images/hatchshow.png" alt="A Johnny Cash concert poster." /></a></p>
  27. <p>The plugin is really simple. All you do is wrap the lines you want the effect applied to with a &lt;span class=hsjs&gt;, and it does the rest. Youll probably want to make a few adjustments for the line height and for individual kerning adjustments. But the plugin does most of the work.</p>
  28. <p>As youll see if you check out the <a href="http://charliepark.org/hatchshow/">HATCHSHOW</a> page, the font-size for every letter on that page was generated dynamically. Cue theremin: By an <em>algorithm</em>. (Ooooo!)</p>
  29. <p>The more astute among you are probably saying Yeah, but this is the same thing <a href="http://fittextjs.com/">Fittext.js</a> does, isnt it? Good question, but no. Fittext is for a single line a headline or the name of the page / service / whatever. HATCHSHOW is intended for multi-line displays, kind of like what you see in that concert poster up top.</p>
  30. <p>If you build anything cool with it, be sure to let me know! And if you want the code, its right on <a href="http://charliepark.org/hatchshow/">the HATCHSHOW page</a> (click on the check out the code link at the bottom, then scroll down).</p>
  31. <p>Have fun!</p>
  32. <footer>
  33. <p class="next_actions">I would really enjoy connecting with you <a href="http://twitter.com/charliepark/">on Twitter</a><br>(but I&rsquo;m taking a little break from it at the moment).</p>
  34. </footer>
  35. </section>
  36. <aside id="sidebar">
  37. <h3>My Most Popular Posts</h3>
  38. <p>You&rsquo;ll like these.</p>
  39. <ul>
  40. <li><a href="/slopegraphs">Slopegraphs</a></li>
  41. <li><a href="/a-slopegraph-update">A Slopegraph Update</a></li>
  42. <li><a href="/beautiful-buttons-for-twitter-bootstrappers">Beautiful Buttons for Twitter Bootstrappers</a></li>
  43. <li><a href="/tags-in-jekyll">Tags in Jekyll</a></li>
  44. </ul>
  45. </aside>
  46. <script type="text/javascript">
  47. var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
  48. document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
  49. </script>
  50. <div id="search"><div id="cse" style="width: 100%;">Loading</div></div>
  51. <script src="http://www.google.com/jsapi" type="text/javascript"></script>
  52. <script type="text/javascript">
  53. google.load('search', '1', {language : 'en'});
  54. google.setOnLoadCallback(function() {
  55. var customSearchControl = new google.search.CustomSearchControl('003013616125562838920:lezwpvqsqgo');
  56. customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
  57. customSearchControl.draw('cse');
  58. }, true);
  59. </script>
  60. <script type="text/javascript">
  61. try {
  62. var pageTracker = _gat._getTracker("UA-15921981-1");
  63. pageTracker._trackPageview();
  64. } catch(err) {}
  65. </script>
  66. </body>
  67. </html>