FontBook Module Reference

New in version 0.0.6.

Control the macOS FontBook application using JXA-like syntax.

Classes:

XAFontBookApplication(properties)

A class for managing and interacting with Font Book.app.

XAFontBookDocument(properties)

A class for managing and interacting with documents in Font Book.app.

XAFontBookDocumentList(properties[, filter])

A wrapper around lists of Font Book documents that employs fast enumeration techniques.

XAFontBookFontBookAllFontsLibraryObject(...)

A class for managing and interacting with the all fonts library object in Font Book.app.

XAFontBookFontCollection(properties)

A class for managing and interacting with font collections in Font Book.app.

XAFontBookFontCollectionList(properties[, ...])

A wrapper around lists of Font Book font containers that employs fast enumeration techniques.

XAFontBookFontContainer(properties)

A class for managing and interacting with font containers in Font Book.app.

XAFontBookFontContainerList(properties[, filter])

A wrapper around lists of Font Book font containers that employs fast enumeration techniques.

XAFontBookFontDomain(properties)

A class for managing and interacting with font domains in Font Book.app.

XAFontBookFontDomainList(properties[, filter])

A wrapper around lists of Font Book font domains that employs fast enumeration techniques.

XAFontBookFontFamily(properties)

A class for managing and interacting with font families in Font Book.app.

XAFontBookFontFamilyList(properties[, filter])

A wrapper around lists of Font Book font families that employs fast enumeration techniques.

XAFontBookFontLibrary(properties)

A class for managing and interacting with font libraries in Font Book.app.

XAFontBookFontLibraryList(properties[, filter])

A wrapper around lists of Font Book font libraries that employs fast enumeration techniques.

XAFontBookTypeface(properties)

A class for managing and interacting with typefaces in Font Book.app.

XAFontBookTypefaceList(properties[, filter])

A wrapper around lists of Font Book documents that employs fast enumeration techniques.

XAFontBookWindow(properties)

A class for managing and interacting with documents in Font Book.app.

class PyXA.apps.FontBook.XAFontBookApplication(properties)[source]

Bases: XASBApplication

A class for managing and interacting with Font Book.app.

New in version 0.0.6.

Methods:

documents([filter])

Returns a list of documents matching the filter.

font_collections([filter])

Returns a list of font collections matching the filter.

font_containers([filter])

Returns a list of font containers matching the filter.

font_domains([filter])

Returns a list of font domains matching the filter.

font_families([filter])

Returns a list of font families matching the filter.

font_libraries([filter])

Returns a list of font libraries matching the filter.

typefaces([filter])

Returns a list of typefaces matching the filter.

Attributes:

fonts_library

The All Fonts library.

installation_target

The library where new fonts are installed.

name

The name of the application.

selected_collections

The currently selected collections.

selected_font_families

The currently selected font families.

selection

The currently selected typefaces.

validate_fonts_before_installing

Whether to validate fonts before installing them.

version

The version of the Font Book application.

documents(filter: dict | None = None) XAFontBookDocumentList[source]

Returns a list of documents matching the filter.

New in version 0.0.6.

font_collections(filter: dict | None = None) XAFontBookFontCollectionList[source]

Returns a list of font collections matching the filter.

New in version 0.0.6.

font_containers(filter: dict | None = None) XAFontBookFontContainerList[source]

Returns a list of font containers matching the filter.

New in version 0.0.6.

font_domains(filter: dict | None = None) XAFontBookFontDomainList[source]

Returns a list of font domains matching the filter.

New in version 0.0.6.

font_families(filter: dict | None = None) XAFontBookFontFamilyList[source]

Returns a list of font families matching the filter.

New in version 0.0.6.

font_libraries(filter: dict | None = None) XAFontBookFontLibraryList[source]

Returns a list of font libraries matching the filter.

New in version 0.0.6.

property fonts_library: XAFontBookFontBookAllFontsLibraryObject

The All Fonts library.

property installation_target: XAFontBookFontLibrary

The library where new fonts are installed.

property name: str

The name of the application.

property selected_collections: XAFontBookFontCollectionList

The currently selected collections.

property selected_font_families: XAFontBookFontFamilyList

The currently selected font families.

property selection: XAFontBookTypefaceList

The currently selected typefaces.

