Before I did this, I would _really_ want to understand why it was changed. It seems this was the end result of a _lot_ of discussion related to:
http://jira.openlaszlo.org/jira/browse/LPP-6580 You, Max, and André all had input on this. getTextWidth is a Kernel API, which is used by the LFC. So, it needs to have a contract that is the _same_ for all platforms. I changed this and left a note as to why: /** * Calculates the current width of the text held by the text field. * * @devnote NOTE: [2009-03-01 ptw] this is _not_ the clip textWidth, which * "when autoSize is true is always 4 pixels less than _width" (which * is why we have to add 4 pixels for emulate_flash_font_metrics * in the DHTML version of this method, and why Henry used to add * PAD_TEXTWIDTH to the textWidth!) * * @devnote NOTE: [2009-03-28 ptw] But if the text is empty, we return * 0. <sigh /> */ The way I read that, when we split the LFC to have platform kernels we screwed up the abstraction and left part of the platform-specific stuff (this 4px offset from the Flash API) in the general part of the kernel. This change fixes that, so that _all_ the kernels are measuring the same thing. You clearly cannot just change the Flash kernel, because then it would be skewed from the other kernels. On 2010-04-01, at 14:08, Henry Minsky wrote: > We used to measure text width in LzTextSprite by looking at the Flash > 'TextField.textWidth' property (and adding > 4 pixels of padding because it clipped otherwise). > > At some point that method was changed to look at the TextField._width > instead, which gives different values (slightly larger ones). > > Anyone remember what the thinking there was? I'm inclined to revert that, so > that we're compatible with the > 4.2 text width in swf8. > > > > r13517 by ptw has the last assignment according to svn blame > > " Fixed getTextWidth, getTextHeight, getTextfieldHeight, > to obey kernel API contract." > > > > -- > Henry Minsky > Software Architect > [email protected]
