Italic Font not work for Chinese/Japanese/Korean on iOS 7
Asked Answered
S

3

0

I want to set Italic Font Style in UITextView, but Italic Font just not work for Chinese/Japanese/Korean on iOS 7.Could anyone help?

Stator answered 9/1, 2014 at 1:17 Comment(4)
Why do you need this? Italics are generally not used in Asian character sets.Jaf
Because I want to display the text in the same style,not just for Chinese/Japanese/Korean.Stator
You may need to accept that some languages do things differently and adapt accordingly. In Japanese, you can boldface a word by putting dots above each letter. Would you expect that to work in English?Jaf
You can take a look,iOS 7 Email App and Evernote just work fine with Italic Font for Chinese/Japanese/Korean.Stator
Y
9

Because there are no italic styled Chinese fonts on iOS, you need to use affine transformation to slant the normal styled Chinese font.

The code below gives a 15° slant to Heiti SC Medium:

CGAffineTransform matrix = CGAffineTransformMake(1, 0, tanf(15 * (CGFloat)M_PI / 180), 1, 0, 0);
UIFontDescriptor *desc = [UIFontDescriptor fontDescriptorWithName:@"Heiti SC Medium" matrix:matrix];
textView.font = [UIFont fontWithDescriptor:desc size:17];

Real effect:

enter image description here

Youngs answered 10/1, 2014 at 0:38 Comment(0)
C
6

I’m not solving your problem, but to remind you that this kind of “programmatic italic font” has really bad readability.

For CJK text, the right way to express emphasis (or quote) is to use another style (usually serif font). For Simplified Chinese, use Songti, Fangsong, or Kaiti instead of oblique for emphasis if your normal text is using Heiti (iOS default). I’m not very familiar with Korean and Japanese, but they use similar approaches.

Here is a font list for iOS 7: http://support.apple.com/kb/HT5878?viewlocale=en_US&locale=en_US Japanese Mincho font “Hiragino Mincho ProN” is available directly. Extra Chinese fonts are not installed by default. You’ll need to download first. Please refer to this example for how to install additional system-provided fonts: https://github.com/fdstevex/FDSFontDownloader/ .

I know it’s a little bit complicated, but this is really how we do italic.

Christian answered 10/1, 2014 at 1:43 Comment(0)
F
0

Agree with @an0 but In this way to made transform are better for read and understand

CGAffineTransform CGAffineTransformMakeSkew (CGFloat degree) {
    CGAffineTransform t = CGAffineTransformIdentity;
    t.c = (degree * M_PI / 180.0f);
    return t;
}
Fellowship answered 21/3, 2014 at 8:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.