简体   繁体   English

iOS的文本布局框架

[英]Text layout framework for iOS

Aside from Webviews, are there any text layout frameworks on iOS for custom views? 除了Webviews,iOS上是否有用于自定义视图的文本布局框架? OpenGL could work fine aswell as something UIView -based. OpenGL可以正常工作以及基于UIView的东西。

Think Metro UI-ish, and I'd really enjoy templates and some sort of adaptive capabilities for landscape, portrait, ipad vs iphone, etc. 想想Metro UI-ish,我真的很喜欢模板和某种适用于横向,肖像,ipad和iphone等的自适应功能。

CoreText.framework would be a good starting point. CoreText.framework将是一个很好的起点。 It's a 'Core' framework, which integrates well with CoreGraphics. 它是一个'核心'框架,与CoreGraphics很好地集成。 If you want UIView-centric rendering, prepare to write some wrappers. 如果您想要以UIView为中心的渲染,请准备编写一些包装器。

A high level alternative to CoreText.framework would be to use NSAttributedString in UITextView s (ios6 or greater). CoreText.framework的高级替代方法是在UITextView (ios6或更高版本)中使用NSAttributedString

Here's the high level overview: 这是高级概述:

Core Text provides a modern, low-level programming interface for laying out text and handling fonts. Core Text提供了一个现代的低级编程接口,用于布置文本和处理字体。 The Core Text layout engine is designed for high performance, ease of use, and close integration with Core Foundation. Core Text布局引擎旨在实现高性能,易用性以及与Core Foundation的紧密集成。 The text layout API provides high-quality typesetting, including character-to-glyph conversion, with ligatures, kerning, and so on. 文本布局API提供高质量的排版,包括字符到字形的转换,带有连字,字距调整等。 The complementary Core Text font technology provides automatic font substitution (cascading), font descriptors and collections, easy access to font metrics and glyph data, and many other features. 互补的Core Text字体技术提供自动字体替换(级联),字体描述符和集合,轻松访问字体度量和字形数据以及许多其他功能。

Multicore Considerations: All individual functions in Core Text are thread safe. 多核注意事项:Core Text中的所有单个函数都是线程安全的。 Font objects (CTFont, CTFontDescriptor, and associated objects) can be used by simultaneously by multiple operations, work queues, or threads. 字体对象(CTFont,CTFontDescriptor和关联对象)可以由多个操作,工作队列或线程同时使用。 However, the layout objects (CTTypesetter, CTFramesetter, CTRun, CTLine, CTFrame, and associated objects) should be used in a single operation, work queue, or thread. 但是,布局对象(CTTypesetter,CTFramesetter,CTRun,CTLine,CTFrame和关联对象)应该在单个操作,工作队列或线程中使用。

Check out DTRichTextEditor by Cocoanetics. 查看Cocoanetics的DTRichTextEditor。 They offer the free DTCoreText that I've used for over a year now with great success (to display HTML and rich text). 他们提供免费的DTCoreText,我已经使用了一年多,取得了巨大的成功(显示HTML和富文本)。 This is one link I just found but you can just look at the Cocoanetics site too (DTCoreText is free, the editor has a cost to it). 这是我刚发现的一个链接,但你也可以看一下Cocoanetics网站(DTCoreText是免费的,编辑器有成本)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM