The font-discovery Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The font-discovery Reference Manual

This is the font-discovery Reference Manual, version 1.0.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Thu Sep 15 04:45:49 2022 GMT+0.

Table of Contents


1 Introduction

## About Font-Discovery
This is a library to find system font files. It works on systems with DirectWrite (Windows), CoreText (macOS, iOS), and FontConfig (Linux, BSD). It does not have any foreign dependencies that aren't already directly available on the system.

## How To
You can list all fonts by using ``list-fonts``, or find a specific font using ``find-font``. Both of these functions take a number of arguments to query for fonts with specific properties (``family``, ``slant``, ``weight``, ``spacing``, ``stretch``). Both of them return ``font`` instances, from which you can query the precise properties, as well as their font file location with ``file``.


2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 font-discovery

Find system font files matching a font spec.

Maintainer

Nicolas Hafner <shinmera@tymoon.eu>

Author

Nicolas Hafner <shinmera@tymoon.eu>

Home Page

https://github.com/Shinmera/font-discovery

License

zlib

Version

1.0.0

Defsystem Dependency

trivial-features (system).

Dependencies
  • documentation-utils (system).
  • trivial-indent (system).
  • com-on (system)., for feature :windows
  • cffi (system).
Source

font-discovery.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 font-discovery/font-discovery.asd

Source

font-discovery.asd.

Parent Component

font-discovery (system).

ASDF Systems

font-discovery.


3.1.2 font-discovery/package.lisp

Source

font-discovery.asd.

Parent Component

font-discovery (system).

Packages

org.shirakumo.font-discovery.


3.1.3 font-discovery/common.lisp

Dependency

package.lisp (file).

Source

font-discovery.asd.

Parent Component

font-discovery (system).

Public Interface
Internals

3.1.4 font-discovery/fontconfig.lisp

If Feature

:linux

Dependency

common.lisp (file).

Source

font-discovery.asd.

Parent Component

font-discovery (system).

Internals

3.1.5 font-discovery/linux.lisp

If Feature

:linux

Dependencies
Source

font-discovery.asd.

Parent Component

font-discovery (system).

Public Interface
Internals

3.1.6 font-discovery/coretext.lisp

If Feature

:darwin

Dependencies
Source

font-discovery.asd.

Parent Component

font-discovery (system).


3.1.7 font-discovery/macos.lisp

If Feature

:darwin

Dependencies
Source

font-discovery.asd.

Parent Component

font-discovery (system).


3.1.8 font-discovery/directwrite.lisp

If Feature

:win32

Dependencies
Source

font-discovery.asd.

Parent Component

font-discovery (system).


3.1.9 font-discovery/windows.lisp

If Feature

:win32

Dependencies
Source

font-discovery.asd.

Parent Component

font-discovery (system).


3.1.10 font-discovery/documentation.lisp

Dependencies
Source

font-discovery.asd.

Parent Component

font-discovery (system).


4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 org.shirakumo.font-discovery

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


5.1.1 Ordinary functions

Function: deinit ()

Uninitializes the library.

This will shut down foreign libraries and deallocate cache memory. Returns T if it did so.

It will not close the foreign libraries that were opened by INIT.

It is safe to call this function multiple times.

See INIT

Package

org.shirakumo.font-discovery.

Source

linux.lisp.

Function: find-font (&rest args &key family slant weight spacing stretch)

Attempts to find a font with specifications that match the query as close as possible.

Returns a FONT instance, or NIL if no match can be found.
Note that on some systems the returned font may not be an exact
match, but rather a closest approximation.

For the possible values of the arguments, see the FONT class and its
reader functions.

Doing this will automatically call INIT.

See LIST-FONTS
See INIT
See FONT

Package

org.shirakumo.font-discovery.

Source

linux.lisp.

Function: init ()

Initializes the library for use.

This will load foreign libraries and set up internal state if necessary. Returns T if it did so.

It is safe to call this function multiple times.

See REFRESH
See DEINIT

Package

org.shirakumo.font-discovery.

Source

linux.lisp.

Function: list-fonts (&rest args &key family slant weight spacing stretch)

Returns a list of fonts with specifications that match the query.

Returns a list of FONT instances that match the query.

