magussiro / cakejs

Automatically exported from code.google.com/p/cakejs
0 stars 0 forks source link

TextNode does not render correctly in Chrome #48

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. A TextNode appended to any canvas or shape will not render correctly in 
Chrome on Windows.
2. A test file is attached; try opening it in Firefox and in Chrome.

What is the expected output? What do you see instead?
The test file should 1) draw a blue circle and 2) print some red text.  Firefox 
does both, but Chrome only draws the circle.

What version of the product are you using? On what operating system?
Chrome 17.0.963.56, Cakejs 2.0rc1; running on Windows 7.

Please provide any additional information below.
Am I using TextNode correctly?  I could not find any documentation about it.

Original issue reported on code.google.com by apsill...@gmail.com on 6 Mar 2012 at 2:44

GoogleCodeExporter commented 8 years ago
The test file is attached here.

Original comment by apsill...@gmail.com on 6 Mar 2012 at 2:50

Attachments:

GoogleCodeExporter commented 8 years ago
Sorry -- I'm using the latest 1.x, not 2.0rc1, and my test does as well.

Original comment by apsill...@gmail.com on 6 Mar 2012 at 4:57

GoogleCodeExporter commented 8 years ago
confirmed here : Opera 12.00 build 1325 and Opera 11.61 stable

Original comment by ishak.nu...@gmail.com on 7 Mar 2012 at 10:27

GoogleCodeExporter commented 8 years ago
If you replace line 6171

    ctx.fillText(this.text, this.cx, this.cy, this.maxWidth)

with this:

    if(this.maxWidth)
        ctx.fillText(this.text, this.cx, this.cy, this.maxWidth)
    else
        ctx.fillText(this.text, this.cx, this.cy);

it works again.

Original comment by mtoro...@gmail.com on 26 Mar 2012 at 1:38

GoogleCodeExporter commented 8 years ago
here is drawHTML5 function with support for baseline, align and stroke:
  drawHTML5 : function(ctx) {
    ctx.textBaseline = this.baseline
    ctx.textAlign = this.align
    if(this.maxWidth) {
      if(this.stroke && this.strokeMode == 'below')
        ctx.strokeText(this.text, this.cx, this.cy, this.maxWidth)
      ctx.fillText(this.text, this.cx, this.cy, this.maxWidth)
      if(this.stroke && this.strokeMode == 'above')
        ctx.strokeText(this.text, this.cx, this.cy, this.maxWidth)
    }
    else {
      if(this.stroke && this.strokeMode == 'below')
        ctx.strokeText(this.text, this.cx, this.cy)
      ctx.fillText(this.text, this.cx, this.cy);
      if(this.stroke && this.strokeMode == 'above')
        ctx.strokeText(this.text, this.cx, this.cy)
    }
  },

Original comment by ishak.nu...@gmail.com on 5 Apr 2012 at 1:11

GoogleCodeExporter commented 8 years ago
I wanted to thank the last 2 comments for helping me out.  Applying the patch 
from command #4 solved my problem exactly.

Original comment by ETo...@gmail.com on 18 May 2012 at 9:53