typefaces(filter: dict | None = None) XAFontBookTypefaceList[source]

Returns a list of typefaces matching the filter.

New in version 0.0.6.

property validate_fonts_before_installing: bool

Whether to validate fonts before installing them.

property version: str

The version of the Font Book application.

class PyXA.apps.FontBook.XAFontBookDocument(properties)[source]

Bases: XAObject

A class for managing and interacting with documents in Font Book.app.

New in version 0.0.6.

Attributes:

modified

Whether the document has been modified since its last save.

name

The name of the document.

path

The file path of the document.

property modified: bool

Whether the document has been modified since its last save.

property name: str

The name of the document.

property path: XAPath

The file path of the document.

class PyXA.apps.FontBook.XAFontBookDocumentList(properties: dict, filter: dict | None = None)[source]

Bases: XAList

A wrapper around lists of Font Book documents that employs fast enumeration techniques.

All properties of documents can be called as methods on the wrapped list, returning a list containing each document’s value for the property.

New in version 0.0.6.

Methods:

by_modified(modified)

by_name(name)

by_path(path)

modified()

name()

path()

by_modified(modified: bool) XAFontBookDocument[source]
by_name(name: str) XAFontBookDocument[source]
by_path(path: str) XAFontBookDocument[source]
modified() list[bool][source]
name() list[str][source]
path() list[str][source]
class PyXA.apps.FontBook.XAFontBookFontBookAllFontsLibraryObject(properties)[source]

Bases: XAFontBookFontDomain

A class for managing and interacting with the all fonts library object in Font Book.app.

New in version 0.0.6.

class PyXA.apps.FontBook.XAFontBookFontCollection(properties)[source]

Bases: XAObject, XAClipboardCodable

A class for managing and interacting with font collections in Font Book.app.

New in version 0.0.6.

Attributes:

display_name

The display name of the collection.

displayed_name

The display name of the collection.

enabled

Whether the collection is enabled.

name

The name of the collection.

properties

All properties of the collection.

Methods:

font_families([filter])

Returns a list of font families matching the filter.

get_clipboard_representation()

Gets a clipboard-codable representation of the collection.

typefaces([filter])

Returns a list of typefaces matching the filter.

property display_name: str

The display name of the collection.

property displayed_name: str

The display name of the collection.

property enabled: bool

Whether the collection is enabled.

font_families(filter: dict | None = None) XAFontBookFontFamilyList[source]

Returns a list of font families matching the filter.

New in version 0.0.6.

get_clipboard_representation() str[source]

Gets a clipboard-codable representation of the collection.

When the clipboard content is set to a collection, the name of the collection is added to the clipboard.

Returns:

The name of the collection

Return type:

str

New in version 0.0.8.

property name: str

The name of the collection.

property properties: dict

All properties of the collection.

typefaces(filter: dict | None = None) XAFontBookTypefaceList[source]

Returns a list of typefaces matching the filter.

New in version 0.0.6.

class PyXA.apps.FontBook.XAFontBookFontCollectionList(properties: dict, filter: dict | None = None, obj_class=None)[source]

Bases: XAList, XAClipboardCodable

A wrapper around lists of Font Book font containers that employs fast enumeration techniques.

All properties of font containers can be called as methods on the wrapped list, returning a list containing each container’s value for the property.

New in version 0.0.6.

Methods:

by_display_name(display_name)

by_displayed_name(displayed_name)

by_enabled(enabled)

by_name(name)

by_properties(properties)

display_name()

displayed_name()

enabled()

get_clipboard_representation()

Gets a clipboard-codable representation of each collection in the list.

name()

properties()

by_display_name(display_name: str) XAFontBookFontCollection[source]
by_displayed_name(displayed_name: str) XAFontBookFontCollection[source]
by_enabled(enabled: bool) XAFontBookFontCollection[source]
by_name(name: str) XAFontBookFontCollection[source]
by_properties(properties: dict) XAFontBookFontCollection[source]
display_name() list[str][source]
displayed_name() list[str][source]
enabled() list[bool][source]
get_clipboard_representation() list[str][source]

Gets a clipboard-codable representation of each collection in the list.

When the clipboard content is set to a list of collections, the name of each collection is added to the clipboard.

Returns:

The list of collection names

Return type:

list[str]