For the possible values of the arguments, see the FONT class and its reader functions.

Doing this will automatically call INIT.

See FIND-FONT
See INIT
See FONT

Package

org.shirakumo.font-discovery.

Source

linux.lisp.

Function: refresh ()

Refreshes the font cache.

This should cause new system fonts to be recognised. You should call this function whenever you think the list of system fonts might have changed. Returns T if the cache was updated.

Doing this will automatically call INIT.

See INIT

Package

org.shirakumo.font-discovery.

Source

linux.lisp.


5.1.2 Generic functions

Generic Reader: family (object)

Returns the font family name.

See FONT

Package

org.shirakumo.font-discovery.

Methods
Reader Method: family ((font font))

automatically generated reader method

Source

common.lisp.

Target Slot

family.

Generic Reader: file (object)

Returns the pathname to the font file.

This may be a TTF or OTF file.

See FONT

Package

org.shirakumo.font-discovery.

Methods
Reader Method: file ((font font))

automatically generated reader method

Source

common.lisp.

Target Slot

file.

Generic Reader: slant (object)

Returns the slant of the font.

This may be one of the following keywords, in order of increasing slant, or a system-dependent numeric value for the font’s slant.

:ROMAN
:ITALIC
:OBLIQUE

See FONT

Package

org.shirakumo.font-discovery.

Methods
Reader Method: slant ((font font))

automatically generated reader method

Source

common.lisp.

Target Slot

slant.

Generic Reader: spacing (object)

Returns the font’s spacing.

This may be one of the following keywords, in order of increasing spacing, or a system-dependent numeric value for the font’s spacing.

:PROPORTIONAL
:DUALSPACE
:MONOSPACE
:CHARCELL

See FONT

Package

org.shirakumo.font-discovery.

Methods
Reader Method: spacing ((font font))

automatically generated reader method

Source

common.lisp.

Target Slot

spacing.

Generic Reader: stretch (object)

Returns the font’s stretch factor.

This may be one of the following keywords, in order of increasing stretch factor, or a system-dependent numeric value for the font’s stretch factor.

:ULTRA-CONDENSED
:EXTRA-CONDENSED
:CONDENSED
:SEMI-CONDENSED
:NORMAL
:SEMI-EXPANDED
:EXPANDED
:EXTRA-EXPANDED
:ULTRA-EXPANDED

See FONT

Package

org.shirakumo.font-discovery.

Methods
Reader Method: stretch ((font font))

automatically generated reader method

Source

common.lisp.

Target Slot

stretch.

Generic Reader: weight (object)

Returns the weight of the font.

This may be one of the following keywords, in order of increasing weight, or a system-dependent numeric value for the font’s weight.

:THIN
:EXTRA-LIGHT
:LIGHT
:SEMI-LIGHT
:BOOK
:REGULAR
:MEDIUM
:SEMI-BOLD
:BOLD
:EXTRA-BOLD
:BLACK
:EXTRA-BLACK

See FONT

Package

org.shirakumo.font-discovery.

Methods
Reader Method: weight ((font font))

automatically generated reader method

Source

common.lisp.

Target Slot

weight.


5.1.3 Standalone methods

Method: print-object ((font font) stream)
Source

common.lisp.


5.1.4 Classes

Class: font

A representation of a system font and its font attributes.

See FILE
See FAMILY
See SLANT
See WEIGHT
See SPACING
See STRETCH

Package

org.shirakumo.font-discovery.

Source

common.lisp.

Direct methods
Direct slots
Slot: file
Initform

(error "file required.")

Initargs

:file

Readers

file.

Writers

This slot is read-only.

Slot: family
Initform

(error "family required.")

Initargs

:family

Readers

family.

Writers

This slot is read-only.

Slot: slant
Initform

:roman

Initargs

:slant

Readers

slant.

Writers

This slot is read-only.

Slot: weight
Initform

:regular

Initargs

:weight

Readers

weight.

Writers

This slot is read-only.

Slot: spacing
Initform

:proportional

Initargs

:spacing

Readers

spacing.

Writers

This slot is read-only.

Slot: stretch
Initform

:normal

Initargs

:stretch

Readers

stretch.

Writers

This slot is read-only.


