Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Cocoa text system

From Wikipedia, the free encyclopedia

TheCocoa text system (formerly known simply by the primary class nameNSText) is the linked network ofclasses,protocols,interfaces andobjects that providetypography andtext field editing capabilities and toCocoa applications onApple'smacOS, where it is the primary text-handling system.[1] Although "extremely complex", the standard text-handling abilities of the Cocoa text system have been widely praised as without peer.[2][3]It is possible to implement a fully featuredrich text editor in only a few lines of code.[4][5]

Formerly embodied[6] in developerNeXT Inc.'sOpenStepAPI specification, and implemented in NeXT'sOPENSTEP operating system, and probably also in the earlierNeXTSTEP[citation needed] platform, Cocoa's NSText has additionally been implemented via the OpenStep API specification successfully in third-party implementations such as thefree-and-open-sourceGNUstep.[6]

The Cocoa text system uses aModel–View–Controllerdesign pattern.[7] The view layer is handled by NSTextView and NSTextField, NSLayoutManager and NSTextContainer are the controller layer, and NSTextStorage (amutable attributedstring subclass) is the model.[8]

The Cocoa text system also interacts withServices to providestandard streams functionality in a GUI environment. Users interact with two classes, NSTextField (providing single-line edit fields) or NSTextView (providing multi-line editing). Each NSTextField uses ashared instance of a NSTextView called the "field editor". This was done to reduce high memory requirements that would arise if every field implemented its own NSTextViewobject graph when only one field can actually havefocus at any time.[9]

Cocoa adopts manyEmacs keybindings familiar to programmers,[10] and the default text editing keyboard shortcuts can be overridden and new custom shortcuts can be created, by creating and editing related configuration files.[11]

References

[edit]
  1. ^Apple Inc. (2014-02-11)."About the Cocoa Text System".Cocoa Text Architecture Guide. Retrieved2023-02-19.
  2. ^Anguish, Scott; Buck, Erik M.; Yacktman, Donald A. (2003).Cocoa Programming. Sams.ISBN 9780672322303.
  3. ^"Arise Aqua!".You'll build a word processor capable of handling kerning, justification, sub and superscripting, full Unicode support, spell checking, multiple font and paragraph styles, drag and drop of embedded graphics and colors, rulers with adjustable tab stops, reading and writing of conforming RTFD files, all in less than 13 lines of code! You cannot do this in any other development environment on the planet.
  4. ^"Rich Text Handling".O'Reilly Commons. 2008-03-07. Archived fromthe original on 2016-07-21.
  5. ^"Getting Started Developing For Mac OS X".There is very little custom code in TE and what is there is basically only the code necessary to make the AppKit behave like a text editor.
  6. ^ab"GNUstep". gnustep.org. Retrieved2020-08-16.
  7. ^"The Cocoa text system's architecture is both modular and layered to enhance its ease of use and flexibility. Its modular design reflects the Model–View–Controller paradigm (originating with Smalltalk-80) where the data, its visual representation, and the logic that links the two are represented by separate objects. In the case of the text system, NSTextStorage holds the model's text data, NSTextContainer models the geometry of the layout area, NSTextView presents the view, and NSLayoutManager intercedes as the controller to make sure that the data and its representation onscreen stay in agreement".
  8. ^Bright, Peter (2008-06-01)."From Win32 to Cocoa: a Windows user's would-be conversion to Mac OS X, Part III".Ars Technica. Retrieved2023-02-19.
  9. ^Dovey, James; Furrow, Ashley Alonzo Hale (4 January 2013).Beginning Objective C. Apress.ISBN 9781430243694.
  10. ^Rus, Jacob (2006-03-20)."Customizing the Cocoa Text System". Archived fromthe original on 2018-10-07.
  11. ^"Text System Defaults and Key Bindings".Apple Developer Documentation Archive. September 9, 2013. Archived fromthe original on March 10, 2024. Retrieved2024-01-18.

External links

[edit]
Stub icon

This Macintosh-related article is astub. You can help Wikipedia byexpanding it.

Retrieved from "https://en.wikipedia.org/w/index.php?title=Cocoa_text_system&oldid=1258633341"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp