{"id":34,"date":"2004-09-13T02:18:15","date_gmt":"2004-09-13T10:18:15","guid":{"rendered":""},"modified":"2016-05-25T23:34:40","modified_gmt":"2016-05-26T06:34:40","slug":"sifr2-kick-the-tires","status":"publish","type":"post","link":"https:\/\/mikeindustries.com\/blog\/archive\/2004\/09\/sifr2-kick-the-tires","title":{"rendered":"sIFR 2.0b: Come Kick the Tires"},"content":{"rendered":"<p><strong>UPDATE:<\/strong> Version 2.0 is now available. <a href=\"\/sifr\/\">See article here<\/a>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/blog\/images\/inline\/grotesqueaccident.gif\" width=\"150\" height=\"167\" border=\"0\" alt=\"\" class=\"rightinlineborder\" \/>Without further ado, I present for download <a href=\"\/blog\/files\/sifr\/2.0\/sIFR2.0b.zip\" target=\"_blank\">sIFR 2.0b<\/a> (or Scalable Inman Flash Replacement Two Point Oh Beta).  Before I get into the details, I just wanted to post the link first, and also, an example of sIFR 2.0b in action. Note that <a href=\"\/blog\/files\/sifr\/2.0\/\" target=\"_blank\">this new example<\/a> <em>does not have a single image<\/em> anywhere on the page or even in the CSS. It&#8217;s pure XHTML text. That&#8217;s it.   <\/p>\n<p>Now then.<\/p>\n<p>How about an update on what&#8217;s occurred since 1.0.<\/p>\n<h3>Major goings on<\/h3>\n<p>Perhaps the most interesting thing that&#8217;s happened in the last couple of weeks is that according to <a href=\"http:\/\/www.daypop.com\/top\/\" target=\"_blank\">Daypop<\/a>, the original <a href=\"\/blog\/archive\/2004\/08\/sifr\" target=\"_blank\">sIFR article<\/a> was the 13th most popular page in the entire world (well, blogosphere at least) for a short period last week.  That&#8217;s pretty cool, damnit.  As blogging spreads from the techies to the general public over the next several years, reaching the top 20 is going to get harder and harder, so I reckon that&#8217;s probably it for me.  Might as well retire now.<\/p>\n<p>Besides the nice linkage, I received posts or e-mails from people in over 20 countries.  Most posts or e-mails were feature requests, improvements, or written expressions of glee.  Besides all the nice e-mails, it&#8217;s interesting to note who <em>hasn&#8217;t<\/em> shown up in the comments.  The highly esteemed <a href=\"http:\/\/www.joeclark.org\">Joe Clark<\/a> is absent, which means one of three things:<\/p>\n<ol>\n<li>Joe is vacationing on a beach and away from a computer.<\/li>\n<li>Joe is sick of responding to my nonsense.<\/li>\n<li>sIFR is actually accessible!<\/li>\n<\/ol>\n<p>So now that I&#8217;ve shot the big accessibility flaregun into the air, we&#8217;ll see what happens.  Great accessibility improvements have already been made, but I don&#8217;t claim to be a master at testing screenreaders, so if you have insight, please post it.<br \/>\n<!--more--><br \/>\nThe other major development since 1.0 is that <a href=\"http:\/\/neo.dzygn.com\" target=\"_blank\">Mark Wubben<\/a> volunteered his masterful javascript skills to rewrite <a href=\"http:\/\/www.shauninman.com\" target=\"_blank\">Shaun Inman<\/a> and <a href=\"http:\/\/www.jogin.com\" target=\"_blank\">Tomas Jogin&#8217;s<\/a> replacement script as an object-oriented anonymous function, fully compatible with XML Strict documents, even when served as application\/xml.  That&#8217;s right.  Even if you&#8217;re one of those XML-as-pagan-worship zealots, you, too, can use sIFR!  Mark&#8217;s script &#8212; described by Tomas as &#8220;supermodel beautiful&#8221; &#8212; is guaranteed not to interfere with any other variables or functions on your pages (hence the anonymity) and won&#8217;t break your XML.<\/p>\n<p>Instead of manipulating the content between HTML tags using innerHTML, Mark&#8217;s replacement function uses XML and the DOM to physically change the nodes of the document on the fly.  sIFR now hones in on an element, strips the content, inserts a node with a Flash object in it, feeds the original content into the Flash movie, and then reinjects the original content back in place, wrapped in a span, as accessible, yet hidden, text.  It sounds complicated because it <em>is<\/em> complicated.  Thankfully, Mark took care of the hard stuff.<\/p>\n<h3>Notable feature additions<\/h3>\n<p>Here are the major additions which made it into sIFR 2.0b:<\/p>\n<ul>\n<li>Faster loading and rendering through <a href=\"http:\/\/www.zelph.com\/\" target=\"_blank\">Aaron<\/a> and <a href=\"http:\/\/www.point-break.com\" target=\"_blank\">France&#8217;s<\/a> method of firing the script calls at the bottom of the page instead of onLoad.  A fact lost on me about onLoad calls is that they actually don&#8217;t get called after the HTML has loaded.  They get called after every single element of the page has loaded, including images, Flash, video, etc.  By placing our script invoker just before the ending BODY tag, we ensure every node of the document is there for possible replacing, but don&#8217;t have to wait for the other media to load.<\/li>\n<li>Font subsetting. sIFR now uses a dragged-onto-the-stage textbox in Flash in order to better control what characters get exported from the font character set.  By default, english language characters are exported, but by selecting the textbox in Flash and clicking the &#8220;Character&#8221; button in the Properties palette, you can export most other languages as well.  A further major benefit besides internationalization is that since we&#8217;re exporting a smaller character set now, the resulting .swfs are about half the size.  SWF files are often well under 10k now depending on the complexity of the font.<\/li>\n<li>More efficient scaling.  As the text is instantly resizing itself, it now starts out small and gets bigger, whereas before it did the opposite. A user sent me a link to an entire 6 paragraph text passage he was replacing (NOT recommended, but interesting) and pointed out how long it was taking.  This was because the whole page was drawing at 96 point type and you can imagine how many lines of scrolling that is.  So now, we start out at 6 point and enlarge until the text fits snugly into the movie bounds.  To scale from 6 point all the way to 60 point takes less than a tenth of a second now.<\/li>\n<li>Ability to pass textcolor, linkcolor, and hovercolor attributes to style the text.<\/li>\n<li>Ability to horizontally center text.<\/li>\n<li>Ability to replace text which wraps based on where a float might be. If you want to replace text sitting in a variable width column bounded by a float (<a href=\"\/blog\/files\/sifr\/2.0\/\" target=\"_blank\">as seen in the example<\/a>), you can simply set its CSS display property to &#8220;inline&#8221; and the script will properly measure and replace it.<\/li>\n<li>Better selectability of text.<\/li>\n<li>Ability to use fonts of radically different proportions than the originals. sIFR will always work best, and require the least fine-tuning, when the fonts you use in Flash have roughly similar proportions as your browser text.  But, like in the example, you may find yourself wanting to use very narrow fonts, where no browser text equivalent is available.  For that, we now have a set of &#8220;decoy&#8221; styles for each element we are replacing. Sounds complicated but it isn&#8217;t.  Basically, if we are replacing an H1, we have a style now in our stylesheet called &#8220;.sIFR-hasFlash h1&#8221; where we can adjust the letter-spacing of the browser text before it is measured.  So, to emulate a very narrow font like in the example, you&#8217;d just apply a negative letter-spacing in pixels until the two fonts are similar.  You needn&#8217;t worry how this browser text looks because it will never be seen&#8230; it&#8217;s just a decoy. I would suggest trying your font out first before embarking on this step.  You may not need it, and it&#8217;s really the only potentially tricky part of this whole process.<\/li>\n<li>Separation of Actionscript into .as files.  You can now edit the Actionscript from outside the Flash environment. There are two files: &#8220;customize_me.as&#8221; and &#8220;dont_customize_me.as&#8221;. The first file contains the few common things you may need to modify.  The second contains functions.<\/li>\n<li>Domain securing of .swf font files. By customizing &#8220;customize_me.as&#8221;, you can export your .swfs so that no one else can grab them and use them on their domain. The default is unsecured (to eliminate any problems in testing).<\/li>\n<li>Almost perfect printability in most browsers.<\/li>\n<li>Compatibility with IE (Mac and PC), Mozilla and Firefox (Mac and PC), Opera 7 (Mac and PC), Safari, Omniweb, and possibly other browsers and OSes as well.<\/li>\n<\/ul>\n<h3>A quick primer<\/h3>\n<p>It&#8217;s 1:45 in the morning right now and I spent the last three hours trying to squash a Windows XP SP2 bug which came up at the last second, so unfortunately I can&#8217;t write a full instruction set right now, but I&#8217;ll give the basics.  It&#8217;s particularly infuriating when the &#8220;solution&#8221; to the bug is to add <code>node.innerHTML +=\"\"<\/code> which essentially means &#8220;take this piece of content and don&#8217;t do anything with it&#8221;. I&#8217;ve heard of adding a space before, but adding <em>nothing<\/em>?  Anyway&#8230;<\/p>\n<ol>\n<li><a href=\"\/blog\/files\/sifr\/2.0\/sIFR2.0b.zip\" target=\"_blank\">Download 2.0b<\/a>.  sIFR is licensed free of charge under the standard CC-GNU LGPL.<\/li>\n<li>Get familiar with index.html. That&#8217;s really the only file which contains the things you&#8217;ll need.  It contains the replace statements at the bottom and the CSS at the top.<\/li>\n<li>To make your own .swf files, simply open up the .fla file in Flash, doubleclick the textbox which is on stage (it takes up the whole stage), and choose your own font from the Properties palette. Then, choose File > Export and you&#8217;re done!<\/li>\n<li>The parameters to use in your replacement functions are explained in both the .js and .html files. Plug in your parameters and you&#8217;re good to go!<\/li>\n<\/ol>\n<h3>Some Final notes<\/h3>\n<p>Firstly, it&#8217;s late and there is plenty more to say&#8230; but it will have to wait.  Second, this method is recommended for &#8220;light duty&#8221; on web pages.  Although it may work on huge bodies of text, it is meant merely for display type&#8230; headlines and such.  The example provided is a fairly complex use of it, mainly because of the tight and sometimes floated bounds of the type, but the simpler the better.  And finally, I know it&#8217;s not perfect yet.  Font sizing is an inexact science when you&#8217;re cross-pollinating two totally different display mechanisms, so part of what sIFR is all about is giving up absolute pixel control in exchange for absolute typeface control. I&#8217;ve worked extremely hard and learned a ton about font metrics and sizing peculiarities through this project and it is my goal to minimize display inconsistencies.  I guess we&#8217;ll find out in the comments how well it&#8217;s working.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Without further ado, I present for download sIFR 2.0b (or Scalable Inman Flash Replacement Two Point Oh Beta).  Before I get into the details, I just wanted to post the link first, and also, an example of sIFR 2.0b in action. Note that this new example does not have a single image anywhere on the page or even in the CSS. It&#8217;s pure XHTML text&#8230;<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36,282],"tags":[],"class_list":["post-34","post","type-post","status-publish","format-standard","hentry","category-design","category-original"],"_links":{"self":[{"href":"https:\/\/mikeindustries.com\/blog\/wp-json\/wp\/v2\/posts\/34","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mikeindustries.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mikeindustries.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mikeindustries.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/mikeindustries.com\/blog\/wp-json\/wp\/v2\/comments?post=34"}],"version-history":[{"count":0,"href":"https:\/\/mikeindustries.com\/blog\/wp-json\/wp\/v2\/posts\/34\/revisions"}],"wp:attachment":[{"href":"https:\/\/mikeindustries.com\/blog\/wp-json\/wp\/v2\/media?parent=34"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mikeindustries.com\/blog\/wp-json\/wp\/v2\/categories?post=34"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mikeindustries.com\/blog\/wp-json\/wp\/v2\/tags?post=34"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}