Measure Text API, expanded (#3921)
* Added TextStyle.measure function (Applies to https://github.com/pixijs/pixi.js/issues/3903).

* Moved measure function from TextStyle to Text and made static.

* Updated JSDocs.

* Updated JSDocs again.

* Updates based on suggestions by @bigtimebuddy in PR.

* Created PIXI.MeasuredText to capture all the information for measuring text.

* Fixes for ESLint

* Fixes for ESLint

* Added PIXI prefix to returning MeasuredText.

* Added import for MeasuredText in Text.js.

* Refactored MeasuredText to TextMetrics and moved `measure` function into it.

* Forgot to move Text.wordWrap to TextMetrics.wordWrap

* Further cleanup of TextMetrics.

* Fixes suggested by @bigtimebuddy

* Removed clone and equals from TextMetrics as they are unnecessary.

* Destructured references to TextMetrics instance in Text and privatized TextMetrics.wordWrap.

* Deprecates calculateFontProperties & getFontStyle

* Moved getFontStyle to TextMetrics

* Made toFontString method on TextStyle

* Cache calls made to context.measureText for individual characters

* Use a smaller (10x10) canvas for TextMetrics
1 parent 8d6d024 commit 45daea8c84920c7b2011dd6eb9b0f79798dc3590
@Matt Karl Matt Karl authored on 11 Apr 2017
GitHub committed on 11 Apr 2017
Showing 7 changed files
View
src/core/index.js
View
src/core/text/Text.js
View
src/core/text/TextMetrics.js 0 → 100644
View
src/core/text/TextStyle.js
View
src/deprecation.js
View
test/core/Text.js
View
test/core/TextStyle.js