5

I’m working on an application we’re currently translating to Thai. Everything went smoothly when we tested the app on iOS 7, but on iOS 8, some accents were clipped by UILabels.

We’re using Auto-Layout to layout all of the elements of the application.

I’ve read somewhere in the release notes of iOS 8 that the Thai characters default font has been increased for enhanced readability. However, Auto-Layout does not seem to care and leave the height of the label as if it was displaying latin text, thus leading to some accent being clipped.

What is the proper way to handle Thai text in iOS?

EDIT: Here’s a picture showing the problem. (OK is on iOS 7, CUT is on iOS 8.)

The problem is shown in this image

Note: I tried setting the clipToBounds property of the UILabel to NO, the text is not clipped indeed. However this is not a good solution! If I have two labels one above the other, I may have overlapping texts…

Frizlab
  • 846
  • 9
  • 30
  • What the problem exactly is? The text doesn't appear completely? – engmahsa Oct 20 '15 at 15:19
  • Edited the question to show the problem. – Frizlab Oct 20 '15 at 15:42
  • I got it set content offset of uitext view to cgzeropoint – engmahsa Oct 20 '15 at 15:44
  • @engmahsa It’s not a `UITextView`, it’s a `UILabel` – Frizlab Oct 20 '15 at 15:49
  • [iOS SDK Release Notes for iOS 8.1.1](https://developer.apple.com/library/prerelease/ios/releasenotes/Miscellaneous/RN-iOSSDK-8.1/index.html) (scroll to Fonts section) suggests to make sure Clip Subviews is unchecked *and* Dynamic Type used to avoid overlapping. Otherwise perform manual measuring. – Be Brave Be Like Ukraine Oct 20 '15 at 16:03
  • @bytebuster Yes I know! And I tried both. However, on my setup, there are two `UILabel`s, one above the other. Even with a Dynamic Type, the label is still too small for the characters it contains, so I would still have the problem of overlapping characters. – Frizlab Oct 20 '15 at 19:43
  • Hey, @Frizlab, I know this happened a long time ago, but were you able to fix this? I'm encountering the same issue right now. – Fernando Mata Feb 27 '18 at 08:21
  • 1
    @FernandoMata Nope. I got some insights from Apple who told me it was a bug on their end in CoreText. The only workaround I found for the moment is to change the height of a line using a ParagraphStyle (in Thai only) and set an attributed string to my labels. Ugly, but it works… – Frizlab Feb 27 '18 at 10:24
  • Well, I wasn't expecting that much from Apple side. Thanks anyway! I would maybe try your solution. – Fernando Mata Mar 12 '18 at 09:50

2 Answers2

1

Just would like to mention that this issue still exists on iOS 14, tested with iPhone 11 Pro.

line height issue

With lineHeight set:

line height issue

Simon
  • 81
  • 3
  • 11
-1

I was facing the same problem, too. The issue is because the font that you are using. Such as font Gotham Rounded will be cut off when display Thai language. Try use another font.

t4nhpt
  • 5,264
  • 4
  • 34
  • 43
  • Thank you but this is not a solution… I don’t want to use another font, I have design constraints. – Frizlab Nov 03 '16 at 14:20