5.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.1 Special variables

Special Variable: *config*
Package

org.shirakumo.font-discovery.

Source

linux.lisp.

Special Variable: +family+
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Special Variable: +file+
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Special Variable: +size+
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Special Variable: +slant+
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Special Variable: +spacing+
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Special Variable: +weight+
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Special Variable: +width+
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.


5.2.2 Macros

Macro: with-protection (unwind &body protected)
Package

org.shirakumo.font-discovery.

Source

common.lisp.

Macro: with-result (result &body success)
Package

org.shirakumo.font-discovery.

Source

linux.lisp.


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.3 Ordinary functions

Function: config-destroy (config)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: config-substitute (config pattern kind)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: create-pattern ()
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: create-range (begin end)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: default-substitute (pattern)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: destroy-pattern (pattern)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: destroy-range (range)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: destroy-set (set)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: fini ()
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: font-match (config pattern result)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: font-set-fonts (pointer-to-font-set)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: (setf font-set-fonts) (pointer-to-font-set)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: font-set-nfont (pointer-to-font-set)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: (setf font-set-nfont) (pointer-to-font-set)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: font-set-sfont (pointer-to-font-set)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: (setf font-set-sfont) (pointer-to-font-set)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: font-sort (config pattern trim charset result)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: init-load-config-and-fonts ()
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: init-pattern (pattern &key family slant weight spacing stretch)
Package

org.shirakumo.font-discovery.

Source

linux.lisp.

Function: maybe-enum (type thing)
Package

org.shirakumo.font-discovery.

Source

common.lisp.

Function: maybe-enum-val (type thing)
Package

org.shirakumo.font-discovery.

Source

common.lisp.

Function: parse-file (string)
Package

org.shirakumo.font-discovery.

Source

common.lisp.

Function: pattern-add-integer (pattern object i)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: pattern-add-range (pattern object range)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: pattern-add-string (pattern object string)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: pattern-get-double (pattern object n double)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: pattern-get-integer (pattern object n integer)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: pattern-get-range (pattern object id range)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: pattern-get-string (pattern object n string)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: range-get (range begin end)
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Function: translate-match (font)
Package

org.shirakumo.font-discovery.

Source

linux.lisp.


5.2.4 Classes

Class: font-set-tclass
Package

org.shirakumo.font-discovery.

Source

