<?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>25716</bug_id>
          
          <creation_ts>2014-05-14 18:28:46 +0000</creation_ts>
          <short_desc>&lt;canvas&gt;: path merging should not be part of addText() or addPathByStrokingText()</short_desc>
          <delta_ts>2016-04-21 17:38:28 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#path2d-objects</bug_file_loc>
          <status_whiteboard>blocked awaiting response from joe to comment 6 (please remove this when replying)	</status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>annevk</cc>
    
    <cc>cabanier</cc>
    
    <cc>d</cc>
    
    <cc>ian</cc>
    
    <cc>joe</cc>
    
    <cc>junov</cc>
    
    <cc>mike</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>105984</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2014-05-14 18:28:46 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html
Multipage: http://www.whatwg.org/C#path2d-objects
Complete: http://www.whatwg.org/c#path2d-objects
Referrer: https://www.google.com/

Comment:
Path merging should not be part of addText() or addPathByStrokingText(), it is
very expensive computationally. Also, it may not be what the user wants. For
example, in the given example of the Q and p overlapping, what if the user
*wants* a knockout where the glyphs overlap?

Instead I believe path merging should be removed from these two functions.
Instead I believe a simplify() function should be added to Path2D which. The
simplify() function performs the merge path algorithm as you&apos;ve described it
here, but can perform that operation on any set of paths. That way the user of
the API gets to decide when to call the expensive operation Path2D.simplify(),
and simplify() can be applied to more than glyph paths.

For reference see the SkPathOps simplify():

https://github.com/google/skia/blob/master/include/pathops/SkPathOps.h

Posted from: 2620:0:1013:0:2e44:fdff:fe2d:922d
User agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.132 Safari/537.36</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105985</commentid>
    <comment_count>1</comment_count>
    <who name="Joe Gregorio">joe</who>
    <bug_when>2014-05-14 18:35:38 +0000</bug_when>
    <thetext>Sorry, I wasn&apos;t logged in when I reported this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105998</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-05-14 21:15:55 +0000</bug_when>
    <thetext>If we don&apos;t do the path merging, we have to define what the result will be, which means defining font path handling, which seems like WAY more work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106388</commentid>
    <comment_count>3</comment_count>
    <who name="rcabanie">cabanier</who>
    <bug_when>2014-05-19 21:48:08 +0000</bug_when>
    <thetext>(In reply to contributor from comment #0)
&gt; Specification:
&gt; http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-
&gt; element.html
&gt; Multipage: http://www.whatwg.org/C#path2d-objects
&gt; Complete: http://www.whatwg.org/c#path2d-objects
&gt; Referrer: https://www.google.com/
&gt; 
&gt; Comment:
&gt; Path merging should not be part of addText() or addPathByStrokingText(), it
&gt; is
&gt; very expensive computationally. Also, it may not be what the user wants. For
&gt; example, in the given example of the Q and p overlapping, what if the user
&gt; *wants* a knockout where the glyphs overlap?

Would it make more sense that the functionality of addText is replace with a function that returns a list of paths (each representing a glyph that can be filled with any winding rule) along with an offset?

&gt; Instead I believe path merging should be removed from these two functions.
&gt; Instead I believe a simplify() function should be added to Path2D which. The
&gt; simplify() function performs the merge path algorithm as you&apos;ve described it
&gt; here, but can perform that operation on any set of paths. That way the user
&gt; of
&gt; the API gets to decide when to call the expensive operation
&gt; Path2D.simplify(),
&gt; and simplify() can be applied to more than glyph paths.

Would simplify take a winding rule then?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106560</commentid>
    <comment_count>4</comment_count>
    <who name="Joe Gregorio">joe</who>
    <bug_when>2014-05-21 13:40:11 +0000</bug_when>
    <thetext>(In reply to rcabanie from comment #3)
&gt; Would it make more sense that the functionality of addText is replace with a
&gt; function that returns a list of paths (each representing a glyph that can be
&gt; filled with any winding rule) along with an offset?

That would work too, do you see an advantage of the list-of-paths over addText?
 
&gt; 
&gt; Would simplify take a winding rule then?

Yes, it should take a winding rule.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106587</commentid>
    <comment_count>5</comment_count>
    <who name="rcabanie">cabanier</who>
    <bug_when>2014-05-21 16:50:41 +0000</bug_when>
    <thetext>(In reply to Joe Gregorio from comment #4)
&gt; (In reply to rcabanie from comment #3)
&gt; &gt; Would it make more sense that the functionality of addText is replace with a
&gt; &gt; function that returns a list of paths (each representing a glyph that can be
&gt; &gt; filled with any winding rule) along with an offset?
&gt; 
&gt; That would work too, do you see an advantage of the list-of-paths over
&gt; addText?

The advantage is that you don&apos;t need to resolve overlapping path segments. You would just need to make sure that the winding of the paths for each glyph are oriented so that any winding rule can apply.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109902</commentid>
    <comment_count>6</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-08-04 23:28:13 +0000</bug_when>
    <thetext>&gt; Also, it may not be what the user wants. For example, in the given example
&gt; of the Q and p overlapping, what if the user *wants* a knockout where the
&gt; glyphs overlap?

Then you&apos;d create two paths and add them together manually using future Path APIs for path manipulation. That isn&apos;t the common case (by a very wide margin), so it&apos;s not the easier case either.

I don&apos;t really understand how you want addText() to work if it doesn&apos;t do path merging.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111406</commentid>
    <comment_count>7</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-09-11 23:01:26 +0000</bug_when>
    <thetext>(I spoke with Joe offline, he said he&apos;d get back to us here.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125781</commentid>
    <comment_count>8</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2016-04-08 23:06:43 +0000</bug_when>
    <thetext>Joe, any updates on this?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126008</commentid>
    <comment_count>9</comment_count>
    <who name="Justin Novosad">junov</who>
    <bug_when>2016-04-21 17:38:28 +0000</bug_when>
    <thetext>Closing issue since it is no longer relevant: addText and addPathByStrokingText()
were removed from the spec.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>