Registry / serialization / pyobjc-framework-coretext

pyobjc-framework-coretext

JSON →
library12.2.2pypypiunverified

This library provides Python wrappers for the CoreText framework on macOS, enabling Python applications to interact with macOS's advanced text layout and font rendering capabilities. It is part of the larger PyObjC project, which bridges Python and Objective-C/Cocoa. The current version is 12.1, and releases typically align with new macOS SDKs and Python versions.

pip install pyobjc-framework-coretext
INSTALL
IMPORT
SIG · PYOBJC-FRAMEWORK-C
P
pyobjc-framework-coretext
serializationpythonv12.2.2
Install
Import
Disk
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CTFontCreateWithFontDescriptor
from CoreText import CTFontCreateWithFontDescriptor
CTFontDescriptorCreateWithNameAndSize
from CoreText import CTFontDescriptorCreateWithNameAndSize

This example demonstrates how to import and use basic CoreText functions to create and inspect a font object. It checks for the framework's availability and then uses `CTFontDescriptorCreateWithNameAndSize` and `CTFontCreateWithFontDescriptor` to instantiate a font, finally printing its display name.

from CoreText import CTFontDescriptorCreateWithNameAndSize, CTFontCreateWithFontDescriptor, CTFontGetDisplayName from Foundation import NSBundle # Check if CoreText is available (generally true on macOS) if NSBundle.bundleWithPath_('/System/Library/Frameworks/CoreText.framework'): print('CoreText framework is available.') # Create a font descriptor for Helvetica at 16 points font_descriptor = CTFontDescriptorCreateWithNameAndSize('Helvetica', 16.0) if font_descriptor: # Create a CTFontRef object from the descriptor font = CTFontCreateWithFontDescriptor(font_descriptor, 0.0) # 0.0 for default font matrix if font: font_name = CTFontGetDisplayName(font) print(f'Successfully created font: {font_name}') print(f'Font object type: {type(font)}') else: print('Failed to create font from descriptor.') else: print('Failed to create font descriptor.') else: print('CoreText framework not found on this system.')
Debug
Known issues
breakingPyObjC has periodically dropped support for older Python versions. Version 12.0 dropped support for Python 3.9, and version 11.0 dropped support for Python 3.8. Ensure your Python version meets the minimum requirement (currently Python 3.10+ for v12.x).
fix
Upgrade to a supported Python version (e.g., Python 3.10 or newer for PyObjC 12.x) or use an older PyObjC version that supports your Python runtime.
affects: >=11.0
breakingThe behavior of `__init__` methods in Python subclasses of Objective-C classes, particularly when a custom `__new__` method is present, changed in v10.3 and was partially reverted in v10.3.1. In v10.3, `__init__` could not be used when PyObjC provided the `__new__`. In v10.3.1, this was relaxed for user-defined `__new__` methods, but `__init__` still cannot be used with PyObjC's default `__new__`.
fix
Review custom class implementations inheriting from Objective-C objects, especially those overriding `__new__` and `__init__`. Prefer to perform initialization logic within `__new__` or Objective-C designated initializers when possible, or ensure `__init__` is correctly called in cases where it is supported.
affects: 10.3 - 10.3.1
breakingPyObjC v11.1 changed its Automatic Reference Counting (ARC) behavior for methods in the 'init' family to align with `clang`'s documentation. This means that such methods now correctly 'steal' a reference to `self` and return a new reference, which might alter object lifecycle if your code relied on the previous PyObjC behavior.
fix
If you are working with Objective-C objects directly, especially custom initializers, carefully review reference counting and object lifecycle. You might need to adjust manual retain/release calls or object ownership in more complex scenarios, although Python's garbage collection usually handles this.
affects: >=11.1
gotchaPyObjC's support for free-threading (PEP 703) introduced in Python 3.13 is experimental as of v11.0. While efforts have been made to support it, it may not be fully stable or correct for all use cases. It was explicitly stated as 'not supported' in earlier 3.13-compatible PyObjC releases (v10.3).
fix
Avoid using PyObjC with Python 3.13's free-threading mode in production environments until this feature is declared stable and fully supported by PyObjC. Stick to the default GIL-enabled mode for now.
affects: >=10.3
Upgrade
Version history
12.2.2latest on PyPI · released Aug 11, 2026
Audit
Dependencies
pyobjc-corerequiredProvides the core bridge between Python and Objective-C, essential for all PyObjC framework bindings.
Agent activity
14 hits · last 30 days
node
12
Resources