0

Code is as following:

textSize = [text sizeWithAttributes:[self textAttributes:newFont]];

I ensure the input parameters are same. But the result is different. The text content is mixed with English and Chinese. It is: text = @"Start typing to add a caption 你好 and the fact is I don't like you or you can't have the same as the same ones you don't have like yo”;

I hardcode the font size:

newFont = [newFont fontWithSize:19.629999529752041];

The attribute are:

@{NSFontAttributeName: font, NSKernAttributeName: @(0.f)}

I think the input parameters are same. But the result is not the same in different time. I think the result should be same.

Any suggestion will be appreciate.

Laurence Fan
  • 1,074
  • 1
  • 11
  • 15
  • Are you saying that if you run the same program twice, you get a different text width? – Neil Apr 20 '17 at 08:07
  • No. Run the program once. The reproduce steps are: 1. Add caption and input some text content in the Edit Caption screen. 2. Calculate the text size and get result A. 3. Save the caption. 4. Click the caption to edit it again. 5. Calculate the text size and get result B. 6. Result A and B are not same even the input parameters are same. Only mixed with English and Chinese will cause the problem. If the text are pure English, the issue does not exist. – Laurence Fan Apr 20 '17 at 08:22

0 Answers0