iOS

How to fix UILabel truncated at bottom

Anyone who works for japanese outsource company must have once encounter a situation UILabel is truncated at bottom when displaying Japanese mixed with English like the picture below:

UILabel is truncated at bottom
UILabel is truncated at bottom

Normally we’ll fix by get its height then adding some extra space for the truncated space. But this is not a good solution. What if the content is all japanese? Then the extra space becomes redundant since japanese characters does not have bottom part.

After researching for a while, I figure out by setting font to System Font, the label is not truncated anymore.

UILabel is truncated anymore
UILabel is truncated anymore

My guess may be when using Japanese font, such as Hiragino … japanese character does not have bottom part like English other latin based language, therefore ios removes some pixel automatically. Because of that when there is latin character UILabel is truncated at bottom.

Leave a Reply

Your email address will not be published. Required fields are marked *