Summary:
-- Text.js no longer supports scaling.*
-- Text.js now also has all of its functions documented in JSDocs format.
-- Unit tests for text.js have been updated and testing has been enabled again
(Note: It will need to be added back to jaws-dynamic.js too for testing to actually work.)
*Because Sprite.js uses its internal image property to create its scaling, it can rely on the fact that the property is basically a constant in all calculations. Its internal width and height can be scaled according to a factor multiplied by the size of the image (which never changes).
Text.js doesn't have that same relationship to its width and height. It is drawn /in/ and not /from/ its dimensions. This means that, should scaling be enabled, it would constantly be in flux as each new call to cacheOffsets would increase or decrease its internal width and height without the weight of something like an image.width to keep it as a factor.
It could still be added back in the future though. For the most accurate measurements, it should probably use the context.measureText for width and context.font for height values. However, both are relative to the font family used -- and the current object uses pixels instead of points anyway for size consistency.
Summary: -- Text.js no longer supports scaling.* -- Text.js now also has all of its functions documented in JSDocs format. -- Unit tests for text.js have been updated and testing has been enabled again
(Note: It will need to be added back to jaws-dynamic.js too for testing to actually work.)
*Because Sprite.js uses its internal image property to create its scaling, it can rely on the fact that the property is basically a constant in all calculations. Its internal width and height can be scaled according to a factor multiplied by the size of the image (which never changes).
Text.js doesn't have that same relationship to its width and height. It is drawn /in/ and not /from/ its dimensions. This means that, should scaling be enabled, it would constantly be in flux as each new call to cacheOffsets would increase or decrease its internal width and height without the weight of something like an image.width to keep it as a factor.
It could still be added back in the future though. For the most accurate measurements, it should probably use the context.measureText for width and context.font for height values. However, both are relative to the font family used -- and the current object uses pixels instead of points anyway for size consistency.