fontconfig.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   (  
C   D   F   G   I   L   M   P   R   S   T   W  
Index Entry  Section

(
(setf font-set-fonts): Private ordinary functions
(setf font-set-nfont): Private ordinary functions
(setf font-set-sfont): Private ordinary functions

C
config-destroy: Private ordinary functions
config-substitute: Private ordinary functions
create-pattern: Private ordinary functions
create-range: Private ordinary functions

D
default-substitute: Private ordinary functions
deinit: Public ordinary functions
destroy-pattern: Private ordinary functions
destroy-range: Private ordinary functions
destroy-set: Private ordinary functions

F
family: Public generic functions
family: Public generic functions
file: Public generic functions
file: Public generic functions
find-font: Public ordinary functions
fini: Private ordinary functions
font-match: Private ordinary functions
font-set-fonts: Private ordinary functions
font-set-nfont: Private ordinary functions
font-set-sfont: Private ordinary functions
font-sort: Private ordinary functions
Function, (setf font-set-fonts): Private ordinary functions
Function, (setf font-set-nfont): Private ordinary functions
Function, (setf font-set-sfont): Private ordinary functions
Function, config-destroy: Private ordinary functions
Function, config-substitute: Private ordinary functions
Function, create-pattern: Private ordinary functions
Function, create-range: Private ordinary functions
Function, default-substitute: Private ordinary functions
Function, deinit: Public ordinary functions
Function, destroy-pattern: Private ordinary functions
Function, destroy-range: Private ordinary functions
Function, destroy-set: Private ordinary functions
Function, find-font: Public ordinary functions
Function, fini: Private ordinary functions
Function, font-match: Private ordinary functions
Function, font-set-fonts: Private ordinary functions
Function, font-set-nfont: Private ordinary functions
Function, font-set-sfont: Private ordinary functions
Function, font-sort: Private ordinary functions
Function, init: Public ordinary functions
Function, init-load-config-and-fonts: Private ordinary functions
Function, init-pattern: Private ordinary functions
Function, list-fonts: Public ordinary functions
Function, maybe-enum: Private ordinary functions
Function, maybe-enum-val: Private ordinary functions
Function, parse-file: Private ordinary functions
Function, pattern-add-integer: Private ordinary functions
Function, pattern-add-range: Private ordinary functions
Function, pattern-add-string: Private ordinary functions
Function, pattern-get-double: Private ordinary functions
Function, pattern-get-integer: Private ordinary functions
Function, pattern-get-range: Private ordinary functions
Function, pattern-get-string: Private ordinary functions
Function, range-get: Private ordinary functions
Function, refresh: Public ordinary functions
Function, translate-match: Private ordinary functions

G
Generic Function, family: Public generic functions
Generic Function, file: Public generic functions
Generic Function, slant: Public generic functions
Generic Function, spacing: Public generic functions
Generic Function, stretch: Public generic functions
Generic Function, weight: Public generic functions

I
init: Public ordinary functions
init-load-config-and-fonts: Private ordinary functions
init-pattern: Private ordinary functions

L
list-fonts: Public ordinary functions

M
Macro, with-protection: Private macros
Macro, with-result: Private macros
maybe-enum: Private ordinary functions
maybe-enum-val: Private ordinary functions
Method, family: Public generic functions
Method, file: Public generic functions
Method, print-object: Public standalone methods
Method, slant: Public generic functions
Method, spacing: Public generic functions
Method, stretch: Public generic functions
Method, weight: Public generic functions

P
parse-file: Private ordinary functions
pattern-add-integer: Private ordinary functions
pattern-add-range: Private ordinary functions
pattern-add-string: Private ordinary functions
pattern-get-double: Private ordinary functions
pattern-get-integer: Private ordinary functions
pattern-get-range: Private ordinary functions
pattern-get-string: Private ordinary functions
print-object: Public standalone methods

R
range-get: Private ordinary functions
refresh: Public ordinary functions

S
slant: Public generic functions
slant: Public generic functions
spacing: Public generic functions
spacing: Public generic functions
stretch: Public generic functions
stretch: Public generic functions

T
translate-match: Private ordinary functions

W
weight: Public generic functions
weight: Public generic functions
with-protection: Private macros
with-result: Private macros

Jump to:   (  
C   D   F   G   I   L   M   P   R   S   T   W  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   D   F   L   M   O   P   S   W  
Index Entry  Section

C
Class, font: Public classes
Class, font-set-tclass: Private classes
common.lisp: The font-discovery/common․lisp file
coretext.lisp: The font-discovery/coretext․lisp file

D
directwrite.lisp: The font-discovery/directwrite․lisp file
documentation.lisp: The font-discovery/documentation․lisp file

F
File, common.lisp: The font-discovery/common․lisp file
File, coretext.lisp: The font-discovery/coretext․lisp file
File, directwrite.lisp: The font-discovery/directwrite․lisp file
File, documentation.lisp: The font-discovery/documentation․lisp file
File, font-discovery.asd: The font-discovery/font-discovery․asd file
File, fontconfig.lisp: The font-discovery/fontconfig․lisp file
File, linux.lisp: The font-discovery/linux․lisp file
File, macos.lisp: The font-discovery/macos․lisp file
File, package.lisp: The font-discovery/package․lisp file
File, windows.lisp: The font-discovery/windows․lisp file
font: Public classes
font-discovery: The font-discovery system
font-discovery.asd: The font-discovery/font-discovery․asd file
font-set-tclass: Private classes
fontconfig.lisp: The font-discovery/fontconfig․lisp file

L
linux.lisp: The font-discovery/linux․lisp file

M
macos.lisp: The font-discovery/macos․lisp file

O
org.shirakumo.font-discovery: The org․shirakumo․font-discovery package

P
Package, org.shirakumo.font-discovery: The org․shirakumo․font-discovery package
package.lisp: The font-discovery/package․lisp file

S
System, font-discovery: The font-discovery system

W
windows.lisp: The font-discovery/windows․lisp file

Jump to:   C   D   F   L   M   O   P   S   W