Closed Bug 339553 Opened 17 years ago Closed 15 years ago
String enhancement for <canvas>
15.28 KB, patch
|Details | Diff | Splinter Review|
1.67 KB, text/html
1.78 KB, text/html
1.71 KB, text/html
1.06 KB, patch
|Details | Diff | Splinter Review|
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:22.214.171.124) Gecko/20060426 Firefox/126.96.36.199 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:188.8.131.52) Gecko/20060426 Firefox/184.108.40.206 As the canvas tag is not a standard anyway may I suggest the addition of a drawString method with parameters for font type, size and string. In order to achieve usability canvas really requires an equivalent prototype method, however the established prototype functions take immense amounts of clocktime and significantly (and unnessessarily) slow down the canvas. The current lack of standard in canvas makes it possible to include a drawString method before it is too late, thus adding new possibilities to the object. Reproducible: Always
Component: General → Layout: Canvas
OS: Windows XP → All
Product: Firefox → Core
QA Contact: general → layout.canvas
Hardware: PC → All
Version: unspecified → Trunk
> As the canvas tag is not a standard anyway http://whatwg.org/specs/web-apps/current-work/#scs-dynamic
Some ideas have been drafted http://wiki.mozilla.org/Canvas:Text but it would be best if this was discussed at firstname.lastname@example.org first. (Note that even if it is a standard it's still possible to extend objects with possibilities following the undrafted rules for extensibility of objects or by proposing additions to such a atandard on the appropriate forums.)
> > As the canvas tag is not a standard anyway > > http://whatwg.org/specs/web-apps/current-work/#scs-dynamic It is a working draft.
Right, proposed extensions to such working drafts go to the document author and or the public mailing list attached to it: see comment 2.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment on attachment 266941 [details] [diff] [review] TextStyle, DrawText, MeasureText, PathText, TextAlongPath Still dependent on aforementioned bug 382710
Comment on attachment 267311 [details] [diff] [review] Fixes crash when SetTextStyle was not called before the other function calls r+ me with name change to moz-prefixed names (mozTextStyle, etc.). However, please request review from dbaron (or bz?) on the style additions. Thanks!
Attachment #267311 - Flags: review?(vladimir) → review+
(In reply to comment #10) > (From update of attachment 267311 [details] [diff] [review]) > r+ me with name change to moz-prefixed names (mozTextStyle, etc.). According to HTML 5, > drawing text is not supported in this version of the API - http://www.whatwg.org/specs/web-apps/current-work/multipage/section-the-canvas.html#the-2d > Vendors may also define experimental contexts using the syntax vendorname-context, for example, moz-3d. - http://www.whatwg.org/specs/web-apps/current-work/multipage/section-the-canvas.html#getcontext So, we should create another context (e.g. moz-2dtext) as Opera did (opera-2dgame). http://my.opera.com/WebApplications/blog/show.dml/200788
(In reply to comment #11) > (In reply to comment #10) > > (From update of attachment 267311 [details] [diff] [review] [details]) > > r+ me with name change to moz-prefixed names (mozTextStyle, etc.). > > > According to HTML 5, drawing text is not supported in this version of the API Which is why we are going to prefix our extension with moz so that when such an api is standardized, this implementation will not conflict. > Vendors may also define experimental contexts using the syntax vendorname-context, for example, moz-3d. > - > http://www.whatwg.org/specs/web-apps/current-work/multipage/section-the-canvas.html#getcontext I interpret this as stating that it is not required to define another context. Also note that the same document states: > UA must return a reference to an object implementing CanvasRenderingContext2D The object we return does implement this interface. > So, we should create another context (e.g. moz-2dtext) as Opera did > (opera-2dgame). > http://my.opera.com/WebApplications/blog/show.dml/200788 Perhaps, but given that we are prefixing our extension functions to avoid future naming collisions (unlike Opera), there is not as much of a reason to do this.
Comment on attachment 269917 [details] [diff] [review] Method/Attribute renaming and fixed a bug when the canvas was not attached to the dom Looks good
Attachment #269917 - Flags: review?(vladimir) → review+
gfxGlobalTextRunCache disappeared between when I posted and vlad review. New version uses gfxTextRunCache::AutoTextRun.
Thanks.. this is still on my list to check in, my tree's just been full of new cairo, but I should have that wrapped up soon. I'll get this in tonight or tomorrow.
Checking in content/canvas/src/nsCanvasRenderingContext2D.cpp; /cvsroot/mozilla/content/canvas/src/nsCanvasRenderingContext2D.cpp,v <-- nsCanvasRenderingContext2D.cpp new revision: 1.90; previous revision: 1.89 done Checking in layout/style/nsStyleSet.cpp; /cvsroot/mozilla/layout/style/nsStyleSet.cpp,v <-- nsStyleSet.cpp new revision: 3.185; previous revision: 3.184 done Checking in layout/style/nsStyleSet.h; /cvsroot/mozilla/layout/style/nsStyleSet.h,v <-- nsStyleSet.h new revision: 3.23; previous revision: 3.22 done Checking in gfx/thebes/src/gfxFont.cpp; /cvsroot/mozilla/gfx/thebes/src/gfxFont.cpp,v <-- gfxFont.cpp new revision: 1.58; previous revision: 1.57 done Checking in dom/public/idl/canvas/nsIDOMCanvasRenderingContext2D.idl; /cvsroot/mozilla/dom/public/idl/canvas/nsIDOMCanvasRenderingContext2D.idl,v <-- nsIDOMCanvasRenderingContext2D.idl new revision: 1.6; previous revision: 1.5 done
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Comment on attachment 273496 [details] [diff] [review] Fixed builds errors on trunk (was already reviewed and checked in)
Attachment #273496 - Flags: review?(vladimir) → review+
Comment on attachment 275020 [details] [diff] [review] This fixes an issue in Windows optimized builds with some uninitialized data r+a=me, checked in, thanks!
http://developer.mozilla.org/en/docs/Canvas:Text has some docs (thanks Rob!), but it could use more detail (i.e. formal API documentation), so keeping on the dev-doc-needed radar.
Target Milestone: --- → mozilla1.9 M7
The docs have been overhauled substantially. Basically the same content, just rearranged to match other reference documents more closely. http://developer.mozilla.org/en/docs/Drawing_text_using_a_canvas
You need to log in before you can comment on or make changes to this bug.