<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Reinventing Fire &#187; SVG</title>
	<atom:link href="http://schepers.cc/category/svg/feed" rel="self" type="application/rss+xml" />
	<link>http://schepers.cc</link>
	<description>Technology upside down and backwards</description>
	<lastBuildDate>Sun, 09 Oct 2011 19:47:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Retain Accessibility Immediately</title>
		<link>http://schepers.cc/retain-a11y-immediately</link>
		<comments>http://schepers.cc/retain-a11y-immediately#comments</comments>
		<pubDate>Thu, 30 Jun 2011 04:43:09 +0000</pubDate>
		<dc:creator>Schepers</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Canvas]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[SVG]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[W3C]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://schepers.cc/?p=488</guid>
		<description><![CDATA[<br/>There has been a heated argument recently on the W3C Canvas API mailing list between accessibility advocates and browser vendors over a pretty tricky topic: should the Canvas API have graphical &#8220;objects&#8221; to make it more accessible, or should authors use SVG for that? I think it&#8217;s a false dichotomy, and I offer a proposal [...]]]></description>
			<content:encoded><![CDATA[<br/><p>There has been a <a href="http://lists.w3.org/Archives/Public/public-canvas-api/2011AprJun/0040.html" title="hit testing and retained graphics from Richard Schwerdtfeger on 2011-06-17 (public-canvas-api@w3.org from April to June 2011)">heated argument recently on the W3C Canvas API mailing list</a> between accessibility advocates and browser vendors over a pretty tricky topic: should the Canvas API have graphical &#8220;objects&#8221; to make it more accessible, or should authors use SVG for that?  I think it&#8217;s a false dichotomy, and I offer a proposal to suggests a way to improve the accessibility potential of the Canvas 2D API by defining how SVG and the Canvas 2D API can be used together.</p>
<p>This brings together some ideas I&#8217;ve had for a while, but with some new aspects.  This is still a rough overview, but the technical details don&#8217;t seem too daunting to me.</p>
<p><span id="more-488"></span></p>
<h4 id="Retained-Mode_vs_Immediate-Mode_Graphics">Retained-Mode vs Immediate-Mode Graphics</h4>
<p>First, some background…</p>
<p><b>SVG</b> is a <b>retained-mode</b> graphics format, meaning that each shape persists as a separate object, with distinct characteristics such as location, size (bounding box), and precise outline (stroke).  These characteristics can be acted upon within the object structure (DOM) as discrete entities (or groups of entities) for manipulation by script or by user-interface actions (e.g. mouse clicks or keyboard tabbing); one of these interactions may be <a href="http://en.wikipedia.org/wiki/Hit-testing" class="external text" title="http://en.wikipedia.org/wiki/Hit-testing">hit-testing</a>.</p>
<p>The <b>Canvas 2D API</b> is an <b>immediate-mode</b> API, meaning that it allows the programmer to create visual shapes as individual pixels that are unstructured; in other words, if a red circle and a red square are drawn which overlap one another, there is no way to distinguish these from one another, or from the background canvas element (though a programmer could maintain a separate structure in script).</p>
<p>With <b>retained-mode</b> graphics, each object which is added to the DOM increases the memory &#8220;weight&#8221; of the page or application, potentially slowing down the browser or otherwise decreasing performance; by contrast, <b>immediate-mode</b> graphics, which are not represented as objects in the DOM, do not decrease performance, which is an advantage over <b>retained-mode</b> graphics.</p>
<p>Some accessibility advocates have noted that hit-testing and zooming are critical accessibility features of graphics; this requires the ability to access the location, size, and other characteristics of individual graphics.  Unfortunately, adding this retained-mode feature to an immediate-mode API effectively removes the primary advantage of using an immediate-mode graphics system.</p>
<p>However, by defining how SVG and the Canvas 2D API can be used together, a model may be created which allows authors to easily use both together, each for their appropriate strengths.  This approach involves two aspects: defining the behavior, and a potential shared API syntax.</p>
<h4 id="Defining_Behavior">Defining Behavior</h4>
<p>Currently, the Canvas 2D API is only defined to work with the &lt;canvas&gt; element defined in HTML5, and it does not allow SVG to be drawn or imported into the Canvas.  However, it could be extended to work inside SVG or to allow SVG to be used inside Canvas.</p>
<h5 id="Canvas_in_SVG">Canvas in SVG</h5>
<p>At its simplest, the Canvas 2D API could simply be defined to allow authors to draw on the SVG raster &lt;image&gt; element, just as it does in the HTML &lt;canvas&gt; element, but there does not seem to be a reason to limit it to this element.  The Canvas API could be defined to draw to any SVG element, rendering or structural, as an overlay.  It would be merely a visual effect, and would participate in the rendering structure, including &#8220;z-index&#8221;, only as its &#8220;target element&#8221; does.</p>
<h5 id="SVG_in_Canvas">SVG in Canvas</h5>
<p>SVG shapes could be allowed to be imported into the &lt;canvas&gt; drawing context, such that they render there but are also inserted into the DOM or shadow DOM.  Currently, as I understand it, this is not allowed for security restrictions involving content from potentially different sources, but for content that does not have external references (for example, a &lt;use&gt; element to another site, this should not be a security risk.</p>
<p></p>
<h6 id="SVG_in_the_Shadow_Tree">SVG in the Shadow Tree</h6>
<p>The accessibility features of the Canvas 2D API include a &#8220;shadow tree&#8221; and focus ring for those elements, such as text, which are not otherwise accessible to users with limited vision.  Each such &#8220;graphic piece&#8221; which is created and painted to the screen is also represented in this underlying shadow DOM (IIRC).</p>
<p>SVG elements used in conjunction with Canvas could also be placed in this shadow tree, so that navigability is preserved.  In order to save memory usage, a concept like the &lt;use&gt; element in SVG could alternative be used to &#8220;point to&#8221; an SVG in the main DOM from its appropriate place in the shadow tree.</p>
<p>SVG elements could either be used as visual shapes themselves, or could be invisible &#8220;hot-spots&#8221; for specific areas of the screen.</p>
<h4 id="Common_API">Common API</h4>
<p>I have <a href="http://www.w3.org/Graphics/SVG/WG/wiki/Simple_SVG_API">suggested before</a> that we create a simple graphics API that will allow either 2D Canvas (immediate-mode) or SVG (retained-mode) images with the same set of methods and parameters, with the only difference being which &#8220;mode&#8221; the author selects to have as the instantiated form.  If the author draws a circle to the canvas context, it would simply be drawn to the screen with no structure; if the author draws that same circle to the SVG context, it creates a &lt;circle&gt; element with the appropriate attribute values and style and inserts it into the DOM.</p>
<p>There would be certain differences in some of the renderings, because of the different rendering and compositing models of SVG and Canvas, and there would be certain specialized functionality and features each would have, but the majority of the visual appearance would be the same. </p>
<p>This would allow authors to learn only one API for 2D graphics for the Open Web Platform.  With this ease of learning and use, the author could decide on a case-by-case basis, even within the same application, which mode works best.  It would provide incentive to authors to use each to its best effect.</p>
<p>I call this approach <a href="http://schepers.cc/w3c/svg/api/cog.svg">COG: Common Open Graphics</a>.</p>
<h4 id="Example">Example</h4>
<p>An example of the effective use of SVG and Canvas together is a hypothetical game in which the user pilots a spaceship amidst an asteroid field.  </p>
<p>The background of the game includes animated nebulae, passing comets, rotating planets and moons, and other visual effects which are not interactive, and which do not affect the play of the game, but which add visual appeal.  The foreground of the  game (the &#8220;playable area&#8221;) includes asteroids, enemy ships, and energy beams that the player must dodge or shoot at, which increase in size the closer they get, and which benefit from hit-testing and keyboard focusability. The middle-ground of the game contains many smaller asteroids and ships that are not yet interactive, and so don&#8217;t need hit-testing or focusability.</p>
<p>Adding all of these graphics shapes as retained-mode objects in the DOM would unnecessarily increase the memory footprint of the game, degrading performance and playability.  However, since only a small number of these elements (those in the playable area)  need the retained-mode interactivity, the majority of them could be drawn with immediate-mode characteristics, then when a certain &#8220;distance threshold&#8221; is reached, changed to interactive SVG elements, perhaps using the same shared API.  This preserves the accessibility of the game, while also causing minimal performance degradation, and possibly even helping performance, since the hit-testing doesn&#8217;t need to be calculated in script.  From an authoring point of view, using the same shared API means that both types of shape, retained-mode and immediate-mode, are equally easy to generate and maintain.</p>
<p>To enhance the visual appearance of the SVG asteroids, the finer control of the Canvas API could even draw an overlay on the SVG stroke and fill areas, much as filters do, to show craters and other surface details in a more fine-grained manner then can be done efficiently in SVG.  Since this would be drawn specifically on the SVG element, the element itself would still provide the geometry and position characteristics.</p>
<h4 id="Caveats">Caveats</h4>
<p>This proposal has two caveats:</p>
<ol>
<li> Canvas can only be extended to be as accessible as SVG is, in this model.  Even with object retention, there are still many enhancements needed to make SVG truly widely accessible.  However, as plans for SVG accessibility improvements are made, these would be largely importable directly into the Canvas API, rather than working in parallel on two unrelated but overlapping graphics models.</li>
<li> Simply because the Canvas 2D API may be made more accessible, does not mean that all Canvas API applications or content will be automatically accessible, any more than all HTML or SVG content is accessible.  Authors will still need to use best practices and take specific steps to make their applications accessible.  This proposal only provides the means and the incentive to do so.</li>
</ol>
<h4 id="Feedback">Feedback</h4>
<p>I&#8217;m interested in feedback on this, either in the comments section of this blog, or on the W3C Canvas mailing list, <a href="mailto:&#x70;&#x75;&#x62;&#x6C;&#x69;&#x63;&#x2D;&#x63;&#x61;&#x6E;&#x76;&#x61;&#x73;&#x2D;&#x61;&#x70;&#x69;&#x40;&#x77;&#x33;&#x2E;&#x6F;&#x72;&#x67;">public-canvas-api@w3.org</a>.</p>
<hr />
<h4 id="Update">Update</h4>
<p>Someone pointed out offlist that this post emphasizes the accessibility aspect of this proposal, because that was the context of the most recent discussion, but this is a win for anyone who wants to do graphics in the browser, for any reason, not just accessibility.  Like any good accessibility feature, my proposal has general benefits, so it is more likely to be used in more content.  In the example scenario above, the developer gets the hit testing for free, regardless of whether or not Accessibility Technology is involved.  Other general advantages include ease of learning and use of graphics by developers (as mentioned above), sharing of features between modes (like using <em>Canvas.toDataURL()</em> to save an SVG as a PNG), pixel operations (like painting or detecting a color at a point) in SVG, metadata (like microdata, RDFa, or microformats) in select parts of a Canvas app, and so on.  I&#8217;m sure that clever people will come up with a whole boatload of cool things to do with a combined retained-mode/immediate mode API that I couldn&#8217;t imagine here.</p>
]]></content:encoded>
			<wfw:commentRss>http://schepers.cc/retain-a11y-immediately/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Translation Services at a Loss for Words</title>
		<link>http://schepers.cc/translatesvg</link>
		<comments>http://schepers.cc/translatesvg#comments</comments>
		<pubDate>Tue, 16 Nov 2010 03:27:15 +0000</pubDate>
		<dc:creator>Schepers</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Search Engines]]></category>
		<category><![CDATA[SVG]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Travel]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://schepers.cc/?p=399</guid>
		<description><![CDATA[<br/>Text in SVG is text. Visually, you can use webfonts like WOFF or SVG Fonts (where they are supported, like in Opera or the iPhone) to make it look cool, and you can style both the stroke and fill to make it all fancy, or apply filters to pop it out or make it glow [...]]]></description>
			<content:encoded><![CDATA[<br/><p>Text in SVG is text.  Visually, you can use webfonts like <a href="http://www.w3.org/TR/WOFF/">WOFF</a> or SVG Fonts (where they are supported, like in Opera or the iPhone) to make it look cool, and you can style both the stroke and fill to make it all fancy, or <a href="http://svg-wow.org/filterEffects/chiseled.svg">apply filters</a> to pop it out or make it glow or give it a dropshadow, but it&#8217;s not just a raster image like many text headers&#8230; it&#8217;s human- and machine-readable text, as nature intended.</p>
<p>So, SVG is translatable, right?<br />
<span id="more-399"></span><br />
I wanted to make that point in my talk yesterday at <a href="http://east.webdirections.org/2010/en/program/">Web Directions East</a>, here in Tokyo, so I thought I&#8217;d translate <a href="http://www.w3.org/2010/Talks/11-schepers-webdirectionseast/text.svg">my slide on text in SVG</a><br />
 in real time (<em>note: click the down arrow to step through the bullet points</em>).  But testing it beforehand (I&#8217;m glad I did some prep), neither <a href="http://translate.google.com/translate?js=n&#038;prev=_t&#038;hl=en&#038;ie=UTF-8&#038;layout=2&#038;eotf=1&#038;sl=auto&#038;tl=ja&#038;u=http%3A%2F%2Fwww.w3.org%2F2010%2FTalks%2F11-schepers-webdirectionseast%2Ftext.svg">Google</a> nor <a href="http://www.microsofttranslator.com/bv.aspx?from=&#038;to=en&#038;a=http%3a%2f%2fwww.w3.org%2f2010%2fTalks%2f11-schepers-webdirectionseast%2ftext.svg">Bing</a> even try to translate it.  <a href="http://babelfish.yahoo.com/translate_url?doit=done&#038;tt=url&#038;intl=1&#038;fr=bf-home&#038;trurl=http%3A%2F%2Fwww.w3.org%2F2010%2FTalks%2F11-schepers-webdirectionseast%2Ftext.svg&#038;lp=en_ja&#038;btnTrUrl=Translate">Yahoo&#8217;s Babel Fish</a> at least returns the original page, though it doesn&#8217;t take the extra little step of doing any actual translation.</p>
<p>Lame.</p>
<p>Why don&#8217;t they translate it?  Bing offers this helpful explanation:</p>
<blockquote><p><a href="http://www.microsofttranslator.com/help/#q2q">What text formats are supported?</a><br />
Html and Text. The viewer will not translate text on images, in PDFs, or in Flash graphics and animation. It may also not translate some dynamically generated text, such as in cascading menus.</p></blockquote>
<p>I expected this to work, since <a href="http://googlewebmastercentral.blogspot.com/2010/08/google-now-indexes-svg.html">Google now indexes SVG</a>; as I mentioned in a <a href="http://schepers.cc/formata-non-grata">previous blog post</a>, I made a <a href="http://schepers.cc/svgaccessibility.html">test page back in 2002</a> that sorta conflated the two services, indexing and translating.  But obviously, these are two different tools, and need to be fixed separately.</p>
<p>It would be easy to fix, I&#8217;d expect&#8230; simply add SVG to the list of allowed file types, and translate the text content of each element, just as they do with HTML.  If they actually special-case different element types, that would add slightly more work, but not a lot&#8230; just as with the task of indexing, you would pay attention to the content of the <code>&lt;text&gt;</code>, <code>&lt;tspan&gt;</code>, <code>&lt;textPath&gt;</code>, <code>&lt;title&gt;</code>, and <code>&lt;desc&gt;</code> elements.</p>
<p>It&#8217;s ironic that this doesn&#8217;t work, because on my way back from Lyon last week, I happened to meet <a href="http://www.linkedin.com/profile/view?id=2611357">Bert Esselink</a>, the author of a <a href="http://books.google.com/books?id=QxFg5AC_JZIC&#038;lpg=PP1&#038;ots=lXLrkbuy8-&#038;dq=bert%20Esselink&#038;pg=PP1#v=onepage&#038;q&#038;f=false">book on localization</a> who works for the translation company Lionbridge, and he and I chatted about how they use SVG extensively for their translation work.</p>
<p>In the end, I just had a native speaker translate a couple of text passages (the automatic translations were apparently not very good) and included them in my slide, just to serve as a placeholder. But I&#8217;m hopeful that soon I can demo the automatic translation live.  It would be especially useful to people looking at SVG infographics, to be able to see charts and graphs in their native tongue.</p>
<p><object type="image/svg+xml" width="485" height="485" data="http://schepers.cc/svg/search-engine-infographic.svg">Please use a modern browser.</object></p>
]]></content:encoded>
			<wfw:commentRss>http://schepers.cc/translatesvg/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SVG Game Resources</title>
		<link>http://schepers.cc/svg-game-resources</link>
		<comments>http://schepers.cc/svg-game-resources#comments</comments>
		<pubDate>Wed, 13 Oct 2010 16:36:51 +0000</pubDate>
		<dc:creator>Schepers</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[SVG]]></category>
		<category><![CDATA[SVG Basics]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://schepers.cc/?p=376</guid>
		<description><![CDATA[<br/>Mozilla is holding an Open Web Games competition. I expect that many of the games will be use the Canvas API, since many programmers are more familiar with the imperative programming mode, and there are some games libraries that have been developed for Canvas or adapted from existing drawing or gaming libraries. But I&#8217;m calling [...]]]></description>
			<content:encoded><![CDATA[<br/><p>Mozilla is holding an <a href="http://mozillalabs.com/gaming/2010/09/30/game-on-2010-is-here/">Open Web Games competition</a>.  I expect that many of the games will be use the Canvas API, since many programmers are more familiar with the imperative programming mode, and there are some games libraries that have been developed for Canvas or adapted from existing drawing or gaming libraries.</p>
<p>But I&#8217;m calling for SVG developers and designers to step up to the plate, as well.  SVG has a lot of features that make it easier out of the box to build interfaces, animations, and even games.  There is a scene graph, and the DOM event model that gives you free hit detection for pointer events, for example.  And I&#8217;d love to see someone make an open-web game that&#8217;s both accessible and fun&#8230;</p>
<p>To help developers along, I thought I&#8217;d share a few free, open-source SVG resources that could be useful in building games:<br />
<span id="more-376"></span><br />
<strong>Jonathan Watt&#8217;s <a href="http://jwatt.org/svg/tmp/mouse-relative-positioning.svg">Coordinate Transformer</a></strong>: An indispensable short code snippet that compensates for transforms and viewboxes, giving you the position of the pointer events in an intuitive way. </p>
<p><strong>David Leunen&#8217;s <a href="http://leunen.d.free.fr/fakesmile/index.html">FakeSmile</a></strong>: A Javascript shim that lets you use declarative animation even where it isn&#8217;t supported natively in browsers. </p>
<p><strong>Kevin Lindsey&#8217;s <a href="http://www.kevlindev.com/games/index.htm">Games</a> and <a href="http://www.kevlindev.com/geometry/index.htm">Geometry Library</a></strong>: An amazing toolkit that calculated intersection, does advanced geometry, and all sorts of other great stuff.</p>
<p><strong>Andreas Neumann&#8217;s <a href="http://www.carto.net/papers/svg/navigationTools/">Mapping</a> and <a href="http://www.carto.net/papers/svg/samples/">Widgets Library</a></strong>: For apps that need zooming, panning, and form controls, this is a very nice set of tools.</p>
<p><strong>Robin Berjon&#8217;s <a href="http://svgboilerplate.com/">SVG Boilerplate</a></strong>: A simple template to include SVG content embedded or inline, in a cross-browser and backwards-compatible way.</p>
<p><strong>Dmitry Baranovskiy&#8217;s <a href="http://raphaeljs.com/">Raphaël Javascript Library</a></strong>: A vector graphics API that gives you a new drawing API for SVG (and VML where there is no SVG).</p>
<p><strong>David Dailey&#8217;s <a href="http://www.w3.org/Graphics/SVG/IG/resources/svgprimer.html">SVG Primer</a></strong>: Background and basics on SVG, for those just getting started.</p>
<p>These are just a few resources, off the top of my head&#8230; there are many more out there, sorry if I failed to mention anyone.  If anyone has other useful resources for making SVG games, please drop a link in the comments.</p>
<p>I&#8217;m excited to see what you all dream up and build!</p>
]]></content:encoded>
			<wfw:commentRss>http://schepers.cc/svg-game-resources/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Pointers on Background of SVG Borders on Mutiny</title>
		<link>http://schepers.cc/css-in-svg</link>
		<comments>http://schepers.cc/css-in-svg#comments</comments>
		<pubDate>Sat, 21 Aug 2010 21:37:09 +0000</pubDate>
		<dc:creator>Schepers</dc:creator>
				<category><![CDATA[CDF]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[SVG]]></category>
		<category><![CDATA[SVG 2]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[W3C]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://schepers.cc/?p=340</guid>
		<description><![CDATA[<br/>With SVG being integrated more and more into HTML5, both included via &#60;object&#62; and &#60;img&#62; elements, and inline in the same document, some natural questions about SVG and CSS are receiving more focus. This includes box model questions like background and border, and pointer events. I&#8217;m interested in comments from the community on what direction [...]]]></description>
			<content:encoded><![CDATA[<br/><p>With SVG being integrated more and more into HTML5, both included via <code>&lt;object&gt;</code> and <code>&lt;img&gt;</code> elements, and inline in the same document, some <a href="http://lists.w3.org/Archives/Public/www-svg/2010Aug/thread.html#msg28">natural questions</a> about SVG and CSS are receiving more focus.  This includes box model questions like background and border, and pointer events.</p>
<p>I&#8217;m interested in comments from the community on what direction SVG should take.</p>
<p><span id="more-340"></span></p>
<p>It&#8217;s pretty clear that the intent of the SVG 1.1 spec was that the box-model CSS properties must not apply to any SVG elements.  In addition to what the spec states on the subject, my conversations with people who participated in the SVG WG at the time leave me with no doubt on the matter.</p>
<p>The question is, is that the behavior we want?  How hard or easy is it to change that in modern SVG+HTML+CSS implementations?  What is most useful and intuitive for content authors?</p>
<p>In my opinion, we could specify that some aspects of the box model apply without screwing with SVG&#8217;s coordinate-based positioning system.  Here are my initial thoughts on some specific properties:</p>
<h4>Borders</h4>
<p>A borders is different than a stroke.  An SVG element, including any graphical (<code>&lt;rect&gt;</code>, <code>&lt;circle&gt;</code>, <code>&lt;path&gt;</code>, etc.) or container element (<code>&lt;svg&gt;</code>, <code>&lt;g&gt;</code>) can have both a stroke (which conforms to the geometry) and a border (which conforms to the element&#8217;s bounding box).  A common use case is setting the graphics apart from other content, or doing mouseover highlights of an SVG element; for example, when I mouse over or focus a circle, it would be much nicer, and just as semantic, to simply have a CSS property draw a rectangle around that element as a highlight than for me to generate a rectangle based on the bbox and insert that into the DOM, keep a pointer to it, then remove it when I mouse out.</p>
<p>Paint servers and similar resources (gradients, filters, etc.) should not have any border.  Note: <code>&lt;defs&gt;</code> is a non-rendering element, akin to <code>&lt;head&gt;</code>, so no border would be visible for that either, but if the content of a <code>&lt;defs&gt;</code> is <code>&lt;use&gt;</code>d, any border properties would apply in the same manner as for other properties.</p>
<p>The border should not have any effect on the layout or rendering; it would be strictly visual.</p>
<h4>Margin</h4>
<p>No effect on SVG content, but may affect HTML content around that SVG content.  So, an <code>&lt;svg&gt;</code> element with <code>'margin: 20px;'</code>  has a 20-pixel gap around the SVG content, just as if it were <code>&lt;img style="margin: 20px;"/&gt;</code></p>
<p>Alternately, maybe margin only has an effect for <code>&lt;svg&gt;</code> elements; that might be simpler to specify, implement, and understand for content authors.</p>
<h4>Padding</h4>
<p>Again, this has no effect on SVG content, but it does affect how the border is drawn.  This would be a nice way to compensate for thick stroke widths.</p>
<h4>Background</h4>
<p>A background is different than a fill.  Background is much the same as border; it is a rectangle (modulo the border-radius effects) around the shape, based on its geometric bounding box, taking into account padding.</p>
<p>By default, there should be no background color, including for the <code>&lt;svg&gt;</code> element.  Right now, there is a <a href="https://lists.webkit.org/pipermail/webkit-unassigned/2009-July/120301.html ">WebKit bug in Chrome and Safari</a> which renders a white, non-transparent background for SVG fragments or documents; this is a major pain for any content creators trying to use SVG, much like the old Internet Explorer bug on transparency in PNGs.  I hope it receives some attention from the WebKit developers soon.</p>
<p>SVG Tiny 1.2 defines a <a href="http://www.w3.org/TR/SVGTiny12/painting.html#viewport-fill-property"><code>'viewport-fill'</code></a>  and <a href="http://www.w3.org/TR/SVGTiny12/painting.html#viewport-fill-opacity-property"><code>'viewport-fill-opacity'</code></a>.  I think those should be deprecated in favor of <code>'background'</code>  properties; I have no opinion on which should have precedence&#8230; maybe they should be seen as aliases of <code>'background'</code>, if that makes it simpler.</p>
<p>A background on SVG content raises the question of pointer events, which is also relevant to borders.</p>
<h4>Pointer Events</h4>
<p>Should pointer events on the border or background fire on the element itself?  I think that the default should be &#8220;no&#8221;, just to be safe and consistent with older SVG content, but I could easily be persuaded to reverse that.  Either way, there should be a new property or set of properties that can modify this, in a manner consistent with how CSS is defining <code>'pointer-events'</code>.</p>
<p>This touches on the question, asked in a related thread, on whether the <code>&lt;svg&gt;</code> element, by default, should be a proximal event target for pointer events.  My answer on that is a pretty firm &#8220;no&#8221;; if you want to have it as an event target, give it a background, or change the <code>'pointer-events'</code>  value.</p>
<h4>Questions</h4>
<p>A few high level questions:</p>
<ul>
<li><strong>Is this a change from SVG 1.1 and SVG Tiny 1.2?</strong>  Yes.</li>
<li><strong>Is this backwards compatible?</strong>  Kind of.  It introduces new behavior that is not consistent with past behavior, but doesn&#8217;t explicitly change very much.</li>
<li><strong>Does this break existing content?</strong>  Very doubtful.</li>
<li><strong>Is this intuitive for content authors?</strong>  My intuition says yes.</li>
<li><strong>Does this match existing implementations?</strong>  Some, at least.</li>
<li><strong>Does this provide value for content authors?</strong> Yes.</li>
<li><strong>Does this make it harder to implement?</strong>  I don&#8217;t know; I suspect it makes it easier for at least some implementations.</li>
<li><strong>Would defining this improve interoperability?</strong>  Yes.</li>
</ul>
<h4>Conclusion</h4>
<p>I propose we change SVG 2 to explicitly define this behavior.  As the editor of the HTML5 spec, <a href="http://lists.w3.org/Archives/Public/www-svg/2010Aug/0048.html">Hixie seems to imply</a> that this is not for HTML5 to define, and I tend to agree with that, though maybe some informative mention in the HTML5 or CSS specs for how SVG treats margins and padding might be appropriate.  We recently <a href="http://lists.w3.org/Archives/Public/public-cdf/2010Aug/0000.html">formally closed</a> the <a href="http://www.w3.org/2004/CDF/">Compound Document Formats Working Group</a>, which was formed to look at exactly these sorts of questions, and published its specifications as Working Group Notes for posterity; we wanted to be clear about its status.  The CDF WG succumbed to the politics around the reformation of the HTML WG, and probably to good effect overall; but in its absence, we still need to resolve these questions by cooperation between the various groups involved.</p>
<p>I don&#8217;t think this should be any different in standalone SVG files than in SVG files referenced or inlined in HTML.  That would be very unintuitive, in my opinion.</p>
<p>If this is not controversial, I would be happy to put any or all of this in the <a href="http://dev.w3.org/SVG/modules/integration/SVGIntegration.html">SVG Integration spec</a>, which is one of the foundations of SVG 2.  If someone disagrees with this, we&#8217;ll have to talk about it before I start editing the spec.  In either case, it would need to be fleshed out some&#8230; I&#8217;m probably glossing over some possible stumbling blocks in the box model, which I&#8217;d appreciate feedback on.</p>
<p>Please leave a comment if you like my suggestions, if you see a flaw, or have a better suggestion.</p>
<h4 id="update1">Update:</h4>
<p>Just to show what I&#8217;m talking about, I created a sample.  Here is a good example of a bad example; below are 3 instance of the same SVG with the same CSS background and border values, with a border width of 2px.  The first 2 are external files referenced as objects, the third is inline in the HTML (you won&#8217;t see this one unless you are using preview releases of Firefox 4, WebKit, or IE9); the second image also has a padding and margin of 10px.</p>
<p>I tested this in several browsers, and in the referenced cases, the border width increases the image size, spawning scrollbars; I don&#8217;t think that&#8217;s a good outcome&#8230; it should clip the border, just as it does for any graphical overflow&#8230; borders should not contribute to the geometry of SVG images.</p>
<p>In the second case, where I added padding, the argument is less clear, but I still believe that for referenced content, the border and background should not displace the rendered graphics, and should be clipped.  For inline content, it would make sense for the padding and margin to be visible in the rendered document, but it should still not change the geometry of the SVG.</p>
<p><object type="image/svg+xml" width="150" height="150" data="http://www.schepers.cc/svg/blendups/css/border-bg.svg">Please use a modern browser.</object></p>
<p><object type="image/svg+xml" width="150" height="150" data="http://www.schepers.cc/svg/blendups/css/border-bg-padding.svg">Please use a modern browser.</object></p>
<p><svg xmlns="http://www.w3.org/2000/svg" width="150" height="150" viewBox="0 0 50 50" style="border: 2px solid green; background-color: palegreen;"><circle cx="25" cy="25" r="20" fill="orange" stroke="red" style="border: 2px solid gold; background-color: yellow;"/></svg></p>
<p>We&#8217;d need to specify this in order for it to behave the same across browsers (and authoring tools).  So, do people agree or disagree with my conlcusions?</p>
]]></content:encoded>
			<wfw:commentRss>http://schepers.cc/css-in-svg/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>The Map is not Proprietary</title>
		<link>http://schepers.cc/map-not-proprietary</link>
		<comments>http://schepers.cc/map-not-proprietary#comments</comments>
		<pubDate>Fri, 20 Aug 2010 21:34:31 +0000</pubDate>
		<dc:creator>Schepers</dc:creator>
				<category><![CDATA[Maps]]></category>
		<category><![CDATA[Metadata]]></category>
		<category><![CDATA[SVG]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://schepers.cc/?p=337</guid>
		<description><![CDATA[<br/>Korzybski remarked that &#8220;the map is not the territory&#8221;, reminding us that we shouldn&#8217;t confuse our mental models for reality. But maps, and data visualizations of all kinds, are really powerful, conveying complex ideas easily, and even shaping (or misshaping) perceptions about facts. This is one reason why decentralization of mapping resources and services is [...]]]></description>
			<content:encoded><![CDATA[<br/><p>Korzybski remarked that &#8220;the map is not the territory&#8221;, reminding us that we shouldn&#8217;t confuse our mental models for reality.  But maps, and data visualizations of all kinds, are really powerful, conveying complex ideas easily, and even shaping (or misshaping) perceptions about facts.  This is one reason why decentralization of mapping resources and services is good; no one organization should control our common maps.</p>
<p>SVG is a natural fit for mapping.  There&#8217;s even a detailed proposal by KDDI&#8217;s Satoru Takagi-sensei for <a href="http://blog.svg-map.com/2009/09/tiling-and-laye.html">tiling, layering, and coordinate resolution</a> that fits on top of SVG, which I&#8217;d like to see standardized.</p>
<p>I&#8217;ve had an idea for a small open-source project for a while, which I&#8217;ve discussed with the brilliant Andreas Neumann of <a href="http://www.carto.net/">Carto.net</a>; he&#8217;s been too busy planning SVG Open every year to help out with it thus far, and I don&#8217;t have the skills to do it without a great investment in time.<br />
<span id="more-337"></span><br />
The idea is simple: there are lots of static SVG maps of various countries, states, etc. that are freely available (for example, on <a href="http://en.wikipedia.org/wiki/Wikipedia:Blank_maps">Wikipedia</a>).  Some effective data visualizations can be made with these (color-coding countries, etc.), but they are by necessity very simple. Content creators can&#8217;t use such maps to pinpoint specific locations (long/lat), because they don&#8217;t know the projection&#8230; the maps are purely visual, not topographical (if that&#8217;s the right word).</p>
<p>There are more heavy-weight solutions, like <a href="http://www.openstreetmap.org/">OpenStreetMap</a>, which is awesome, but more than most people need for very simple location-sensitive webapps.</p>
<p>What I would like to do is have a very simple set of basic maps, with low-to-medium level of detail, all with the same projection, and to provide a Javascript utility that converts back and forth between long/lat and the coordinate space of the image.  There would be one world map, and a map for each country, and a map for each major region within each country (in the US, this would be states).</p>
<p>For example, using this script and some of these premade maps, I could make a little webapp that allows members of a social network (e.g. a developer community, or people who share a hobby) to type in their location (long/lat), and it would stick a &#8220;pin&#8221; in the map at that location.  They could see the high level overview at the world level (100 people in the US, 20 in Japan, 72 in Europe, etc.), and easily drill to the country level (click on US and open that map, showing 20 in California, 5 in North Carolina), and drill down again to the region level (showing the distribution of pins in North Carolina).</p>
<p>It would not go down to the city level, or show regional features like roads or lakes&#8230; that gets too complex, and there are other applications to do that.  However, it would include projection metadata and instructions for each region (which the conversion script might use), and the project would make it possible for someone to export their own GIS data into this simplified format by providing instructions (for, say, ArcGIS).</p>
<p>This is something I think could appeal to people on a very high-level, making SVG easier to understand and use for simple projects like this; I want to improve the reusability of SVG in this way.</p>
<p>And I think the stellar <a href="http://mike.teczno.com/">Michal Migurski </a>of <a href="http://stamen.com/">Stamen Design</a>, and <a href="http://simplegeo.com/">SimpleGeo</a>, have just scooped me.  I haven&#8217;t looked into the details yet, but they just <a href="http://blog.simplegeo.com/post/983045400/announcing-polymaps">announced</a> the launch of <a href="http://polymaps.org/">PolyMaps</a>, a free and simple SVG and Javascript mapping library.  Curse and bless you, you maptastic bastards!</p>
<p>Oh, and in case PolyMaps doesn&#8217;t completely fit what I described above, let talk.</p>
]]></content:encoded>
			<wfw:commentRss>http://schepers.cc/map-not-proprietary/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Short Stuff</title>
		<link>http://schepers.cc/short-stuff</link>
		<comments>http://schepers.cc/short-stuff#comments</comments>
		<pubDate>Mon, 09 Aug 2010 04:31:43 +0000</pubDate>
		<dc:creator>Schepers</dc:creator>
				<category><![CDATA[Meta]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[SVG]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Website]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://schepers.cc/?p=300</guid>
		<description><![CDATA[<br/>I&#8217;ve been doing a lot of website stuff this week. Here&#8217;s some highlights: W3C Working Group Sites A few weeks ago, after long neglect, I finally updated the SVG WG page with a template that better matches the new(ish) W3C site redesign. Each working group has its own eclectic home page, which seems a bit [...]]]></description>
			<content:encoded><![CDATA[<br/><p>I&#8217;ve been doing a lot of website stuff this week.  Here&#8217;s some highlights:<br />
<span id="more-300"></span></p>
<h4 id="wg-sites">W3C Working Group Sites</h4>
<p>A few weeks ago, after long neglect, I finally updated the <a href="http://www.w3.org/Graphics/SVG/">SVG WG page</a> with a template that better matches the new(ish) W3C site redesign.  Each working group has its own eclectic home page, which seems a bit silly to me.  So, I took the template I made and converted the group pages of the <a href="http://www.w3.org/2008/webapps/">WebApps WG</a>, <a href="http://www.w3.org/Graphics/SVG/IG/">SVG Interest Group</a>, and <a href="http://www.w3.org/Graphics/fx/">FX Task Force</a>, and I&#8217;m talking with other W3C team contacts about converting theirs as well, though we&#8217;ll see how many switch over.  From my perspective, having a consistent look&#038;feel is important, and would make the W3C site more usable.</p>
<p>The new template I made is done in HTML5, with the &lt;header&gt;, &lt;footer&gt;, &lt;article&gt;, &lt;section&gt;, &lt;aside&gt;, and &lt;nav&gt; elements (and a reference to <a href="http://code.google.com/p/html5shiv/">Remy Sharp&#8217;s HTML5 shiv</a>), possibly even used correctly; the SVG WG page has a scripted live microblog feed from the <a href="https://twitter.com/svgwg">@svgwg</a> Twitter account, and an inline SVG easter egg (look for it in Firefox and WebKit nightlies).</p>
<h4 id="short">Short Notice</h4>
<p>I have been wanting to write or install a URL shortener on my own site for a while, so I didn&#8217;t have to rely on the brittle third-party services like TinyURL, which I feel don&#8217;t fit the spirit of the Web.  They obscure the link, and act as a massive throttling point.  I looked around a bit before for a custom URL shortener, but never found one that suited my fancy.</p>
<p>But on Saturday, after converting my URLs to have nicer, more meaningful, more RESTful names on the advice of the ever-helpful <a href="http://heldermagalhaes.com/blog/">Helder Magalhães</a>, I was in a mood to tackle the problem, and I found a <a href="http://esev.com/blog/review/host-your-own-url-shortener-10-php-apps-reviewed/">great summary of some of the options</a> by a fellow named Eric Severance.  He described a better list of criteria than I&#8217;d considered, and I went with his top pick, <a href="http://blairwilliams.com/pretty-link/">Pretty Link by Blair Williams</a>.</p>
<p>Despite the silly name, Pretty Link has almost all the features I wanted and then some.  It&#8217;s easy to use, it integrates into my WordPress blog, it lets me pick a meaningful shortname, and I can shorten not only my own blog&#8217;s URLs (lots of WP plugins let you do that), but any random URL I want; it even tracks how many people have followed the links, which to me is mildly interesting, but for people more into their brand would be very handy.  The only thing I&#8217;d like to see is a way to automatically publish a public page that lists all the shortened URLs and the title of each page, along with the expanded original URL; maybe I can hack that in, somehow (and maybe I just haven&#8217;t found it yet).  Just for posterity, I compiled a list of all the links I had tweeted before, and dereferenced them, which you can find on my <a href="http://schepers.cc/expanded_urls.html">expanded URLs page</a>.</p>
<h4 id="avatars">Commenter Avatars</h4>
<p>I&#8217;m playing a bit with my site theme.  I&#8217;m happy with it overall, but I think the column width could be a bit wider; I&#8217;ve already bumped up the font size.  I want to enable nested comment threads, because I think they are easier to read, but I&#8217;ll need to overhaul my theme quite a lot to do so, since it&#8217;s from an older version of WordPress.</p>
<p>In the meantime, I added commenter avatars.  The default image is a Gravatar; as with TinyURL, I don&#8217;t like artificial centralization in avatars, and in this case, it seems particularly silly.  So I cobbled together my own WordPress plugin to take an alternative approach, which I&#8217;ll blog about next time.</p>
]]></content:encoded>
			<wfw:commentRss>http://schepers.cc/short-stuff/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting to the Point</title>
		<link>http://schepers.cc/getting-to-the-point</link>
		<comments>http://schepers.cc/getting-to-the-point#comments</comments>
		<pubDate>Tue, 13 Jul 2010 15:18:15 +0000</pubDate>
		<dc:creator>Schepers</dc:creator>
				<category><![CDATA[Standards]]></category>
		<category><![CDATA[SVG]]></category>
		<category><![CDATA[SVG 2]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[W3C]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://schepers.cc/?p=243</guid>
		<description><![CDATA[<br/>SVG paths have a pretty good set of shape commands, enough to let you draw any 2D shape you might want in an authoring tool: horizontal, vertical, and diagonal straight lines, elliptical arc segments, and cubic and quadratic Bézier curves. Béziers are great, giving you precise control over the position and curve interpolation of each [...]]]></description>
			<content:encoded><![CDATA[<br/><p>SVG paths have a pretty good set of shape commands, enough to let you draw any 2D shape you might want in an authoring tool:  horizontal, vertical, and diagonal straight lines, elliptical arc segments, and cubic and quadratic Bézier curves.  Béziers are great, giving you precise control over the position and curve interpolation of each point in a concise format, using control points (&#8220;handles&#8221;), and are easily chained together to create complex shapes.</p>
</p>
<p>But let&#8217;s say you have a series of points, and you want to draw a smooth line between them, e.g. for stock data, an audio wave, or a mathematical graphing equation.  Béziers are not as handy there, because not all the points needed to define a Bézier spline are on the curve itself.  Obviously, you can decompose any set of points into a set of Béziers, but that takes math, and who wants to do that?  (Put your hand down, nerd.  I&#8217;m talking to the normals.)</p>
</p>
<p>Sometimes, you just want to lay down a set of points, and let the browser draw a smooth curve (unlike polylines, where each segment is just a straight line between the points).  Like this:</p>
<p>  <object type="image/svg+xml" width="420" height="120" data="http://schepers.cc/svg/path/pathpoints.svg">Please use a modern browser.</object><br />
<span id="more-243"></span>
</p>
<p> Mouse over the line above to see the equivalent cubic Bézier points.  They are off the line. Off the line! Oh, Math, why do you do this to me?</p>
<p>One thing that&#8217;s always bothered me about SVG&#8230; there should be more simple ways of doing things, and this is one of things.  Over the years, I&#8217;ve idly asked math-minded folks about how to achieve this, and the answers always soared right over my pointy little head.  I probably didn&#8217;t ask the question the right way.</p>
</p>
<p>But a few months ago, I was chatting with Ben Fry, one of the creators of Processing (the graphics programming language), and he mentioned <a href="http://en.wikipedia.org/wiki/Catmull%E2%80%93Rom_spline#Catmull.E2.80.93Rom_spline" title="Cubic Hermite spline - Wikipedia, the free encyclopedia">Catmull-Rom curves</a> as a possible solution.  I took note of that, and later read up on them; they seemed a pretty good fit for my use case.  In my spare time I looked for any libraries out there to convert Catmull-Rom curves to Bézier splines; I found <a href="http://almightybuserror.com/2009/12/04/drawing-splines-in-opengl.html">references</a> that talked about the the conversion using inverted matrixes, but no simple code to be had.  I&#8217;m lazy, and busy, and the problem wasn&#8217;t urgent, so I kept putting it off.</p>
</p>
<p>But in talking to folks about SVG throughout the UK, including designers, the thought kept running through my mind that SVG really does need a better authoring experience (and I don&#8217;t just mean authoring tools, though some nice animation tools would help).  So, when I got back home from vacation, before I really got back into the thick of the dozen other things I should be doing, I put on some music and spent a few hours after work scouring the intartubes for some suitable code.  And as luck would have it, Maxim Shemanarev&#8217;s <a href="http://www.antigrain.com/__code/include/agg_curves.h.html">Anti-Grain Geometry</a> library contained a single simplified conversion matrix and a line of code that did the grunt work in C++, easily ported to Javascript; whip up a custom parser for the &lt;path&gt; syntax, feed it into the convertor function, and you&#8217;ve got yourself a working proof-of-concept.</p>
</p>
<p>Here is a scientific chart showing how awesome the SVG &lt;path&gt; element is, with values derived from the overall awesomeness by different path commands, rendered using an experimental Catmull-Rom path command:</p>
<p><object type="image/svg+xml" width="450" height="400" data="http://schepers.cc/svg/path/path-awesomeness.svg">Please use a modern browser.</object></p>
<p>As you can see, adding Catmull-Rom curves would increase the awesomeness of SVG paths by almost 50%.  That is a lot more awesome!</p>
</p>
<p>The syntax is pretty intuitive&#8230; it&#8217;s just the command &#8216;R&#8217; followed by a set of coordinate points:</p>
<pre><code>
  &lt;path stroke="#BADA55"
        stroke-width="2"
        fill="none"
        d="M20,380
           R58,342
           100,342
           100,300
           140,250
           190,210
           220,197
           250,184
           280,155
           310,260
           404,20"/&gt;
</code></pre>
<p>And the path syntax isn&#8217;t just used for the &#8216;d&#8217; attribute of &lt;path&gt; elements.  It&#8217;s also used for laying out text-paths, and the shapes of SVG Font glyphs.  And it&#8217;s used in animation, both for motion paths and (in the case of Béziers) for timing functions in the &#8216;keysplines&#8217; easing attribute that controls the rate of animation.  So, making it easier to hit specific points for paths could have side benefits for all those uses as well.</p>
</p>
<p>I&#8217;m really interested in feedback from others on the usefulness of this idea.  I&#8217;m not married to the idea of Catmull-Rom curves specifically (<i>Fun fact: Ed Catmull is now the president of the Walt Disney and Pixar animation studios; I believe Rom became an astronaut, was captured by aliens and turned into a cyborg, and is now a Spaceknight</i>), just in the idea of adding this type of point-on-the-path command.  So, if you support the notion of adding this in SVG 2, or have a better idea along the same lines, send an email to the SVG Working Group&#8217;s public list, <a href="mailto:www-svg@w3.org">www-svg@w3.org</a>, to let us know.</p>
<p>The <a href="http://schepers.cc/svg/path/catmullrom2bezier.js">javascript library</a> I wrote to demonstrate this is, of course, open source, available under the MIT or GPL licenses.  Feel free to play around with it, and improve it to make a better proposal.  You&#8217;re welcome to use it for other purposes, but I intended it just as a quick-and-dirty prototype to solicit feedback about extending SVG, so the code isn&#8217;t that great.</p>
<hr />
<h4 id="normals">Update 1:</h4>
<p><a href="http://xn--dahlstrm-t4a.net/">Erik Dahlström</a>, Chief Vectorizer at Opera and chair of the SVG WG, posted a <a href="http://schepers.cc/?p=243#comment-166">visual reply</a>, which WordPress filtered, but I&#8217;ve now <a href="http://schepers.cc/?p=243#comment-166">restored this inline</a>.  Nothing to see here, move along.</p>
<hr />
<h4 id="spiro">Update 2:</h4>
<p>Here is my Catmull-Rom code trying to achieve the nice curves of <a href="http://www.levien.com/spiro/">Spiro</a>, as suggested by Dave Crossland in <a href="http://schepers.cc/?p=243#comment-170">his comment</a>:<br />
<object type="image/svg+xml" width="485" height="277" data="http://schepers.cc/svg/path/spiro.svg">Please use a modern browser.</object></p>
<hr />
<h4 id="spiro-a">Update 3:</h4>
<p>Looking at Spiro curves a bit closer (just the image, not the code), it seems that there are actually different node types illustrated, not simply an undifferentiated set of coordinate points as in my interpretation of the Catmull-Rom algorithm.  This means that, from an syntax standpoint, those segments would need additional parameters in addition to the coordinate points on the curve, which somewhat undercuts the simplicity.</p>
<p>Given that SVG already has a &#8216;Lineto&#8217; command, I set out to see how closely I could match <a href="http://www.levien.com/spiro/spiro.png">the letter &#8220;a&#8221; in Raph Levien&#8217;s example</a>, using just my Catmull-Rom and Lineto segments, and with minimal effort:</p>
<p><object type="image/svg+xml" width="485" height="465" data="http://schepers.cc/svg/path/spiro-a.svg">Please use a modern browser.</object></p>
<p>Mouse over the raster image to hide the SVG path.  There are definite artifacts, and I am running into some known limitations of my script implementation in how it interpolates the last coordinate segment, but with not much effort, I was able to get pretty close.</p>
<p>This is not to belittle Spiro at all&#8230; Spiro generates <a href="http://fontly.com/sandbox/spiro.html">painfully elegant curves</a>.  It&#8217;s just to compare apples to apples.</p>
]]></content:encoded>
			<wfw:commentRss>http://schepers.cc/getting-to-the-point/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Formata Non Grata</title>
		<link>http://schepers.cc/formata-non-grata</link>
		<comments>http://schepers.cc/formata-non-grata#comments</comments>
		<pubDate>Sat, 10 Jul 2010 15:39:19 +0000</pubDate>
		<dc:creator>Schepers</dc:creator>
				<category><![CDATA[Metadata]]></category>
		<category><![CDATA[Microformats]]></category>
		<category><![CDATA[Search Engines]]></category>
		<category><![CDATA[Semantics]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[SVG]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://schepers.cc/?p=160</guid>
		<description><![CDATA[<br/>Recently, a browser implementer asked me for examples of SVG. He was having trouble finding good examples of SVG in use, particularly as parts of an HTML document. This question has come up again and again, actually, and it always vexes me. I&#8217;ve been active in the SVG community for close to a decade, and [...]]]></description>
			<content:encoded><![CDATA[<br/><p>Recently, a browser implementer asked me for examples of SVG.  He was having trouble finding good examples of SVG in use, particularly as parts of an HTML document.  This question has come up again and again, actually, and it always vexes me.  I&#8217;ve been active in the SVG community for close to a decade, and I&#8217;ve seen thousands of amazing SVG files (and many more of mediocre to average quality), but somehow they seem to have disappeared or bitrotted over the years.  Some of those files only worked with the slightly-unstandard Adobe SVG Viewer, or didn&#8217;t quite work with Firefox&#8217;s incomplete support, I know, but surely not all of them.  Where is all the great SVG content I remember, the games and GUIs and design and development?  Where are all those files to be found?</p>
<p>I hear some browser implementers say that people just don&#8217;t use SVG.  Intuitively, this feels false to me, based on my own experience.  But could it be true?</p>
<p><span id="more-160"></span></p>
<p>The statistical insignificance of SVG is often cited by some people in the WHATWG, based on a large dataset of Web content indexed by Google.  In the WHATWG, where HTML5 started, great stock is placed on statistics, particularly <a href="http://code.google.com/webstats/index.html">those conducted</a> by the editor, Ian Hickson, a Google employee.</p>
<p style="text-align: center;"><a title="Based on a study of one BILLION documents!" href="http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2006-June/006726.html"><img class="aligncenter size-full wp-image-167" title="DrHTML5" src="http://schepers.cc/wp-content/uploads/2009/07/DrHTML5.png" alt="DrHTML5" /></a></p>
<p>There&#8217;s no question about it: HTML is the king of the Web.  I did some rough calculations, similar to claims I&#8217;ve heard before, by counting the number of returns for HTML files versus SVG files.  A <a title="SVG filetype search on Google" href="http://www.google.com/search?q=filetype%3Asvg">search for the filetype &#8220;.svg&#8221;</a> yields around 18,165,500 hits on Google.  (Note that this doesn&#8217;t count the false hits on the word &#8220;SVG&#8221; from St. Vincent and the Grenadines, Stan Van Gundy, the Sexy Valley Girls, or any of the numerous other bizarrities that the acronym stands for.)  SVG content makes up just 0.106% of all Web content, by my rough estimation.  Flash is almost 5 times as common as SVG.  That&#8217;s pretty grim for SVG.</p>
<p>But wait, let&#8217;s put that into perspective.  Flash is about 4.8 times more common than SVG.  HTML is roughly 838 times more common than SVG.  838 times.  Flash content comprises approximately 0.52% of all Web content, and HTML is roughly 189 times more common than  Flash.  So, Flash is clearly much more popular than SVG (even when you consider that some large percentage of Flash content is actually just encapsulated video content, these days).  But that doesn&#8217;t mean that nobody&#8217;s using SVG.  Nearly 20 million documents is pretty impressive, actually, especially given the fact that SVG has been hindered by a lack of native support in browsers for most of its existence (and more recently, even poor support by the Adobe plugin for IE), and a lack of common authoring tools for dynamic content (Inkscape is an excellent vector editor, but it doesn&#8217;t yet do animation or interactivity).</p>
<p>Eighteen million documents.  That&#8217;s a lot of files.  So, given that, why  is it so hard to find SVG content?</p>
<p>Maybe because the most popular search engine in the world, Google, doesn&#8217;t index SVG.</p>
<h3>Indexing SVG</h3>
<p>A long time ago, back in 2002, I made a <a title="Discussion of SVG text search and translation" href="http://schepers.cc/svgaccessibility.html">page</a> discussing my experiments with text search and translation.  The results were not very encouraging, but I reckoned it was just a matter of time.  I optimistically wrote to Google to encourage them to enable text search and translation of SVG files.</p>
<p>8 years down the line, things don&#8217;t seem to have changed much on that front.</p>
<p>To be fair, many SVG files don&#8217;t contain any text at all, not even a &lt;title&gt; element, so indexing them might not yield much.  But many other files do have at least a title, and SVG infographics and webapps usually have at least labels that might be meaningful as search terms.  Often SVG files are even text-heavy.</p>
<p>It&#8217;s not that Google doesn&#8217;t take note of the files&#8230; obviously, you can search for the filetype, or in the worst case, the specific file URL, and normally get back positive results.  But Google doesn&#8217;t seem to search the contents of the SVG files and present them in the relevant result set.  To test this, I tried searching for a few files that I knew to have indexable text content.</p>
<p>As an example, I looked for some SVG files on my little (long out-of-date) SVG promotion site, SVG-Whiz.com.  First, I searched for a file I knew to have a cogent block of text, my explanation of the distinctions between &#8216;display&#8217;, &#8216;visibility&#8217;, and &#8216;opacity&#8217;, called <a href="http://svg-whiz.com/svg/HideShow.svg">HideShow.svg</a>:  </p>
<p><object type="image/svg+xml" width="360" height="400" data="http://svg-whiz.com/svg/HideShow.svg">Please use a modern browser.</object></p>
<p>This file has been hosted on my site since 2003, I&#8217;ve gotten several positive comments about it, and a <a href="http://www.google.com/search?q=http%3A%2F%2Fsvg-whiz.com%2Fsvg%2FHideShow.svg">direct search for that file URL</a> turns up a few hits linking to it, so it&#8217;s seems like a reasonable candidate for indexing.  But what are the results of my in-site <a href="http://www.google.com/search?q=site%3Asvg-whiz.com%20opacity">Google search for the word &#8216;opacity&#8217;</a>?  Okay, that just turned up the explanation page linking to the SVG file in question.  Fair enough, maybe Google doesn&#8217;t treat SVG as a &#8220;document&#8221; file, only as an image.  So, how about an <a href="http://www.google.com/images?q=site%3Asvg-whiz.com%20opacity">image search for the same term</a>?  Nada.  So, maybe Google doesn&#8217;t consider SVG to be either a &#8220;document&#8221; nor an &#8220;image&#8221;&#8230; let&#8217;s <a href="http://www.google.com/search?q=site%3Asvg-whiz.com+opacity+filetype%3Asvg">search for the word &#8216;opacity&#8217; in the site &#8216;svg-whiz.com&#8217; with the filetype &#8216;svg&#8217;</a>.  As specific as that is, at the time of writing, I got not a single resulting hit.</p>
<p>Google can find the files&#8230; why doesn&#8217;t it do something with them?</p>
<h3>Comparison of File Extension Frequency</h3>
<p>So, what criteria does Google use to decide which file types it is going to index?</p>
<p>The <a title="Google's Filetype FAQ" href="http://www.google.com/help/faq_filetypes.html">Google FAQ on search filetypes</a> lists 23 file extensions that it indexes, and says:</p>
<blockquote><p><span style="line-height: 28.5px;">There are 13 main file types searched by Google in              addition to standard web formatted documents in HTML. The most common              formats are PDF, PostScript, Microsoft Office formats [...] </span><span style="line-height: 28.5px;">Google is also scouring the Web for additional file            types that are very rare. You may see them pop up in your results from            time to time.</span><span style="line-height: 28.5px;"> [...] </span><span style="line-height: 28.5px;">PDF formatted files are the most popular after HTML files.            PostScript and Microsoft Word files are also fairly common. The other            file types are relatively uncommon by comparison. </span></p></blockquote>
<p>So, I took the liberty of conducting my own survey of the relative frequency of various filetypes, as collected by Google itself, by using the <span style="line-height: 28.5px;">&#8220;filetype:extension&#8221;</span> query term. I&#8217;m not totally convinced this is at all an accurate means to collect and analyze the data, but it&#8217;s what I had at hand.</p>
<p>I put together a table that compares the different file types that Google explicitly mentions.  (I thought about representing the data as an SVG barchart, but I was afraid it wouldn&#8217;t be indexed&#8230; just kidding, the sheer volume of HTML files would make every other bar just a blip.)</p>
<p>I also threw in some other filetypes of interest, including some with functional similarity to SVG, such as Illustrator, PhotoShop, and Silverlight.  I expected non-Web filetypes such as Illustrator&#8217;s &#8220;*.ai&#8221; to be disproportionately underrepresentated in the results compared to their actual usage, and that was indeed borne out; it&#8217;s hard to know what percentage of SVG files are intended for and presented on the Web (I&#8217;ve spoken to many Inkscape users who only use SVG for print or local hard-drive, which surprised me), but I would guess that it is far, far more heavily tilted toward Web usage&#8230; but I still thought it would be interesting to compare.</p>
<p>What did surprise me was how &#8220;*.svg&#8221; compared to such ubiquitous file extensions as &#8220;*.txt&#8221;, and those for Excel, PowerPoint, and the venerable PostScript.  To be frank, the results make me question my methodology, or perhaps the accuracy of Google&#8217;s reporting.</p>
<table style="text-align:right; background-color:#A2953A; border:none; border-collapse:collapse; border-spacing:0px;" border="0" cellpadding="2px">
<tbody>
<tr style="background-color:#414602; color:#FFFFE3; border-collapse:separate;">
<th style="text-align:center;">File Type</th>
<th style="text-align:center; border-left:#FFFFE3 2px solid;">File Extension</th>
<th style="text-align:center; border-left:#FFFFE3 2px solid;">Number of Results</th>
<th style="text-align:center; border-left:#FFFFE3 2px solid;">Introduction</th>
</tr>
<tr style="background-color:#7A7822; border-top:#FFFFE3 5px solid;">
<th style="text-align:left; vertical-align:top;" rowspan="5">HyperText Markup Language</th>
<td style="color:#7A7822;">total</td>
<td><strong>16,574,700,000</strong></td>
<td>1991</td>
</tr>
<tr>
<td>html</td>
<td>8,180,000,000</td>
<td></td>
</tr>
<tr>
<td>php</td>
<td>7,010,000,000</td>
<td></td>
</tr>
<tr>
<td>asp</td>
<td>1,370,000,000</td>
<td></td>
</tr>
<tr>
<td>xhtml</td>
<td>14,700,000</td>
<td></td>
</tr>
<tr style="background-color:#7A7822; border-top:#FFFFE3 5px solid;">
<th style="text-align:left; vertical-align:top;">Adobe Portable Document Format</th>
<td>pdf</td>
<td><strong>281,000,000</strong></td>
<td>1993</td>
</tr>
<tr style="background-color:#7A7822; border-top:#FFFFE3 5px solid;">
<th style="text-align:left; vertical-align:top;" rowspan="3">Shockwave Flash</th>
<td style="color:#7A7822;">total</td>
<td><strong>87,923,300</strong></td>
<td>1996</td>
</tr>
<tr>
<td>swf</td>
<td>87,900,000</td>
<td></td>
</tr>
<tr>
<td>fla</td>
<td>23,300</td>
<td></td>
</tr>
<tr style="background-color:#7A7822; border-top:#FFFFE3 5px solid;">
<th style="text-align:left; vertical-align:top;">Microsoft Word</th>
<td>doc</td>
<td><strong>58,500,000</strong></td>
<td>1983</td>
</tr>
<tr style="background-color:#7A7822; border-top:#FFFFE3 5px solid;">
<th style="text-align:left; vertical-align:top;" rowspan="3">Text</th>
<td style="color:#7A7822;">total</td>
<td><strong>32,757,000</strong></td>
<td>1982</td>
</tr>
<tr>
<td>txt</td>
<td>32,600,000</td>
<td></td>
</tr>
<tr>
<td>ans</td>
<td>157,000</td>
<td></td>
</tr>
<tr style="background-color:#7A7822; border-top:#FFFFE3 5px solid;">
<th style="text-align:left; vertical-align:top;" rowspan="3">Scalable Vector Graphics</th>
<td style="color:#7A7822;">total</td>
<td><strong>18,165,500</strong></td>
<td>1999</td>
</tr>
<tr>
<td>svg</td>
<td>18,100,000</td>
<td></td>
</tr>
<tr>
<td>svgz</td>
<td>65,500</td>
<td></td>
</tr>
<tr style="background-color:#7A7822; border-top:#FFFFE3 5px solid;">
<th style="text-align:left; vertical-align:top;">Microsoft Excel</th>
<td>xls</td>
<td><strong>12,500,000</strong></td>
<td>1982</td>
</tr>
<tr style="background-color:#7A7822; border-top:#FFFFE3 5px solid;">
<th style="text-align:left; vertical-align:top;">Microsoft PowerPoint</th>
<td>ppt</td>
<td><strong>7,790,000</strong></td>
<td>1984</td>
</tr>
<tr style="background-color:#7A7822; border-top:#FFFFE3 5px solid;">
<th style="text-align:left; vertical-align:top;">Rich Text Format</th>
<td>rtf</td>
<td><strong>5,130,000</strong></td>
<td>1987</td>
</tr>
<tr style="background-color:#7A7822; border-top:#FFFFE3 5px solid;">
<th style="text-align:left; vertical-align:top;">Adobe PostScript</th>
<td>ps</td>
<td><strong>2,440,000</strong></td>
<td>1982</td>
</tr>
<tr style="background-color:#7A7822; border-top:#FFFFE3 5px solid;">
<th style="text-align:left; vertical-align:top;">Adobe Illustrator</th>
<td>ai</td>
<td><strong>135,000</strong></td>
<td>1986</td>
</tr>
<tr style="background-color:#7A7822; border-top:#FFFFE3 5px solid;">
<th style="text-align:left; vertical-align:top;">OpenOffice.org</th>
<td>odt</td>
<td><strong>135,000</strong></td>
<td>1999</td>
</tr>
<tr style="background-color:#7A7822; border-top:#FFFFE3 5px solid;">
<th style="text-align:left; vertical-align:top;">MacWrite</th>
<td>mw</td>
<td><strong>35,600</strong></td>
<td>1984</td>
</tr>
<tr style="background-color:#7A7822; border-top:#FFFFE3 5px solid;">
<th style="text-align:left; vertical-align:top;">Adobe PhotoShop</th>
<td>psd</td>
<td><strong>21,800</strong></td>
<td>1988</td>
</tr>
<tr style="background-color:#7A7822; border-top:#FFFFE3 5px solid;">
<th style="text-align:left; vertical-align:top;" rowspan="3">Silverlight</th>
<td style="color:#7A7822;">total</td>
<td><strong>8,493</strong></td>
<td>2003</td>
</tr>
<tr>
<td>xaml</td>
<td>8,180</td>
<td></td>
</tr>
<tr>
<td>xap</td>
<td>313</td>
<td></td>
</tr>
<tr style="background-color:#7A7822; border-top:#FFFFE3 5px solid;">
<th style="text-align:left; vertical-align:top;">CorelDRAW</th>
<td>cdr</td>
<td><strong>8,310</strong></td>
<td>1989</td>
</tr>
<tr style="background-color:#7A7822; border-top:#FFFFE3 5px solid;">
<th style="text-align:left; vertical-align:top;" rowspan="4">Microsoft Works</th>
<td style="color:#7A7822;">total</td>
<td><strong>2,266</strong></td>
<td>1987</td>
</tr>
<tr>
<td>wks</td>
<td>1,190</td>
<td></td>
</tr>
<tr>
<td>wps</td>
<td>801</td>
<td></td>
</tr>
<tr>
<td>wdb</td>
<td>275</td>
<td></td>
</tr>
<tr style="background-color:#7A7822; border-top:#FFFFE3 5px solid;">
<th style="text-align:left; vertical-align:top;" rowspan="9">Lotus 1-2-3</th>
<td style="color:#7A7822;">total</td>
<td><strong>1,981</strong></td>
<td>1983</td>
</tr>
<tr>
<td>wks</td>
<td>1,190</td>
<td></td>
</tr>
<tr>
<td>wk1</td>
<td>571</td>
<td></td>
</tr>
<tr>
<td>wki</td>
<td>89</td>
<td></td>
</tr>
<tr>
<td>wk3</td>
<td>47</td>
<td></td>
</tr>
<tr>
<td>wk4</td>
<td>41</td>
<td></td>
</tr>
<tr>
<td>wku</td>
<td>33</td>
<td></td>
</tr>
<tr>
<td>wk5</td>
<td>6</td>
<td></td>
</tr>
<tr>
<td>wk2</td>
<td>4</td>
<td></td>
</tr>
<tr style="background-color:#7A7822; border-top:#FFFFE3 5px solid;">
<th style="text-align:left; vertical-align:top;">Microsoft Write</th>
<td>wri</td>
<td><strong>1,200</strong></td>
<td>1985</td>
</tr>
<tr style="background-color:#7A7822; border-top:#FFFFE3 5px solid;">
<th style="text-align:left; vertical-align:top;">Lotus WordPro</th>
<td>lwp</td>
<td><strong>148</strong></td>
<td>1995</td>
</tr>
<tr style="background-color:#7A7822; border-top:#FFFFE3 5px solid;">
<th style="text-align:left; vertical-align:top;">All Web Content</th>
<td></td>
<td><strong>17,081,255,598</strong></td>
<td>1989</td>
</tr>
</tbody>
</table>
<p><strong>Caveat:</strong> I originally compiled this information a few months ago, and when rechecking it for accuracy, I got a surprising result.  Normally, the <a title="Google search for SVG files" href="http://www.google.com/search?q=filetype:svg">Google search for filetype:svg</a> returned 18,100,000 hits, but late one night, it returned only 2,000,000 hits; now, my most recent check showed around 4,300,000 hits.  Jumping around in the results for an explanation, I noticed that there is a lot of duplication of Wikipedia content, and since Wikipedia uses SVG, that might account for some discrepancy.  One possibility is that  the lower figure represents 2 million unique documents, which are duplicated in a lot of places; the same should be said of any HTML content, and probably to a lesser extent of Flash content.  I don&#8217;t know if this is the right conclusion, but it would be an interesting data point.  Even with the much more modest figure of 2 million documents, I still think that represents an impressive body of work, particularly in light of the fact that SVG documents are normally authored individually, not through forum or blog software, or exporting or reformatting of email and text content as HTML.</p>
<h3>Conclusions</h3>
<p>I don&#8217;t think this is some grand conspiracy by Google to suppress SVG.  Simple neglect is much more plausible.  They don&#8217;t seem to see the value in indexing SVG.  But the end result is the same: SVG seems to be statistically underrepresented in terms of access through Google searches, and thus, it is harder to find SVG content. </p>
<p>Relying on the results of a search engine that doesn&#8217;t index SVG, to draw conclusions about how many people are using SVG is not statistically sound.   This is a bit like conducting a phone survey of English speakers in China, and concluding that nobody speaks with a Southern US accent.  I reckon y&#8217;all might could see the problem with that methodology if you lived here in North Carolina.</p>
<p>SVG is at least as plentiful on the Web, by Google&#8217;s own reckoning, as most other file types that Google does index. Search engines, Google included, should index SVG files. They should read the text inside the file, and if the file is referenced in an HTML page, they should associate those keywords with the SVG file, just as they do with raster images. SVG files should display in image searches, as well. Here&#8217;s a list of the kind of useful content that can be gleaned from most SVGs:</p>
<ul>
<li><strong>file name: </strong>while pretty primative, many files give some clue as to their contents in their name</li>
<li><strong>text elements</strong><strong>: </strong>there are several elements in SVG that contain text to be rendered to the screen, including &lt;text&gt;, &lt;tspan&gt;, &lt;textPath&gt;, and &lt;textArea&gt;, and the content should be indexed as if it were text in any other format</li>
<li><strong>embedded HTML: </strong>HTML (and other markup) can be embedded inline in SVG, and search engines should look for that and index it as they would standalone HTML content</li>
<li><strong>links: </strong>Google, and probably most other modern search engines, give weight to files that are linked from other files, and files referenced from SVG content should benefit in the same way; the @xlink:title and @rel can help define the relationship between the files</li>
<li><strong>descriptive elements: </strong>like HTML, SVG has a &lt;title&gt; element that doesn&#8217;t display, but adds to the information about its parent file or element, and SVG also has a &lt;desc&gt; element for a longer description</li>
<li><strong>metadata: </strong>SVG can contain RDF, RDFa, microformats, and ARIA markup, which search engines are starting to pick up on these days; these metadata can reveala lot about a file, from its license information to structured content (like calendars or dates or contact info) to intent (such as ARIA roles, which will soon be expanded to include things like different chart types)</li>
</ul>
<p>And the SVG Working Group would be happy to work with any search engine developers to make improvements to SVG 2 to help make indexing SVG content easier or more fruitful.</p>
<p>I&#8217;m not trying to pick on Google here (though I do note that a <a href="http://www.bing.com/search?q=svg+opacity+svg-whiz.com">Bing search for &#8216;svg opacity svg-whiz.com&#8217;</a> listed the SVG file as the first hit), I&#8217;m just noting a discrepancy and an opportunity for improving the experience that people have on the Web with regards to SVG.  At the very least, SVG should be recognized by Google as a legitimate file type, rather than a formata non grata.</p>
<h4>Update</h4>
<p>Rob Russell delivered great news to us in his SVG Open keynote.  As of August 31, 2010, <a href="http://googlewebmastercentral.blogspot.com/2010/08/google-now-indexes-svg.html?utm_source=feedburner&#038;utm_medium=twitter&#038;utm_campaign=Feed%3A+blogspot%2FamDG+%28Official+Google+Webmaster+Central+Blog%29">Google now indexes SVG</a> and delivers it in some search results.   Kudos to Google for stepping up!  I&#8217;m very pleased&#8230; solid results only 6 weeks later.  (I guess I should thank Slashdot, too.)</p>
]]></content:encoded>
			<wfw:commentRss>http://schepers.cc/formata-non-grata/feed</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>Web Audio Goes to Eleven</title>
		<link>http://schepers.cc/web-audio-goes-to-eleven</link>
		<comments>http://schepers.cc/web-audio-goes-to-eleven#comments</comments>
		<pubDate>Fri, 14 May 2010 18:58:42 +0000</pubDate>
		<dc:creator>Schepers</dc:creator>
				<category><![CDATA[Audio]]></category>
		<category><![CDATA[CDF]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[SVG]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[W3C]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://schepers.cc/?p=212</guid>
		<description><![CDATA[<br/>I&#8217;m really excited about W3C&#8217;s new public Audio Incubator Group, just launched today, and open for collaborators, innovators, and instigators. Go take a look for yourself, and see if you can contribute. To celebrate the occasion, here&#8217;s a simple example of an experimental audio inteface, in the world&#8217;s first (and worst) audio synthesizer in SVG [...]]]></description>
			<content:encoded><![CDATA[<br/><p>I&#8217;m really excited about W3C&#8217;s new public <a href="http://www.w3.org/2005/Incubator/audio/">Audio Incubator Group</a>, just launched today, and open for collaborators, innovators, and instigators.  Go take a look for yourself, and see if you can contribute.</p>
<p>To celebrate the occasion, here&#8217;s a simple example of an experimental audio inteface, in the world&#8217;s first (and worst) audio synthesizer in SVG (you&#8217;ll need a <a href="https://wiki.mozilla.org/Audio_Data_API#Obtaining_Code_and_Builds">special Minefield build</a> to use it).  Just click on the keyboard&#8230; it&#8217;s pretty rough still, but it shows some of the potential:</p>
<p><iframe src="http://schepers.cc/svg/keyboard.svg" class="aligncenter" scrolling="no" frameborder="0" width="478" height="190">Please use FF1.5+, Opera 9+, WebKit/Safari3.0+, or IE9+</iframe><br />
<em>(<a href="http://schepers.cc/svg/keyboard.svg">standalone SVG file</a>)</em></p>
<p>For some background, read on after this break&#8230;<br />
<span id="more-212"></span></p>
<h3>Background</h3>
<p>Years ago, I was one of several SVG developers interested in doing for audio what SVG did for graphics, and we <a href="http://tech.groups.yahoo.com/group/svg-developers/message/28154">talked</a> a bit about a format we called  <a href="http://uk.groups.yahoo.com/group/SynthML/">SynthML</a>.  The old Adobe SVG viewer included an audio element for MP3 playback, and I found it really useful for adding subtle sounds for button mouseovers, clicks, and other UI effects, so the idea of programmatic control of music on the Web had intrigued me for some time (anyone remember Thomas Dolby&#8217;s Beatnik?), for enhancing user interfaces, adding ambient background music, and providing full fledged music webapps. The SynthML effort fizzled out, and while there are some interesting music markup languages (most notably <a href="http://www.musicxml.org/xml.html">MusicXML</a>, which is more like the MathML of music), there hasn&#8217;t been much traction beyond simple recording playback.</p>
<p>That&#8217;s why I was so psyched when I saw what <a href="http://alistairgmacdonald.com/">Alistair MacDonald</a>, <a href="http://vocamus.net/dave/?cat=25">David Humphrey</a>, <a href="http://twitter.com/corban">Corban Brook</a>, and a few others were up to while attending a  Processing.js community event at <a href="http://loft.bocoup.com/">Bocoup</a>.  David hacked up a <a href="https://wiki.mozilla.org/Audio_Data_API#Obtaining_Code_and_Builds">special build</a> of Gecko to add script access to the raw audio stream of the HTML5 &lt;audio&gt; element, and Al, Corban, and friends were building <a href="http://weblog.bocoup.com/web-audio-all-aboard">cool demos</a> on top of it.</p>
<p>I immediately knew I wanted to see this as a part of the native functionality of the Web platform, across browsers.  In some ways, it&#8217;s the last major missing piece from the open Web&#8230; the ability to view source and hack sound, the last commonly digitizable sensorium. I also knew that I wanted the use cases and requirements to come from the larger community, the musicians and UI designers and developers who will ultimately be the ones using this functionality to sound out the depths of what&#8217;s possible on the Web (okay, I&#8217;m corny).  So, I talked with Corban, David, and Al, and we agreed that a public discussion forum would be the best way to connect with this community, to get them talking and experimenting and building and sharing.</p>
<p>Chris Blizzard of Mozilla was there too, co-sponsoring the event, and he was extremely supportive of getting this work started at W3C.  I wrote up a <a href="http://www.w3.org/2010/04/audio/audio-incubator-charter.html">charter</a> for a public incubator group, and started knocking on doors of the browser vendors, our other members, and the wider community who might be stakeholders, to drum up interest.  Pretty quickly, I got support from folks at the University of Rio (PUC-Rio), BBC, and Google; currently, a W3C Incubator Group takes a minimum of three W3C members to kick it off, though once it&#8217;s started, anyone can join.  With that nicety taken care of, W3C management approved the charter, and the new W3C Audio Incubator Group (or Audio XG) was launched today!</p>
<h3>Joining the Audio XG</h3>
<p>I invite anyone interested in audio, music, speech synthesis, games, or other related topics to get involved, <a href="http://www.w3.org/2005/Incubator/audio/wiki/Join_the_Audio_Incubator">join the Audio XG</a>, and start shaping the future of Web audio on the mailing list, and chat on the <a href="irc://irc.w3.org:6665#audio">#audio</a> IRC channel (irc.w3.org, port 6665, channel #audio).  Incubator participation is free and open to anyone who wants to help out.</p>
<h3>About the SVG Synth</h3>
<p>My SVG synthesizer is a true product of the Web.  I know next to nothing about music&#8230; I can&#8217;t play an instrument, can&#8217;t read music, don&#8217;t know music theory&#8230; I love music, but I&#8217;m a consumer, not a creator.  I&#8217;d love to change that, when I have time, but I&#8217;ll settle for now for enabling others.</p>
<p>So, when I decided to make something with the audio API, naturally my first thought was to do something I didn&#8217;t know how to do, for which I&#8217;m totally unqualified: create a synthesizer in SVG.</p>
<p>I started with the HTML example from the documentation for the <a href="https://wiki.mozilla.org/Audio_Data_API">experimental audio API</a> on the Mozilla wiki, and converted it to SVG (with a few missteps along the way).  As it turns out, the HTML5 audio interface is exposed in Gecko (the Firefox engine) even when there is no HTML content.  This was good news for me.  It made it even easier to programmatically create sound with it.  I suspect that this is something that lies outside any current specification, but it should be codified somewhere.</p>
<p>Next, I looked for a piano keyboard in SVG; I found a few on <a href="http://upload.wikimedia.org/wikipedia/commons/c/c0/Klaviatur-3-en.svg">Wikimedia Commons</a>, but they were not quite what I wanted (and in typical Inkscape fashion, were a little bloated), so ultimately I just made my own, which was trivial to do.</p>
<p>Next, I had to understand which notes each key should sound.  So I read a <a href="http://www.musictheory.halifax.ns.ca/3keyboard.html">lesson on keyboard basics</a>, which sufficed for my purpose.</p>
<p>Then I had to figure out what the frequency of each note is in Hertz (Hz), which is what the audio API understands.  It was no surprise that someone had published just such a <a href="http://www.phy.mtu.edu/~suits/notefreqs.html">table corresponding notes to frequency</a>, with the companion <a href="http://www.phy.mtu.edu/~suits/NoteFreqCalcs.html">equations for deriving them</a>.  </p>
<p>To put the pieces together, I took the simplest possible approach: I handcoded the keyboard (I could have instantiated it with script, because it&#8217;s very deterministic, but I favor declarative markup that can be tweaked in an authoring tool); I assigned an id to each key based on the note (C4, Af0-Bb0, etc., where &#8220;f&#8221;==&#8221;flat&#8221; and &#8220;b&#8221;==&#8221;sharp&#8221;, and the number denotes the octave); I then created an associative array with the note-id as the index and the frequency as the value, so I could look it up with the key&#8217;s id; then it was just a matter of sending the frequency to the script from the HTML example, and adding a duration timer.</p>
<p>Finally, just as a decorative flourish, I found a partial musical staff with a treble clef and beamed eighth-note, <a href="http://upload.wikimedia.org/wikipedia/commons/a/ac/Musical_notes.svg">in SVG, of course</a>, and tweaked it to my liking.</p>
<p>My tools? A Web browser with the audio API enabled (libre source), a search engine, and a text editor.</p>
<p>Voilà!  From knowing almost nothing about formal music (I&#8217;d never even heard the term &#8220;middle C&#8221; before), I created a simple synthesizer, and learned a bit about music along the way.  That&#8217;s the power of the open Web.  That&#8217;s why I&#8217;m so pumped up about this new focus on audio.  This one goes to 11.</p>
]]></content:encoded>
			<wfw:commentRss>http://schepers.cc/web-audio-goes-to-eleven/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stumbling Towards a Graphical Workflow</title>
		<link>http://schepers.cc/stumbling-towards-a-graphical-workflow</link>
		<comments>http://schepers.cc/stumbling-towards-a-graphical-workflow#comments</comments>
		<pubDate>Mon, 08 Mar 2010 10:10:34 +0000</pubDate>
		<dc:creator>Schepers</dc:creator>
				<category><![CDATA[Authoring Tools]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[SVG]]></category>
		<category><![CDATA[SVG Basics]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[W3C]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://schepers.cc/?p=190</guid>
		<description><![CDATA[<br/>I&#8217;m working with a professional designer, Michael, on some graphics for my upcoming MIX presentation.  I&#8217;ve worked with designers before on various projects, some SVG, some traditional Web design, but this is my first time working on an SVG project with someone who never used SVG before, and it&#8217;s been an interesting experience, which I [...]]]></description>
			<content:encoded><![CDATA[<br/><p>I&#8217;m working with a professional designer, Michael, on some graphics for my upcoming <a title="SVG session at Microsoft MIX conference" href="http://live.visitmix.com/MIX10/Sessions/EX30">MIX presentation</a>.  I&#8217;ve worked with designers before on various projects, some SVG, some traditional Web design, but this is my first time working on an SVG project with someone who never used SVG before, and it&#8217;s been an interesting experience, which I thought I&#8217;d jot down for anyone interested.</p>
<p>Both of us have been busy with other projects, and since we are in different places (me in Chapel Hill NC, him in Atlanta GA), we have only gotten to touch base a few times.  Michael has delivered some first drafts of the graphics, which look lovely, and I decided to dig into the underlying code, confident that I could trim down the file size and thus help browser performance.</p>
<p>My personal graphical editor of choice is Inkscape, which is a fine tool for all its warts (though it&#8217;s a little painful on Mac, where it is hosted as an X-11 application); typically, though, I create SVG either programmatically with a script or manually with a text editor (yes, I know that&#8217;s crazy&#8230; but it <a title="A sad example of hand-coded SVG art" href="http://svg-whiz.com/svg/shinydonkey/shinyDonkey.svg">can be done</a>).  Michael, being a professional designer, uses Adobe Illustrator, and I am keen to have him use the tools he is most comfortable with.  Since I want SVG to be used by mainstream designers, I want to understand how their tools work and what their workflow is like.</p>
<p>So, in order to make sure that we can roundtrip the files as seamlessly as possible, while still leveraging the features of SVG, I set about today to establish a workflow with Illustrator, TextMate (my go-to text editor, with a custom SVG code template bundle), Firefox, and its native debugger extension Firebug (with its handy &#8220;Inspect Element&#8221; context-menu selection).  My goal: to make reusable icons out of some of the graphical assets in the larger image, to be referenced by SVG&#8217;s &lt;use&gt; element.<span id="more-190"></span></p>
<h3>The &lt;use&gt; Element</h3>
<p>Some earlier graphical languages, especially special-use ones such as CAD languages for engineering, architecture, or mapping, included a native symbol library.  These would normally include a variety of arrowheads, iconic symbols, line styles (dotted, dashed, etc.), and other graphical primitives.  The problem with this idea is that such symbol libraries were by necessity limited in the number of symbols, and usually only had one or two styles for each basic symbol. Not very extensible.  SVG took a different approach.</p>
<p>SVG has the ability to &#8220;clone&#8221; an image, to reposition or resize it, and to change some of its styling.  This works on a shape or collection of shapes, whether the image is defined in the same document, or in an external SVG file.  The mechanism to do this is the &lt;use&gt; element, and it looks like this:</p>
<blockquote>
<pre>&lt;use xlink:href="#myImageId"
     x="100" y="300"
     transform="scale(1.5)"
     fill="cornflowerblue"/&gt;</pre>
</blockquote>
<p>Translated into English, this code says,</p>
<blockquote><p>Find the image with the <em>id</em> of &#8220;myImageId&#8221;, and copy it.  Move it 100 pixels to the right, and 300 pixels down.  Increase its size by half again.  Oh, and if it doesn&#8217;t already have a color, make it blue. Thanks.</p></blockquote>
<p>(That final &#8220;/&#8221; is the part that says &#8220;thanks&#8221;, a quaint courtesy missing from HTML5.  SVG was specified in a gentler time.)</p>
<p>Thus, designers can provide their own symbols, in the style appropriate to the task at hand.  There are several good SVG clipart libraries that allow SVG authors to share their symbols and simple reusable images.</p>
<p>You can see that if you draw an image of a balloon, with several paths (the bubble, the knot, the string, and maybe a highlighting accent) and some special graphical effects (a gradient, and perhaps a filter effect) all amounting to a dozen lines of code, and you want to reuse this balloon, you don&#8217;t want to redraw it each time; it would be a waste of effort, and result in a much larger file.  For print, this may not be as much of an issue, but for a Web-based format, it takes longer to download and uses more memory in the browser, resulting in poorer performance.  So, instead of rebuilding a score of balloons, or copying and changing the original image description, you can simply make one basic model, sans color, and reference that multiple times, with a different color and size.  It&#8217;s easier to do, and each extra balloon only increases the size of the file by a small amount, much smaller than adding dozens of duplicates.</p>
<p>To really take advantage of this feature takes a different way of thinking about the design.  A clever designer can even create several image components and recombine  them into composites with even more variation.  Of course, it&#8217;s not always appropriate for every project, but my current project has quite a few duplicate images.</p>
<p>This is a feature supported by every browser with native SVG (though not every one yet allows you to reference images in external documents).  So, it&#8217;s a safe and natural feature for an SVG authoring tool to utilize in its SVG output.</p>
<blockquote><p><strong>Best Practice:</strong> Make liberal use of &lt;use&gt;.</p></blockquote>
<h3>&lt;use&gt; It and Lose It</h3>
<p>Illustrator doesn&#8217;t support &lt;use&gt;.</p>
<p>Or rather, it does recognize it, and render it&#8230; but it promptly converts any instances of the &lt;use&gt; element to simple verbose copies of the referenced image.  I could not find any way to create an instance of &lt;use&gt;.</p>
<p>Also, when creating gradients, Illustrator seems to get overly specific about the position and dimensions (width, height) of the gradient, needlessly yoking them to a specific element at a particular location and of a particular size.  SVG allows you to define a gradient once and reuse it among several shapes, decreasing the number of gradients; Illustrator should make better use of this feature, and so should Inkscape.</p>
<p>This is not a tool created with the Web in mind.</p>
<p>Because of this quirk, my current file size is about 6 or more times what it needs to be.  Let&#8217;s see how we can work around that.</p>
<h3>Symbolic Gestures</h3>
<p>I spent quite a bit of time &#8211;hours, truth to tell, because I&#8217;m an Illustrator newbie&#8211; isolating individual images (trees, benches, etc.) that were used through the graphic as a whole.</p>
<p>When I make &#8220;symbols&#8221; (for lack of a better word), I like to find their positioning anchor &#8211;that is, the point at which they are most usefully positioned&#8211; and set that to the {0,0} point, so there are no unpleasant surprises when placing the symbol.  For most symbols, this is the centerpoint of the symbol; if I have an icon (a badge, a logo), I will position it smack dab at the point in my graphic that it should be applied, relative to other images.  For other symbols, it is one of the extremities, where it will meet up with another shape&#8230; for a tree this would be the bottom of the trunk where it sprouts from the ground, for an arrowhead it would be the base where it it attaches to a line.  I try to pick the most intuitive anchor for each symbol.</p>
<p>When you drag a shape to a new location, as I did for creating anchors, Illustrator converts the path  or attribute values to their new coordinates, rather than simply  applying a transformation.  This is something that Inkscape gets wrong  (at least, last time I checked).  Nested transforms are harder for  developers to work with than simple coordinates.  So, kudos to  Illustrator on this one.</p>
<p>Each symbol is best enclosed within a group&#8230; in SVG, this is a &lt;g&gt; element (SVG also has a &lt;symbol&gt; element, but in practice, I don&#8217;t think it&#8217;s worth much).  Grouping allows the designer to collect all the constituent parts of the image together for greater portability.</p>
<p>When a designer works, if they are anything like me, they tweak a bit here and there, sketching out the rough shape, working on another part of the big picture, then focus on adding details.  A problem arises for a developer who has to subsequently dig into the resulting code&#8230; elements are added to the document in the order they are created, so a bunch of shapes that appear to be one symbol might be scattered throughout the document, and might even be in different layers.</p>
<blockquote><p><strong>Best Practice:</strong> Group early, group often.  Create  graphical objects, and think about graphical / document structure.  Your developer co-workers will thank you.</p></blockquote>
<p>Being the non-designer developer I am, my first instinct was to group the elements in a text editor, and as a clumsy first attempt to find the different elements, I used Firebug to inspect each element to find its id or unique data I could use in a text search in the text editor, but the different parts were too scattered for this to be effective; pretty quickly, I turned to Illustrator myself to do the grouping visually.</p>
<p>The process for converting these graphics into symbols was made much clumsier by the selection mechanism of Illustrator.  When things are grouped in Illustrator, it logically selects all the bits of that grouped image.  The problem is that it also does this with layers, as well as groups; you can &#8220;drill down&#8221; from a layer into an individual group, but when you are first trying to select a set of images that aren&#8217;t already grouped, this can be twiddly and frustrating.  Illustrator also defines far too many nested groups, decreasing their usefulness and creating markup cruft that makes later programming harder. Using the selection marquee (the draggy box), you can more easily select the constituent parts of the image, but be careful of any background elements.</p>
<blockquote><p><strong>Best Practice:</strong> When creating symbols, select the elements you want as part of that symbol, either with the selection marquee or with shift+click.  Right-click on the selection, and choose &#8220;Group&#8221; to group the elements, which should also group any gradients, filters, clipping paths, etc. that the shapes use; in the Layers dialog, you will see the graphics collected under a new group labeled &#8220;&lt;group&gt;&#8221;; double-click this, and give it a meaningful name.  (Note: you might need to right-click again and choose &#8220;Isolate Selected Group&#8221; in order to the collect the gradients and other graphical effects into the group; these are not shown in the Layers dialog, so I wasn&#8217;t sure at what point they are included in the group.)</p></blockquote>
<h3>&#8220;Let Me Tell You What I Think You Mean&#8221;</h3>
<p>As I isolated each image, I deleted extraneous shapes that weren&#8217;t part of any symbol.  I made each symbol into its own file, just to keep them tidy.  Each symbol looked great by itself, but when I finally recomposed all the symbols together, the colors were all wrong!  A little digging revealed the problem&#8230; Illustrator changes the ids of the <em>&#8220;paint servers&#8221;</em> &#8211;referenceable graphical effects like  gradients and filters&#8211; as you delete other shapes.  So, when I recombined the symbols into a single file, some of the gradient ids overlapped and defaulted to the first instance&#8230; which screwed up the colors.  This is a portability and maintenance nightmare.</p>
<p>Illustrator tried to be a little too clever here.  Like the way it unwinds &lt;use&gt; references and discards the &lt;use&gt; element, it doesn&#8217;t play well with a designer-developer roundtripping workflow.  I ran into many such cases where it discarded changes I had edited by hand.  I tried to resize the document dimensions in my text editor, but when I loaded it in Illustrator, made some changes, and saved it again, it scaled down my graphics (which I&#8217;d just explicitly scaled up) and changed the viewport to a much smaller set of dimensions.  Hey, Illustrator, if I wanted it that size, that&#8217;s the size I would have made it!  Finally, I gave up, and set the dimensions I wanted in a new file I created in Illustrator itself, and copy-pasted from one Illustrator window into the new document, which seems to have taken.  I don&#8217;t like programs which introduce inconsistency into a workflow.</p>
<p>What are you smirking about, Inkscape?  You pull the same kind of nonsense!</p>
<h3>Copy-Paste Error</h3>
<p>After all this tweaking, I ended up with more or less what I want to start with: a document with the dimensions I need, with a set of reusable symbols at the right scale.</p>
<p>But when I tested it out by selecting a symbol on the canvas, copying it, and pasting it in its new location, I was disappointed to find that Illustrator copied the parts of the symbol, but not the grouping&#8230; it just added the individual parts of the graphic directly in the target layer.</p>
<p><strong>FAIL! </strong></p>
<p>I messed around a bit more with the interface, and through luck, I stumbled on a different way of selecting the symbol.  By toggling a selection button for the group in the Layers dialog, and copying that (Ctrl/Cmd+C only&#8230; Illustrator doesn&#8217;t provide a right-click menu on items in the Layers dialog list), I could paste the group.</p>
<blockquote><p><strong>Best Practice:</strong> Copy and paste symbols from the Layers dialog to preserve their logical structure.</p></blockquote>
<p>This is a far cry from having a &lt;use&gt; element, but I plan to apply a post-processing step to the final document, replacing duplicates with &lt;use&gt; references.  Luckily, Illustrator didn&#8217;t give the pasted copy a completely random id,  but simply appended an incremented number to the original symbol id, so this should be fairly easy.</p>
<p>My next step is to turn the new document over to Michael, my long-suffering designer, and see if any of this makes sense to him, or if he will come to his senses and throttle me for imposing all this developer madness on him.</p>
<h3>To Be Continued&#8230;</h3>
<p>I recognize that my own inexperience with Illustrator is probably behind some of my missteps (the full extent of which I have shielded from you, dear reader).  On the other hand, a fresh pair of eyes can often spot flaws that could be eliminated where an experienced hand would simply repeat the same mistakes.</p>
<p>This project is far from over, and as I refine my workflow, I&#8217;ll report back what I discover.  Some of what I learn may inform future versions of SVG.  Other parts should be changes to the authoring tools.  Hopefully some of it will help help designers and developers work around issues in creating SVG with the tools they use today.</p>
]]></content:encoded>
			<wfw:commentRss>http://schepers.cc/stumbling-towards-a-graphical-workflow/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

