Closed
Bug 339553
Opened 18 years ago
Closed 17 years ago
drawString enhancement for <canvas>
Categories
(Core :: Graphics: Canvas2D, enhancement)
Core
Graphics: Canvas2D
Tracking
()
RESOLVED
FIXED
mozilla1.9alpha7
People
(Reporter: lars, Assigned: robarnold)
References
()
Details
(Keywords: dev-doc-complete)
Attachments
(5 files, 5 obsolete files)
(deleted),
patch
|
vlad
:
review+
|
Details | Diff | Splinter Review |
(deleted),
text/html
|
Details | |
(deleted),
text/html
|
Details | |
(deleted),
text/html
|
Details | |
(deleted),
patch
|
vlad
:
review+
vlad
:
approval1.9+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3
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
Updated•18 years ago
|
Component: General → Layout: Canvas
OS: Windows XP → All
Product: Firefox → Core
QA Contact: general → layout.canvas
Hardware: PC → All
Version: unspecified → Trunk
Comment 1•18 years ago
|
||
> As the canvas tag is not a standard anyway
http://whatwg.org/specs/web-apps/current-work/#scs-dynamic
Comment 2•18 years ago
|
||
Some ideas have been drafted http://wiki.mozilla.org/Canvas:Text but it would be best if this was discussed at whatwg@whatwg.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.)
Reporter | ||
Comment 3•18 years ago
|
||
> > As the canvas tag is not a standard anyway
>
> http://whatwg.org/specs/web-apps/current-work/#scs-dynamic
It is a working draft.
Comment 4•18 years ago
|
||
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
Assignee | ||
Comment 5•17 years ago
|
||
Attachment #266815 -
Flags: review?(vladimir)
Assignee | ||
Comment 6•17 years ago
|
||
This patch is dependent on bug 382710
Attachment #266824 -
Flags: review?(vladimir)
Assignee | ||
Comment 7•17 years ago
|
||
Attachment #266815 -
Attachment is obsolete: true
Attachment #266824 -
Attachment is obsolete: true
Attachment #266815 -
Flags: review?(vladimir)
Attachment #266824 -
Flags: review?(vladimir)
Assignee | ||
Comment 8•17 years ago
|
||
Comment on attachment 266941 [details] [diff] [review]
TextStyle, DrawText, MeasureText, PathText, TextAlongPath
Still dependent on aforementioned bug 382710
Attachment #266941 -
Flags: review?(vladimir)
Assignee | ||
Comment 9•17 years ago
|
||
Attachment #266941 -
Attachment is obsolete: true
Attachment #267311 -
Flags: review?(vladimir)
Attachment #266941 -
Flags: review?(vladimir)
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+
Comment 11•17 years ago
|
||
(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
Assignee | ||
Comment 12•17 years ago
|
||
(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.
Assignee | ||
Comment 13•17 years ago
|
||
Attachment #267311 -
Attachment is obsolete: true
Attachment #269917 -
Flags: review?(vladimir)
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+
Assignee | ||
Comment 15•17 years ago
|
||
gfxGlobalTextRunCache disappeared between when I posted and vlad review. New version uses gfxTextRunCache::AutoTextRun.
Attachment #269917 -
Attachment is obsolete: true
Attachment #273496 -
Flags: review?(vladimir)
Assignee | ||
Comment 16•17 years ago
|
||
Assignee | ||
Comment 17•17 years ago
|
||
Assignee | ||
Comment 18•17 years ago
|
||
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.
Updated•17 years ago
|
Assignee: nobody → robarnold
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: 17 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+
Assignee | ||
Comment 22•17 years ago
|
||
Attachment #275020 -
Flags: review?(vladimir)
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!
Attachment #275020 -
Flags: review?(vladimir)
Attachment #275020 -
Flags: review+
Attachment #275020 -
Flags: approval1.9+
Updated•17 years ago
|
Keywords: dev-doc-needed
Comment 24•17 years ago
|
||
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.
Flags: in-testsuite?
Target Milestone: --- → mozilla1.9 M7
Comment 25•17 years ago
|
||
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
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•