1
NGUI 3 Support / UILabel, HTMLEngine and Dynamic Fonts
« on: October 02, 2014, 01:34:06 PM »
Hi Aren, I know that HMTLEngine is a third party asset to NGUI, but sadly I need a bit of help regarding this topic...
This is more a unity/uilabel question rather than HTMLEngine, but I mention this so you can get a picture of my problem.
As you might know, HTMLEngine pareses the markup and then uses a Draw method that generates UILabels. HTMLEngine calculates the printed size of the not-yet-created UILabel using NGUIText.calculatePrintedSize, and then creates the label according to this calculations... as the labels are not instantiated at the moment of the calculations HTMLEngine sets the NGUIText "environment" manually rather than calling UILabel.UpdateNGUIText method... If I compare the calculated size, and the final label size it is ALWAYS wrong by a few pixels (depending on the label text/characters) and the final result is some overlapped UILabels...
I think this is because some parameters not being passed to the "environment" correctly, more specifically the mScale of the font.. and there comes my question:
I've analyzed most of UILabel“s code, and mScale seems to be related to the Unity import Font Size ... so.. how is imported font size related to the font size I use in the UILabels???
If I set the import size to 20, and then in the label I set the size to 24... mScale is different (not 1), right?
Thanks in advance!
This is more a unity/uilabel question rather than HTMLEngine, but I mention this so you can get a picture of my problem.
As you might know, HTMLEngine pareses the markup and then uses a Draw method that generates UILabels. HTMLEngine calculates the printed size of the not-yet-created UILabel using NGUIText.calculatePrintedSize, and then creates the label according to this calculations... as the labels are not instantiated at the moment of the calculations HTMLEngine sets the NGUIText "environment" manually rather than calling UILabel.UpdateNGUIText method... If I compare the calculated size, and the final label size it is ALWAYS wrong by a few pixels (depending on the label text/characters) and the final result is some overlapped UILabels...
I think this is because some parameters not being passed to the "environment" correctly, more specifically the mScale of the font.. and there comes my question:
I've analyzed most of UILabel“s code, and mScale seems to be related to the Unity import Font Size ... so.. how is imported font size related to the font size I use in the UILabels???
If I set the import size to 20, and then in the label I set the size to 24... mScale is different (not 1), right?
Thanks in advance!
