<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>11657</bug_id>
          
          <creation_ts>2011-01-04 04:22:10 +0000</creation_ts>
          <short_desc>More text and font control</short_desc>
          <delta_ts>2012-02-29 22:43:27 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>LC1 HTML Canvas 2D Context</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>NEEDSINFO</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#dom-context-2d-font</bug_file_loc>
          <status_whiteboard>canvas RFE</status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>cam</cc>
    
    <cc>ian</cc>
    
    <cc>jackalmage</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>43787</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-01-04 04:22:10 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html
Section: http://www.whatwg.org/specs/web-apps/current-work/complete.html#dom-context-2d-font

Comment:
My worry is that this doesn&apos;t cover all the different kinds of textual
transformations.  Yes, it does cover obliqueness and weight, it does not cover
letter spacing and other textual attributes that may be of some use to
developers.

Posted from: 66.169.241.62</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>43788</commentid>
    <comment_count>1</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2011-01-04 04:41:42 +0000</bug_when>
    <thetext>It seems to me that a reasonable solution to this is to allow the rendering of an arbitrary HTML element to the canvas.  I don&apos;t think you want to duplicate all of CSS&apos;s text functionality in the canvas 2D context itself.  You probably want to allow some size to be passed in when doing this (so that text could wrap), too.

And it would be pretty handy if you could also just pass in a string to be parsed:

  var ctx = ...;
  ctx.drawHTML(&quot;&lt;span style=&apos;letter-spacing: -0.1; font-weight: 100&apos;&gt;Well &lt;i&gt;hello&lt;/i&gt; there!&quot;, 100, 100, 500);

where the (100, 100) is the top-left corner of the area in which to lay out the CSS boxes, and 500 is the width.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44010</commentid>
    <comment_count>2</comment_count>
    <who name="Tab Atkins Jr.">jackalmage</who>
    <bug_when>2011-01-10 18:26:26 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; It seems to me that a reasonable solution to this is to allow the rendering of
&gt; an arbitrary HTML element to the canvas.  I don&apos;t think you want to duplicate
&gt; all of CSS&apos;s text functionality in the canvas 2D context itself.  You probably
&gt; want to allow some size to be passed in when doing this (so that text could
&gt; wrap), too.
&gt; 
&gt; And it would be pretty handy if you could also just pass in a string to be
&gt; parsed:
&gt; 
&gt;   var ctx = ...;
&gt;   ctx.drawHTML(&quot;&lt;span style=&apos;letter-spacing: -0.1; font-weight: 100&apos;&gt;Well
&gt; &lt;i&gt;hello&lt;/i&gt; there!&quot;, 100, 100, 500);
&gt; 
&gt; where the (100, 100) is the top-left corner of the area in which to lay out the
&gt; CSS boxes, and 500 is the width.

You&apos;d need a height as well (though a value that means &apos;auto&apos; would be useful for both).  Don&apos;t forget about vertical languages.  ^_^

Anyway, +1 on an idea in this direction.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44011</commentid>
    <comment_count>3</comment_count>
    <who name="Tab Atkins Jr.">jackalmage</who>
    <bug_when>2011-01-10 18:28:11 +0000</bug_when>
    <thetext>I should provide more than a +1.

Drawing arbitrary text into a canvas lets you do a lot of things, like render text with sub/superscripts, ruby, etc.  These require either structured rendering, like HTML+CSS would provide, or a lot more work to measure text widths and position things yourself.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44019</commentid>
    <comment_count>4</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2011-01-10 20:29:55 +0000</bug_when>
    <thetext>Yes, good point.  The width &amp; height arguments should be strings, which are parsed as CSS lengths.  They could be optional and default to &apos;auto&apos;.

Another thing to consider is how style resolution would work.  Would style rules in the document apply to the elements that are parsed from the argument?  Would properties be inherited from somewhere (the &lt;canvas&gt; element, maybe)?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44024</commentid>
    <comment_count>5</comment_count>
    <who name="Tab Atkins Jr.">jackalmage</who>
    <bug_when>2011-01-10 21:24:17 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; Yes, good point.  The width &amp; height arguments should be strings, which are
&gt; parsed as CSS lengths.  They could be optional and default to &apos;auto&apos;.

Strings or numbers.  Numbers would be canvas pixels, presumably (or maybe CSS px).


&gt; Another thing to consider is how style resolution would work.  Would style
&gt; rules in the document apply to the elements that are parsed from the argument? 
&gt; Would properties be inherited from somewhere (the &lt;canvas&gt; element, maybe)?

Ooh, didn&apos;t think of that.  Inheriting from the &lt;canvas&gt; is an interesting idea.  Either that, or no inheritance at all - all values are set to initial.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>45287</commentid>
    <comment_count>6</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-02-08 20:40:23 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Partially Accepted
Change Description: none yet
Rationale: More features for rendering text, and more features for rendering arbitrary markup, are things on the cards for a revision of the canvas API once the rest of the spec is more firmly implemented. We don&apos;t want to get too far ahead of the implementations.

As such, I&apos;ve marked this LATER, so that it doesn&apos;t drop off the radar.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52768</commentid>
    <comment_count>7</comment_count>
    <who name="Michael[tm] Smith">mike</who>
    <bug_when>2011-08-04 05:04:07 +0000</bug_when>
    <thetext>mass-move component to LC1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64764</commentid>
    <comment_count>8</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-02-29 21:35:25 +0000</bug_when>
    <thetext>This bug is a bit open-ended. It might be better to file separate bugs for specific things that you think we should offer control over.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64780</commentid>
    <comment_count>9</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-02-29 22:43:27 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Did Not Understand Request
Change Description: no spec change
Rationale: I&apos;m going to add the ability to draw text to a path, which gives you some more control. I&apos;m not sure what specifically else should be added; text spacing is the only other thing listed in this bug but you can fake that with just drawing each character at a time if you&apos;re willing to lose kerning information. (We might want to add kerning metrics to TextMetrics, file a separate bug if you want that.) In short, I&apos;m not really sure what to do here. See also comment 8.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>