2013-08-17 2 views
1

CTFont를 만들 때 다음 경고가 표시됩니다.CoreText - CTFont를 만들 때의 성능 경고?

성능 노트 : 대신 클라이언트 이름이 "Arial Rounded MT Bold""ArialRoundedMTBold" 인 포스트 스크립트 이름의 클라이언트가 요청한 글꼴.

// Creating Font 
CTFontRef fontWithoutTrait = CTFontCreateWithName((__bridge CFStringRef)(name), size, NULL); 

// Font names I use to create a font 
[UIFont familyNames]; 

은 내가에서 가져온 글꼴 이름의 모든 공백을 제거하는 경우 [UIFont이 familyNames]가 핵심 텍스트로 예상 글꼴 이름이 될 거라고 가정하는 것이 안전합니까?

+0

예, 그렇지만 프로그래밍과 관련이 있는지는 잘 모르겠습니다. 패턴을 살피려면 PostScript 글꼴 이름 목록이 좋습니다. http://www.tug.org/fontname/html/Standard-PostScript-fonts.html – CodaFi

답변

5

글꼴을 만들 때 전체 이름을 포스트 스크립트 이름으로 변환하는 작업이 종료되었습니다.

+ (NSString *)postscriptNameFromFullName:(NSString *)fullName 
{ 
    UIFont *font = [UIFont fontWithName:fullName size:1]; 
    return (__bridge NSString *)(CTFontCopyPostScriptName((__bridge CTFontRef)(font))); 
}