I used jsfiddle to demonstrate the problem as simply as I can. Both create a new TextMetrics instance from a DIV that has a basic style applied. Then I get the width of a single space. Play with the font-size in the style then re-run the fiddle. See that the width returned by TextMetrics changes as the font-size changes. This is good.
Also, notice that the method to instantiate the TextMetrics object changed from 3 to 4. To make my custom component work in both 3 and 4, I have to test which Ext version is loaded then create the instance accordingly.
*edit from SLEMMON
Upon testing I'm seeing that a " " space character is reported with a width of 3 pixels from 3.4 and as 4 pixels from 4.2 and using the dev tools in Chrome the element does appear to be 4px.
4.2 test case demonstrated: http://jsfiddle.net/C2Sjx/1/
3.4 test case demonstrated: http://jsfiddle.net/ST3a4/3/
Last edited by slemmon; 3 Apr 2013 at 2:50 PM.
Reason: added additional test case notes
Do you think it can be a bug? In other words, does it work differently from as it is documented?
If so, the best would be if I move this thread to bugs so that the developers can look into it.
Thank you for the reply.
I always take the humble approach that I have misunderstood the product rather than assume a bug. I've been doing this for over 20 years--there have been way too many times I was sure the issue was due to a bug only to discover I needed to RTFM.
I don't have the power to move a thread, so let's hope someone with authority will see this thread, look at my super-simple examples, determine if it is indeed a bug, and move this thread accordingly.
I'm good calling this one a bug. For " " I'm getting a 3 pixel width reported from 3.4 and a 4 pixel width reported from 4.2 and when I use the dev tools in Chrome to get the width of the element it does report as 4px, not 3.
*I modified the examples just slightly and am editing your initial post slightly to include that detail before submitting as a bug.