[text sizeWithFont:font] return incorrect with Thai characte


#1

Dear,

sorry for my poor english :smiley:

I’ve follow your Chapter6 project , everything work fine

except the [text sizeWithFont:font] always return incorrect size when the text contains Thai characters

screen capture of the issue: postimage.org/image/1byaohhc4/

Which solutions good enough to solve the issue?

Thank for advance


#2

Hi,

Does this make any difference ?

textRect.size = [text sizeWithFont:font constrainedToSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)];

Gareth


#3

Thanks Gareth, the code textRect.size = [text sizeWithFont:font constrainedToSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)]; is work!

But, I wonder how the constrainedToSize solve this issue. Could you give me an advice :blush:

Thanks,
Chear


#4

Hi,

I think it must be a bug in the sizeWithFont method that doesn’t exist in the sizeWithFont:constrainedWithSize method.

sizeWithFont should return the correct size.

Gareth


#5

Thanks Gareth so much :mrgreen: