Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CoreText のはなし

CoreText のはなし

Yusuke Ito

April 14, 2012
Tweet

More Decks by Yusuke Ito

Other Decks in Programming

Transcript

  1. iOS ͱ OS X AttributedStringͱηοτͰ࢖͏ (ඳը͸CoreGraphics) RTLɾॎॻ͖༻άϦϑʹରԠ→ॎॻ͖ άϦϑͷஔ׵ (CTGlyphInfo) ҟମࣈʹ࢖͑Δ

    ϑΥϯτͷબ୒(σΟεΫϦϓλ) (CTFontDescriptor) ϑΥϯτϑΝΠϧͷύʔεɾ֤छϝλσʔλ (CTFont)
  2. 1. Attributed StringΛ࡞Δ ଐੑ͸ Core Text String Attributes Λ࢖͏ NSAttributedStringʹCFAttributedString

    NSMutableAttributedStringʹCFMutableAttributedString ී௨͸Cocoa(NS)Λ࢖͑͹OK
  3. CTFrameSetter NSAttributedString CTFrame CTFont CTGlyphInfo CTParagraph Style CTLine CTLine CTLine

    CTRun CoreGraphics -drawRect:౳ CTLine ϨϯμϦϯά ඳը ଐੑͱͯ͠ઃఆ ॳظԽ
  4. ͜͜ͰσβΠϯύλʔϯͷ࿩Ͱ΋ ΦϒδΣΫτ͸Mutable(Մม)͔Immutable(ෆม)͔ Mutable: NSMutable..., UIView, UIViewController... Immutable: NSObject, NSString, UIImage,

    UIColor... NSMutableAttributedString จࣈྻࣗମ͸Immutable (-initWithString:) จࣈྻͷଐੑ͸Mutable (-setAttributes:range:) CoreText͸͢΂ͯImmutable
  5. CTFrameSetter NSAttributedString NSMutableAttributed... CTFrame CTFont CTGlyphInfo CTParagraph Style CTLine CTLine

    CTLine CTRun CTLine ϨϯμϦϯά ଐੑͱͯ͠ઃఆ ΠχγϟϥΠβʔ CTFramesetterCreateWithAttributedString CTFramesetterCr eateFrame औΓग़͠ CTFrameGetLines औΓग़͠ CTLineGetGlyphRuns Imuutable Imuutable Imuutable Imuutable Imuutable Imuutable ಈతͳมߋ͸೉͍͠ͷͰ͏·͘ઃܭ͠·͠ΐ͏ɻ
  6. ͓͢͢ΊReference ެࣜ: ATSUIΛ࢖ͬͨUnicodeςΩετඳը ΋͏άάͬͯ΋ग़ͯ͜ͳ͍͕ɺWebArchiveʹ͋ͬͨɻ http://bit.ly/Hh7sP3 ެࣜ: Core Text Reference Attributed

    String Programming Guide Core Text String Attributes Reference NSMutableAttributedString Class Reference Strings Programming Guide for Core Foundation
  7. Reference 2 WWDC Video #110, 2010, Advanced Text Handling for

    iPhone OS #114, 2010, Advanced Cocoa Text Tips and Tricks #128, 2011, Advanced Text Processing Google ݕࡧ: “coretext filetype:pdf” “attributed string filetype:pdf” SlideShare, SpeakerDeck Github