理解NSTypesetter 和 NSATSTypesetter

时间:2021-03-06 04:16:15

先说通常意义上的typeset(排字、排版),然后再说NSTypesetter 和 NSATSTypesetter,最后是它们的区别。

Typesetting is the composition of text by means of types.

这里的type是什么意思呢?In typesetting by hand compositing, a sort or type is a piece of type representing a particular letter or symbol, cast from a matrix mould and assembled with other sorts bearing additional letters into lines of type to make up a forme from which a page is printed.

在手工排版时,一个sort或者type是一块文字代表由矩阵模浇筑的一个字母或者符号,然后和其他sorts和额外的字母组装在一行行的type中,从而构成一个印板,用这个印板就可以打印一页出来。

理解NSTypesetter 和 NSATSTypesetter

Diagram of a cast metal sort. a face, b body or shank, c point size, 1 shoulder, 2 nick, 3 groove, 4 foot.一个金属浇筑字模,a是face,

Typesetting requires the prior process of designing a font and storing it in some manner. Typesetting is the retrieval of the stored letters (called sorts in mechanical systems and glyphs in digital systems) and the ordering of them according to a language's orthography for visual display.

越往下看,觉得NSTypesetter的水挺深,有点犹豫要不要继续下去,走的有点远。要继承NSTypesetter,需要override 一共19个方法,要想能正确的实现这个子类,就必须对这19个方法应该干什么非常清楚。而且没有实例代码供研究,所以暂时先到此为止。

NSATSTypesetter encapsulates the advanced typesetting capabilities of Core Text. NSATSTypesetter provides enhanced line and character spacing accuracy and supports more languages, including bidirectional languages, than the original, built-in typesetter class NSSimpleHorizontalTypesetter (which is deprecated in OS X version 10.4 and later).

Reference

1. https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSATSTypesetter_Class/Reference/Reference.html

2. http://en.wikipedia.org/wiki/Sort_(typesetting)