New in version 0.0.8.

name() list[str][source]
properties() list[dict][source]
class PyXA.apps.FontBook.XAFontBookFontContainer(properties)[source]

Bases: XAObject, XAClipboardCodable

A class for managing and interacting with font containers in Font Book.app.

New in version 0.0.6.

Attributes:

domain

The font domain for the container.

files

The files for the container.

id

The unique identifier of the container.

name

The name of the container.

path

The path to the main container.

properties

All properties of the container.

Methods:

font_domains([filter])

Returns a list of font domains matching the filter.

font_families([filter])

Returns a list of font families matching the filter.

get_clipboard_representation()

Gets a clipboard-codable representation of the container.

typefaces([filter])

Returns a list of typefaces matching the filter.

property domain: XAFontBookFontDomain

The font domain for the container.

property files: list[XAPath]

The files for the container.

font_domains(filter: dict | None = None) XAFontBookFontDomainList[source]

Returns a list of font domains matching the filter.

New in version 0.0.6.

font_families(filter: dict | None = None) XAFontBookFontFamilyList[source]

Returns a list of font families matching the filter.

New in version 0.0.6.

get_clipboard_representation() str[source]

Gets a clipboard-codable representation of the container.

When the clipboard content is set to a container, the name of the container is added to the clipboard.

Returns:

The name of the container

Return type:

str

New in version 0.0.8.

property id: str

The unique identifier of the container.

property name: str

The name of the container.

property path: str

The path to the main container.

property properties: dict

All properties of the container.

typefaces(filter: dict | None = None) XAFontBookTypefaceList[source]

Returns a list of typefaces matching the filter.

New in version 0.0.6.

class PyXA.apps.FontBook.XAFontBookFontContainerList(properties: dict, filter: dict | None = None)[source]

Bases: XAList, XAClipboardCodable

A wrapper around lists of Font Book font containers that employs fast enumeration techniques.

All properties of font containers can be called as methods on the wrapped list, returning a list containing each container’s value for the property.

New in version 0.0.6.

Methods:

by_domain(domain)

by_files(files)

by_id(id)

by_name(name)

by_path(path)

by_properties(properties)

domain()

files()

get_clipboard_representation()

Gets a clipboard-codable representation of each container in the list.

id()

name()

path()

properties()

by_domain(domain: XAFontBookFontDomain) XAFontBookFontContainer[source]
by_files(files: list[XAPath]) XAFontBookFontContainer[source]
by_id(id: str) XAFontBookFontContainer[source]
by_name(name: str) XAFontBookFontContainer[source]
by_path(path: str) XAFontBookFontContainer[source]
by_properties(properties: dict) XAFontBookFontContainer[source]
domain() XAFontBookFontDomainList[source]
files() list[XAPath][source]
get_clipboard_representation() list[str][source]

Gets a clipboard-codable representation of each container in the list.

When the clipboard content is set to a list of containers, the name of each container is added to the clipboard.

Returns:

The list of container names

Return type:

list[str]

New in version 0.0.8.

id() list[str][source]
name() list[str][source]
path() list[str][source]
properties() list[dict][source]
class PyXA.apps.FontBook.XAFontBookFontDomain(properties)[source]

Bases: XAFontBookFontLibrary

A class for managing and interacting with font domains in Font Book.app.

New in version 0.0.6.

class PyXA.apps.FontBook.XAFontBookFontDomainList(properties: dict, filter: dict | None = None)[source]

Bases: XAFontBookFontLibraryList

A wrapper around lists of Font Book font domains that employs fast enumeration techniques.

All properties of font domains can be called as methods on the wrapped list, returning a list containing each domain’s value for the property.

New in version 0.0.6.

class PyXA.apps.FontBook.XAFontBookFontFamily(properties)[source]

Bases: XAObject, XAClipboardCodable

A class for managing and interacting with font families in Font Book.app.

New in version 0.0.6.

Methods:

delete()

Permanently deletes the typeface.

get_clipboard_representation()

Gets a clipboard-codable representation of the font family.

typefaces([filter])

Returns a list of typefaces matching the filter.

Attributes:

display_name

The display name of the font family.

displayed_name

The display name of the font family.

duplicated

Whether teh font family contains duplicated faces.

enabled

Whether the font family is enabled.

files

