AS3 TextField AntiAliasType breaks WordWrap

妖精的绣舞 提交于 2019-12-08 11:08:42

问题


I am dynamically creating and populating a TextField in AS3. I have embedded some fonts into my library (using Flash) and am setting the font of the text field using TextFormat. Because of the limited width of the TextField I have textfield.multiline = true; and textfield.wordWrap = true;, however I have noticed that the fonts look a little pixelated.

To fix this I am using textfield.antiAliasType = AntiAliasType.ADVANCED; which makes the text look nice, but stops the word-wrap from working. In fact it looks quite odd; The text keeps keeps going off the width of the TextField then puts the last word on a new line.

What do I need to do to make it look good and wrap?


回答1:


Typical. Ask a question, find the answer =/

Specifying a grid fit type to the TextField fixes it. Don't know why:

textfield.gridFitType = GridFitType.SUBPIXEL;

From the documentation:

Fits strong horizontal and vertical lines to the sub-pixel grid on LCD monitors. (Red, green, and blue are actual pixels on an LCD screen.) This is often a good setting for right-aligned or center-aligned dynamic text, and it is sometimes a useful tradeoff for animation vs. text quality. This constant is used in setting the gridFitType property of the TextField class. Use the syntax GridFitType.SUBPIXEL.



来源:https://stackoverflow.com/questions/5793032/as3-textfield-antialiastype-breaks-wordwrap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!