API Notes: CoreText framework¶
The full API is described in Apple’s documentation, both the C and Objective-C APIs are available (but see the API Notes below).
These bindings are accessed through the CoreText package (that is, import CoreText).
API Notes¶
CTFontCreateWithQuickdrawInstanceThis function is not supported by PyObjC.
CTFrameGetLineOriginsThe
lengthof therangeargument must not be0.CTParagraphStyleSettingThis structure is not yet supported.
CTFontGetPlatformFontThis function is not supported, because the ATS framework does not have wrappers.
CTFontCopyAvailableTablesThis function returns a python tuple, not a
CFArrayRef. That’s because the C version returns a CFArray that doesn’t contain objects.CTParagraphStyleGetValueForSpecifierThis returns a python string containing the actual value, you’ll have to decode this using the
structmodule to get at the real value.CTParagraphStyleCreateandCTParagraphStyleGetValueForSpecifierBoth API’s have a rather low-level interface in Python: you’ll have to encode the value to a python buffer (string), or decode it from such a buffer yourself using the
structmodule.As a convenience the sizes of value types are defined as
sizeof_TYPE, for examplesizeof_CGFloat.A special case is
kCTParagraphStyleSpecifierTabStops, it’s value should be an instance ofNSArraywhen using withCTParagraphStyleCreate. Note that arbitrary Python sequences won’t work here.Use
CTParagraphStyleGetTabStopsto fetch the tabstops from a style object, usingCTParagraphStyleGetValueSpecifiekeris not supported with keykCTParagraphStyleSpecifierTabStops.All types and constants defined in “SFNTLayoutTypes.h” and “SFNTTypes.h” are not yet supported
CTRunDelegateGetRefConThis function is only supported when the runDelegate argument was created in Python.
CTRunDelegateCreateThe first argument is a tuple with the
getAscent,getDescentandgetWidthfunctions, the second argument is an arbitrary python object.