The font files of the font family.

name

The name of the font family.

properties

All properties of the font family.

delete()[source]

Permanently deletes the typeface.

New in version 0.0.6.

property display_name: str

The display name of the font family.

property displayed_name: str

The display name of the font family.

property duplicated: bool

Whether teh font family contains duplicated faces.

property enabled: bool

Whether the font family is enabled.

property files: list[XAPath]

The font files of the font family.

get_clipboard_representation() str[source]

Gets a clipboard-codable representation of the font family.

When the clipboard content is set to a font family, the name of the font family is added to the clipboard.

Returns:

The name of the font family

Return type:

str

New in version 0.0.8.

property name: str

The name of the font family.

property properties: dict

All properties of the font family.

typefaces(filter: dict | None = None) XAFontBookTypefaceList[source]

Returns a list of typefaces matching the filter.

New in version 0.0.6.

class PyXA.apps.FontBook.XAFontBookFontFamilyList(properties: dict, filter: dict | None = None)[source]

Bases: XAList, XAClipboardCodable

A wrapper around lists of Font Book font families that employs fast enumeration techniques.

All properties of font families can be called as methods on the wrapped list, returning a list containing each font family’s value for the property.

New in version 0.0.6.

Methods:

by_display_name(display_name)

by_displayed_name(displayed_name)

by_duplicates(duplicated)

by_enabled(enabled)

by_files(files)

by_name(name)

by_properties(properties)

display_name()

displayed_name()

duplicated()

enabled()

files()

get_clipboard_representation()

Gets a clipboard-codable representation of each font family in the list.

name()

properties()

by_display_name(display_name: str) XAFontBookFontFamily[source]
by_displayed_name(displayed_name: str) XAFontBookFontFamily[source]
by_duplicates(duplicated: bool) XAFontBookFontFamily[source]
by_enabled(enabled: bool) XAFontBookFontFamily[source]
by_files(files: list[XAPath]) XAFontBookFontFamily[source]
by_name(name: str) XAFontBookFontFamily[source]
by_properties(properties: dict) XAFontBookFontFamily[source]
display_name() list[str][source]
displayed_name() list[str][source]
duplicated() list[bool][source]
enabled() list[bool][source]
files() list[list[XAPath]][source]
get_clipboard_representation() list[str][source]

Gets a clipboard-codable representation of each font family in the list.

When the clipboard content is set to a list of font families, the name of each font family is added to the clipboard.

Returns:

The list of font family names

Return type:

list[str]

New in version 0.0.8.

name() list[str][source]
properties() list[dict][source]
class PyXA.apps.FontBook.XAFontBookFontLibrary(properties)[source]

Bases: XAFontBookFontCollection

A class for managing and interacting with font libraries in Font Book.app.

New in version 0.0.6.

Methods:

font_containers([filter])

Returns a list of font containers matching the filter.

Attributes:

id

The unique identifier of the domain.

font_containers(filter: dict | None = None) XAFontBookFontContainerList[source]

Returns a list of font containers matching the filter.

New in version 0.0.6.

property id: str

The unique identifier of the domain.

class PyXA.apps.FontBook.XAFontBookFontLibraryList(properties: dict, filter: dict | None = None)[source]

Bases: XAFontBookFontCollectionList

A wrapper around lists of Font Book font libraries that employs fast enumeration techniques.

All properties of font libraries can be called as methods on the wrapped list, returning a list containing each library’s value for the property.

New in version 0.0.6.

class PyXA.apps.FontBook.XAFontBookTypeface(properties)[source]

Bases: XAObject, XAClipboardCodable

A class for managing and interacting with typefaces in Font Book.app.

New in version 0.0.6.

Attributes:

copyright

The copyright string for the typeface.

display_name

The display name of the typeface.

displayed_name

The display name of the typeface.

duplicated

Whether the typeface is duplicated.

enabled

Whether the typeface is enabled.

family_name

The name of the typeface's font family.

files

The font files for the typeface.

font_container

The container of the typeface.

font_family

The font family that contains the typeface.

font_type

The type of the typeface.

id

The unique identifier for the typeface.

name

The name of the typeface.

post_script_name

The PostScript font name.

properties

All properties of the typeface.

style_name

The name of the typeface's style.

Methods:

get_clipboard_representation()

