-
Notifications
You must be signed in to change notification settings - Fork 39
bad canvas.width calculation ? Cropping my text ??? #46
Comments
Could you share the code that you're using to style the text? Being able to replicate the issue will make it a lot easier to solve. |
The object sent to your Pixi source code is the following. Then, a new Pixi class is called but with your source code from .pixi-multistyle-text.js It is at this point that the calculation seems erroneous. |
the basic code that build object MultiStyle is hard to reproduce , but is like thats. // customise that use the global default styles
|
Taking a diff of the version you provided with the current version of this library, there's some interesting changes related to letter spacing: - maxLineWidth = Math.max(maxLineWidth, lineWidth);
+ // GAMEFALL CHANGES
+ var fnum = Number(sty.fontSize.match(/(\d+)/i)[0]);
+ if(sty.letterSpacing > 1) var quantity = lineWidth * (sty.letterSpacing / (1 + ((0.0315 * fnum) * (sty.letterSpacing / 2))));
+ else var quantity = lineWidth
+ maxLineWidth = Math.max(maxLineWidth, quantity);
+ //console.log(fnum);
+ //-----------------------------------------------------------------------------------------------------------------------------------
+ // ORIGINAL:
+ //maxLineWidth = Math.max(maxLineWidth, lineWidth); I'm... dubious of the validity of these changes, and also can't really provide support if you're modifying the source. In particular, the lines you've added here have a direct impact on how wide the canvas is, so I'm going to guess there's a math error in here somewhere. Does this perform as expected with an unmodified copy of this library? If not, I can try to figure out why not, but I wasn't able to reproduce the issue with any simple tests on an unmodified copy of PMT. |
Could you elaborate on what bugs you were encountering? It would be nice to fix those in this library if possible :) The ones I could pick out from your description were:
Given a good proposal of what the markup and implementation would look like, adding support for some kind of iconography and/or varied horizontal alignment could be doable. |
TypeScript itself shouldn't add any bugs since it's just a type system on top of JS. I also haven't experienced any FPS drops due to PMT, but it's possible that there's some bottleneck somewhere that I haven't encountered. Are you changing the text or styles often (e.g. on each frame)? You also mention the import into Node being slow - are you doing some kind of server-side rendering? As far as the features you've mentioned:
|
I'm done a little video debug mode. you will understand the Custom newlines |
Hi friend , firstly, thank you very much for your excellent work.
I am pleased to be able to exploit several color style in my project with pixi.js
I am confronted with a rather strange problem.
i have a stange CROP of my multiTextStyle
I suspect a bad calculation of canvas.width ?!
Given that you know your source code, do you have an idea why I get this bad resulta?
I put the result in the PINK background for more easy check the canva width.
Here is your library that I use.
pixi-multistyle-text.zip
I will be very happy, if you could give me a idee on the current problem.
I have a bit of trouble reading and manipulating your source code.
The text was updated successfully, but these errors were encountered: