HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
7038[Gecko] [Internet Explorer] [Opera] [Webkit] Make the width values usable in practice.2012-03-28 04:48
@@ -40701,21 +40701,22 @@ interface <dfn>CanvasGradient</dfn> {
 };
 
 interface <dfn>CanvasPattern</dfn> {
   // opaque object
   void <span title="dom-canvaspattern-setTransform">setTransform</span>(<span>SVGMatrix</span> transform);
 };
 
 interface <dfn>TextMetrics</dfn> {
   // x-direction
   readonly attribute double <span title="dom-textmetrics-width">width</span>; // advance width
-  readonly attribute double <span title="dom-textmetrics-actualBoundingBoxWidth">actualBoundingBoxWidth</span>;
+  readonly attribute double <span title="dom-textmetrics-actualBoundingBoxLeft">actualBoundingBoxLeft</span>;
+  readonly attribute double <span title="dom-textmetrics-actualBoundingBoxRight">actualBoundingBoxRight</span>;
 
   // y-direction
   readonly attribute double <span title="dom-textmetrics-fontBoundingBoxAscent">fontBoundingBoxAscent</span>;
   readonly attribute double <span title="dom-textmetrics-fontBoundingBoxDescent">fontBoundingBoxDescent</span>;
   readonly attribute double <span title="dom-textmetrics-actualBoundingBoxAscent">actualBoundingBoxAscent</span>;
   readonly attribute double <span title="dom-textmetrics-actualBoundingBoxDescent">actualBoundingBoxDescent</span>;
   readonly attribute double <span title="dom-textmetrics-emHeightAscent">emHeightAscent</span>;
   readonly attribute double <span title="dom-textmetrics-emHeightDescent">emHeightDescent</span>;
   readonly attribute double <span title="dom-textmetrics-hangingBaseline">hangingBaseline</span>;
   readonly attribute double <span title="dom-textmetrics-alphabeticBaseline">alphabeticBaseline</span>;
@@ -43648,21 +43649,22 @@ try {
 
    <dt><var title="">metrics</var> = <var title="">context</var> . <code title="dom-context-2d-measureText">measureText</code>(<var title="">text</var>)</dt>
 
    <dd>
 
     <p>Returns a <code>TextMetrics</code> object with the metrics of the given text in the current font.</p>
 
    </dd>
 
    <dt><var title="">metrics</var> . <code title="dom-textmetrics-width">width</code></dt>
-   <dt><var title="">metrics</var> . <code title="dom-textmetrics-actualBoundingBoxWidth">actualBoundingBoxWidth</code></dt>
+   <dt><var title="">metrics</var> . <code title="dom-textmetrics-actualBoundingBoxLeft">actualBoundingBoxLeft</code></dt>
+   <dt><var title="">metrics</var> . <code title="dom-textmetrics-actualBoundingBoxRight">actualBoundingBoxRight</code></dt>
    <dt><var title="">metrics</var> . <code title="dom-textmetrics-fontBoundingBoxAscent">fontBoundingBoxAscent</code></dt>
    <dt><var title="">metrics</var> . <code title="dom-textmetrics-fontBoundingBoxDescent">fontBoundingBoxDescent</code></dt>
    <dt><var title="">metrics</var> . <code title="dom-textmetrics-actualBoundingBoxAscent">actualBoundingBoxAscent</code></dt>
    <dt><var title="">metrics</var> . <code title="dom-textmetrics-actualBoundingBoxDescent">actualBoundingBoxDescent</code></dt>
    <dt><var title="">metrics</var> . <code title="dom-textmetrics-emHeightAscent">emHeightAscent</code></dt>
    <dt><var title="">metrics</var> . <code title="dom-textmetrics-emHeightDescent">emHeightDescent</code></dt>
    <dt><var title="">metrics</var> . <code title="dom-textmetrics-hangingBaseline">hangingBaseline</code></dt>
    <dt><var title="">metrics</var> . <code title="dom-textmetrics-alphabeticBaseline">alphabeticBaseline</code></dt>
    <dt><var title="">metrics</var> . <code title="dom-textmetrics-ideographicBaseline">ideographicBaseline</code></dt>
 
@@ -43919,29 +43921,42 @@ v6DVT (also check for '- -' bits in the part above) -->
 <!--REMOVE-TOPIC:Security-->
   Otherwise, it must return the new <code>TextMetrics</code> object.
   <a href="#refsCSS">[CSS]</a></p>
 
   </div>
 
   <dl>
 
    <dt><dfn title="dom-textmetrics-width"><code>width</code></dfn> attribute</dt>
 
-   <dd><p>The width of that inline box, in CSS pixels.</p></dd>
+   <dd><p>The width of that inline box, in CSS pixels. (The text's advance width.)</p></dd>
 
-   <dt><dfn title="dom-textmetrics-actualBoundingBoxWidth"><code>actualBoundingBoxWidth</code></dfn> attribute</dt>
+   <dt><dfn title="dom-textmetrics-actualBoundingBoxLeft"><code>actualBoundingBoxLeft</code></dfn> attribute</dt>
 
-   <dd><p>The width of the bounding rectangle of the given text, in CSS pixels. This can be wider than the width of the inline box, in particular with slanted fonts where characters overhang their advance width.</p></dd>
+   <dd>
+    <p>The distance parallel to the baseline from the alignment point given by the <code title="dom-context-2d-textAlign">textAlign</code> attribute to the left side of the bounding rectangle of the given text, in CSS pixels; positive numbers indicating a distance going left from the given alignment point.
+    <p class="note">The sum of this value and the next (<code title="dom-textmetrics-actualBoundingBoxRight">actualBoundingBoxRight</code>) can be wider than the width of the inline box (<code title="dom-textmetrics-width">width</code>), in particular with slanted fonts where characters overhang their advance width.</p>
+
+   </dd>
+
+   <dt><dfn title="dom-textmetrics-actualBoundingBoxRight"><code>actualBoundingBoxRight</code></dfn> attribute</dt>
+
+   <dd>
+    <p>The distance parallel to the baseline from the alignment point given by the <code title="dom-context-2d-textAlign">textAlign</code> attribute to the right side of the bounding rectangle of the given text, in CSS pixels; positive numbers indicating a distance going right from the given alignment point.</p>
+   </dd>
 
    <dt><dfn title="dom-textmetrics-fontBoundingBoxAscent"><code>fontBoundingBoxAscent</code></dfn> attribute</dt>
 
-   <dd><p>The distance from the horizontal line indicated by the <code title="dom-context-2d-textBaseline">textBaseline</code> attribute to the top of the highest bounding rectangle of all the fonts used to render the text, in CSS pixels; positive numbers indicating a distance going up from the given baseline.</p></dd>
+   <dd>
+    <p>The distance from the horizontal line indicated by the <code title="dom-context-2d-textBaseline">textBaseline</code> attribute to the top of the highest bounding rectangle of all the fonts used to render the text, in CSS pixels; positive numbers indicating a distance going up from the given baseline.</p>
+    <p class="note">This value and the next are useful when rendering a background that must have a consistent height even if the exact text being rendered changes. The <code title="dom-textmetrics-actualBoundingBoxAscent">actualBoundingBoxAscent</code> attribute (and its corresponding attribute for the descent) are useful when drawing a bounding box around specific text.</p>
+   </dd>
 
    <dt><dfn title="dom-textmetrics-fontBoundingBoxDescent"><code>fontBoundingBoxDescent</code></dfn> attribute</dt>
 
    <dd><p>The distance from the horizontal line indicated by the <code title="dom-context-2d-textBaseline">textBaseline</code> attribute to the bottom of the lowest bounding rectangle of all the fonts used to render the text, in CSS pixels; positive numbers indicating a distance going down from the given baseline.</p></dd>
 
    <dt><dfn title="dom-textmetrics-actualBoundingBoxAscent"><code>actualBoundingBoxAscent</code></dfn> attribute</dt>
 
    <dd>
     <p>The distance from the horizontal line indicated by the <code title="dom-context-2d-textBaseline">textBaseline</code> attribute to the top of the bounding rectangle of the given text, in CSS pixels; positive numbers indicating a distance going up from the given baseline.
     <p class="note">This number can vary greatly based on the input text, even if the first font specified covers all the characters in the input. For example, the <code title="dom-textmetrics-actualBoundingBoxAscent">actualBoundingBoxAscent</code> of a lowercase "o" from an alphabetic baseline would be less than that of an uppercase "F". The value can easily be negative; for example, the distance from the top of the em box (<code title="dom-context-2d-textBaseline">textBaseline</code> value "<code title="dom-context-2d-textBaseline-top">top</code>") to the top of the bounding rectangle when the given text is just a single comma "<code title="">,</code>" would likely (unless the font is quite unusual) be negative.</p>

|