Gets a clipboard-codable representation of the typeface.

property copyright: str

The copyright string for the typeface.

property display_name: str

The display name of the typeface.

property displayed_name: str

The display name of the typeface.

property duplicated: bool

Whether the typeface is duplicated.

property enabled: bool

Whether the typeface is enabled.

property family_name: str

The name of the typeface’s font family.

property files: list[XAPath]

The font files for the typeface.

property font_container: XAFontBookFontContainer

The container of the typeface.

property font_family: XAFontBookFontFamily

The font family that contains the typeface.

property font_type: str

The type of the typeface.

get_clipboard_representation() str[source]

Gets a clipboard-codable representation of the typeface.

When the clipboard content is set to a typeface, the name of the typeface is added to the clipboard.

Returns:

The name of the typeface

Return type:

str

New in version 0.0.8.

property id: str

The unique identifier for the typeface.

property name: str

The name of the typeface.

property post_script_name: str

The PostScript font name.

property properties: dict

All properties of the typeface.

property style_name: str

The name of the typeface’s style.

class PyXA.apps.FontBook.XAFontBookTypefaceList(properties: dict, filter: dict | None = None)[source]

Bases: XAList, XAClipboardCodable

A wrapper around lists of Font Book documents that employs fast enumeration techniques.

All properties of documents can be called as methods on the wrapped list, returning a list containing each document’s value for the property.

New in version 0.0.6.

Methods:

by_copyright(copyright)

by_display_name(display_name)

by_displayed_name(displayed_name)

by_duplicated(duplicated)

by_enabled(enabled)

by_family_name(family_name)

by_files(files)

by_font_container(font_container)

by_font_family(font_family)

by_font_type(font_type)

by_id(id)

by_name(name)

by_post_script_name(post_script_name)

by_properties(properties)

by_style_name(style_name)

copyright()

display_name()

displayed_name()

duplicated()

enabled()

family_name()

files()

font_container()

font_family()

font_type()

get_clipboard_representation()

Gets a clipboard-codable representation of each typeface in the list.

id()

name()

post_script_name()

properties()

style_name()

by_display_name(display_name: str) XAFontBookTypeface[source]
by_displayed_name(displayed_name: str) XAFontBookTypeface[source]
by_duplicated(duplicated: bool) XAFontBookTypeface[source]
by_enabled(enabled: bool) XAFontBookTypeface[source]
by_family_name(family_name: str) XAFontBookTypeface[source]
by_files(files: list[XAPath]) XAFontBookTypeface[source]
by_font_container(font_container: XAFontBookFontContainer) XAFontBookTypeface[source]
by_font_family(font_family: XAFontBookFontFamily) XAFontBookTypeface[source]
by_font_type(font_type: str) XAFontBookTypeface[source]
by_id(id: str) XAFontBookTypeface[source]
by_name(name: str) XAFontBookTypeface[source]
by_post_script_name(post_script_name: str) XAFontBookTypeface[source]
by_properties(properties: dict) XAFontBookTypeface[source]
by_style_name(style_name: str) XAFontBookTypeface[source]
copyright() list[str][source]
display_name() list[str][source]
displayed_name() list[str][source]
duplicated() list[bool][source]
enabled() list[bool][source]
family_name() list[str][source]
files() list[XAPath][source]
font_container() XAFontBookFontContainerList[source]
font_family() XAFontBookFontFamilyList[source]
font_type() list[str][source]
get_clipboard_representation() list[str][source]

Gets a clipboard-codable representation of each typeface in the list.

When the clipboard content is set to a list of typefaces, the name of each typeface is added to the clipboard.

Returns:

The list of typeface names

Return type:

list[str]

New in version 0.0.8.

id() list[str][source]
name() list[str][source]
post_script_name() list[str][source]
properties() list[dict][source]
style_name() list[str][source]
class PyXA.apps.FontBook.XAFontBookWindow(properties)[source]

Bases: XASBWindow

A class for managing and interacting with documents in Font Book.app.

New in version 0.0.6.

Attributes:

floating

Whether the window floats.

modal

Whether the window is a modal window.

titled

Whether the window has a title bar.

property floating: bool

Whether the window floats.

property modal: bool

Whether the window is a modal window.

property titled: bool

Whether the window has a title bar.