The font-discovery Reference Manual
Table of Contents
The font-discovery Reference Manual
This is the font-discovery Reference Manual, version 1.0.0,
generated automatically by Declt version 3.0 "Montgomery Scott"
on Sun May 15 04:46:27 2022 GMT+0.
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.
2.1 font-discovery
- Maintainer
Nicolas Hafner <shinmera@tymoon.eu>
- Author
Nicolas Hafner <shinmera@tymoon.eu>
- Home Page
https://github.com/Shinmera/font-discovery
- License
zlib
- Description
Find system font files matching a font spec.
- Version
1.0.0
- Defsystem Dependency
trivial-features
- Dependencies
- documentation-utils
- trivial-indent
- com-on (for feature windows)
- cffi
- Source
font-discovery.asd (file)
- Components
-
3 Files
Files are sorted by type and then listed depth-first from the systems
components trees.
3.1 Lisp
3.1.1 font-discovery.asd
- Location
font-discovery.asd
- Systems
font-discovery (system)
3.1.2 font-discovery/package.lisp
- Parent
font-discovery (system)
- Location
package.lisp
- Packages
org.shirakumo.font-discovery
3.1.3 font-discovery/common.lisp
- Dependency
package.lisp (file)
- Parent
font-discovery (system)
- Location
common.lisp
- Exported Definitions
-
- Internal Definitions
-
3.1.4 font-discovery/fontconfig.lisp
- If Feature
linux
- Dependency
common.lisp (file)
- Parent
font-discovery (system)
- Location
fontconfig.lisp
- Internal Definitions
-
3.1.5 font-discovery/linux.lisp
- If Feature
linux
- Dependencies
-
- Parent
font-discovery (system)
- Location
linux.lisp
- Exported Definitions
-
- Internal Definitions
-
3.1.6 font-discovery/coretext.lisp
- If Feature
darwin
- Dependencies
-
- Parent
font-discovery (system)
- Location
coretext.lisp
3.1.7 font-discovery/macos.lisp
- If Feature
darwin
- Dependencies
-
- Parent
font-discovery (system)
- Location
macos.lisp
3.1.8 font-discovery/directwrite.lisp
- If Feature
win32
- Dependencies
-
- Parent
font-discovery (system)
- Location
directwrite.lisp
3.1.9 font-discovery/windows.lisp
- If Feature
win32
- Dependencies
-
- Parent
font-discovery (system)
- Location
windows.lisp
3.1.10 font-discovery/documentation.lisp
- Dependencies
-
- Parent
font-discovery (system)
- Location
documentation.lisp
4 Packages
Packages are listed by definition order.
4.1 org.shirakumo.font-discovery
- Source
package.lisp (file)
- Use List
common-lisp
- Exported Definitions
-
- Internal Definitions
-
5 Definitions
Definitions are sorted by export status, category, package, and then by
lexicographic order.
5.1 Exported definitions
5.1.1 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 (file)
- 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 (file)
- 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 (file)
- 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 (file)
- 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 (file)
5.1.2 Generic functions
- Generic Function: family OBJECT
-
Returns the font family name.
See FONT
- Package
org.shirakumo.font-discovery
- Methods
- Method: family (FONT font)
-
automatically generated reader method
- Source
common.lisp (file)
- Generic Function: 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
- Method: file (FONT font)
-
automatically generated reader method
- Source
common.lisp (file)
- Generic Function: 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
- Method: slant (FONT font)
-
automatically generated reader method
- Source
common.lisp (file)
- Generic Function: 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
- Method: spacing (FONT font)
-
automatically generated reader method
- Source
common.lisp (file)
- Generic Function: 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
- Method: stretch (FONT font)
-
automatically generated reader method
- Source
common.lisp (file)
- Generic Function: 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
- Method: weight (FONT font)
-
automatically generated reader method
- Source
common.lisp (file)
5.1.3 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 (file)
- Direct superclasses
standard-object (class)
- Direct methods
-
- Direct slots
- Slot: file
-
- Initargs
:file
- Initform
(error "file required.")
- Readers
file (generic function)
- Slot: family
-
- Initargs
:family
- Initform
(error "family required.")
- Readers
family (generic function)
- Slot: slant
-
- Initargs
:slant
- Initform
:roman
- Readers
slant (generic function)
- Slot: weight
-
- Initargs
:weight
- Initform
:regular
- Readers
weight (generic function)
- Slot: spacing
-
- Initargs
:spacing
- Initform
:proportional
- Readers
spacing (generic function)
- Slot: stretch
-
- Initargs
:stretch
- Initform
:normal
- Readers
stretch (generic function)
5.2 Internal definitions
5.2.1 Special variables
- Special Variable: *config*
-
- Package
org.shirakumo.font-discovery
- Source
linux.lisp (file)
- Special Variable: +family+
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Special Variable: +file+
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Special Variable: +size+
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Special Variable: +slant+
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Special Variable: +spacing+
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Special Variable: +weight+
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Special Variable: +width+
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
5.2.2 Macros
- Macro: with-protection UNWIND &body PROTECTED
-
- Package
org.shirakumo.font-discovery
- Source
common.lisp (file)
- Macro: with-result RESULT &body SUCCESS
-
- Package
org.shirakumo.font-discovery
- Source
linux.lisp (file)
5.2.3 Functions
- Function: config-destroy CONFIG
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: config-substitute CONFIG PATTERN KIND
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: create-pattern ()
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: create-range BEGIN END
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: default-substitute PATTERN
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: destroy-pattern PATTERN
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: destroy-range RANGE
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: destroy-set SET
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: fini ()
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: font-match CONFIG PATTERN RESULT
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: font-set-fonts POINTER-TO-FONT-SET
-
- Function: (setf font-set-fonts) VALUE POINTER-TO-FONT-SET
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: font-set-nfont POINTER-TO-FONT-SET
-
- Function: (setf font-set-nfont) VALUE POINTER-TO-FONT-SET
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: font-set-sfont POINTER-TO-FONT-SET
-
- Function: (setf font-set-sfont) VALUE POINTER-TO-FONT-SET
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: font-sort CONFIG PATTERN TRIM CHARSET RESULT
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: init-load-config-and-fonts ()
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: init-pattern PATTERN &key FAMILY SLANT WEIGHT SPACING STRETCH
-
- Package
org.shirakumo.font-discovery
- Source
linux.lisp (file)
- Function: maybe-enum TYPE THING
-
- Package
org.shirakumo.font-discovery
- Source
common.lisp (file)
- Function: maybe-enum-val TYPE THING
-
- Package
org.shirakumo.font-discovery
- Source
common.lisp (file)
- Function: parse-file STRING
-
- Package
org.shirakumo.font-discovery
- Source
common.lisp (file)
- Function: pattern-add-integer PATTERN OBJECT I
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: pattern-add-range PATTERN OBJECT RANGE
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: pattern-add-string PATTERN OBJECT STRING
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: pattern-get-double PATTERN OBJECT N DOUBLE
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: pattern-get-integer PATTERN OBJECT N INTEGER
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: pattern-get-range PATTERN OBJECT ID RANGE
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: pattern-get-string PATTERN OBJECT N STRING
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: range-get RANGE BEGIN END
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Function: translate-match FONT
-
- Package
org.shirakumo.font-discovery
- Source
linux.lisp (file)
5.2.4 Classes
- Class: font-set-tclass ()
-
- Package
org.shirakumo.font-discovery
- Source
fontconfig.lisp (file)
- Direct superclasses
- translatable-foreign-type (class)
- foreign-struct-type (class)
Appendix A Indexes
A.1 Concepts
| Index Entry | | Section |
|
F | | |
| File, Lisp, font-discovery.asd: | | The font-discovery․asd file |
| File, Lisp, font-discovery/common.lisp: | | The font-discovery/common․lisp file |
| File, Lisp, font-discovery/coretext.lisp: | | The font-discovery/coretext․lisp file |
| File, Lisp, font-discovery/directwrite.lisp: | | The font-discovery/directwrite․lisp file |
| File, Lisp, font-discovery/documentation.lisp: | | The font-discovery/documentation․lisp file |
| File, Lisp, font-discovery/fontconfig.lisp: | | The font-discovery/fontconfig․lisp file |
| File, Lisp, font-discovery/linux.lisp: | | The font-discovery/linux․lisp file |
| File, Lisp, font-discovery/macos.lisp: | | The font-discovery/macos․lisp file |
| File, Lisp, font-discovery/package.lisp: | | The font-discovery/package․lisp file |
| File, Lisp, font-discovery/windows.lisp: | | The font-discovery/windows․lisp file |
| font-discovery.asd: | | The font-discovery․asd file |
| font-discovery/common.lisp: | | The font-discovery/common․lisp file |
| font-discovery/coretext.lisp: | | The font-discovery/coretext․lisp file |
| font-discovery/directwrite.lisp: | | The font-discovery/directwrite․lisp file |
| font-discovery/documentation.lisp: | | The font-discovery/documentation․lisp file |
| font-discovery/fontconfig.lisp: | | The font-discovery/fontconfig․lisp file |
| font-discovery/linux.lisp: | | The font-discovery/linux․lisp file |
| font-discovery/macos.lisp: | | The font-discovery/macos․lisp file |
| font-discovery/package.lisp: | | The font-discovery/package․lisp file |
| font-discovery/windows.lisp: | | The font-discovery/windows․lisp file |
|
L | | |
| Lisp File, font-discovery.asd: | | The font-discovery․asd file |
| Lisp File, font-discovery/common.lisp: | | The font-discovery/common․lisp file |
| Lisp File, font-discovery/coretext.lisp: | | The font-discovery/coretext․lisp file |
| Lisp File, font-discovery/directwrite.lisp: | | The font-discovery/directwrite․lisp file |
| Lisp File, font-discovery/documentation.lisp: | | The font-discovery/documentation․lisp file |
| Lisp File, font-discovery/fontconfig.lisp: | | The font-discovery/fontconfig․lisp file |
| Lisp File, font-discovery/linux.lisp: | | The font-discovery/linux․lisp file |
| Lisp File, font-discovery/macos.lisp: | | The font-discovery/macos․lisp file |
| Lisp File, font-discovery/package.lisp: | | The font-discovery/package․lisp file |
| Lisp File, font-discovery/windows.lisp: | | The font-discovery/windows․lisp file |
|
A.2 Functions
| Index Entry | | Section |
|
( | | |
| (setf font-set-fonts) : | | Internal functions |
| (setf font-set-nfont) : | | Internal functions |
| (setf font-set-sfont) : | | Internal functions |
|
C | | |
| config-destroy : | | Internal functions |
| config-substitute : | | Internal functions |
| create-pattern : | | Internal functions |
| create-range : | | Internal functions |
|
D | | |
| default-substitute : | | Internal functions |
| deinit : | | Exported functions |
| destroy-pattern : | | Internal functions |
| destroy-range : | | Internal functions |
| destroy-set : | | Internal functions |
|
F | | |
| family : | | Exported generic functions |
| family : | | Exported generic functions |
| file : | | Exported generic functions |
| file : | | Exported generic functions |
| find-font : | | Exported functions |
| fini : | | Internal functions |
| font-match : | | Internal functions |
| font-set-fonts : | | Internal functions |
| font-set-nfont : | | Internal functions |
| font-set-sfont : | | Internal functions |
| font-sort : | | Internal functions |
| Function, (setf font-set-fonts) : | | Internal functions |
| Function, (setf font-set-nfont) : | | Internal functions |
| Function, (setf font-set-sfont) : | | Internal functions |
| Function, config-destroy : | | Internal functions |
| Function, config-substitute : | | Internal functions |
| Function, create-pattern : | | Internal functions |
| Function, create-range : | | Internal functions |
| Function, default-substitute : | | Internal functions |
| Function, deinit : | | Exported functions |
| Function, destroy-pattern : | | Internal functions |
| Function, destroy-range : | | Internal functions |
| Function, destroy-set : | | Internal functions |
| Function, find-font : | | Exported functions |
| Function, fini : | | Internal functions |
| Function, font-match : | | Internal functions |
| Function, font-set-fonts : | | Internal functions |
| Function, font-set-nfont : | | Internal functions |
| Function, font-set-sfont : | | Internal functions |
| Function, font-sort : | | Internal functions |
| Function, init : | | Exported functions |
| Function, init-load-config-and-fonts : | | Internal functions |
| Function, init-pattern : | | Internal functions |
| Function, list-fonts : | | Exported functions |
| Function, maybe-enum : | | Internal functions |
| Function, maybe-enum-val : | | Internal functions |
| Function, parse-file : | | Internal functions |
| Function, pattern-add-integer : | | Internal functions |
| Function, pattern-add-range : | | Internal functions |
| Function, pattern-add-string : | | Internal functions |
| Function, pattern-get-double : | | Internal functions |
| Function, pattern-get-integer : | | Internal functions |
| Function, pattern-get-range : | | Internal functions |
| Function, pattern-get-string : | | Internal functions |
| Function, range-get : | | Internal functions |
| Function, refresh : | | Exported functions |
| Function, translate-match : | | Internal functions |
|
G | | |
| Generic Function, family : | | Exported generic functions |
| Generic Function, file : | | Exported generic functions |
| Generic Function, slant : | | Exported generic functions |
| Generic Function, spacing : | | Exported generic functions |
| Generic Function, stretch : | | Exported generic functions |
| Generic Function, weight : | | Exported generic functions |
|
I | | |
| init : | | Exported functions |
| init-load-config-and-fonts : | | Internal functions |
| init-pattern : | | Internal functions |
|
L | | |
| list-fonts : | | Exported functions |
|
M | | |
| Macro, with-protection : | | Internal macros |
| Macro, with-result : | | Internal macros |
| maybe-enum : | | Internal functions |
| maybe-enum-val : | | Internal functions |
| Method, family : | | Exported generic functions |
| Method, file : | | Exported generic functions |
| Method, slant : | | Exported generic functions |
| Method, spacing : | | Exported generic functions |
| Method, stretch : | | Exported generic functions |
| Method, weight : | | Exported generic functions |
|
P | | |
| parse-file : | | Internal functions |
| pattern-add-integer : | | Internal functions |
| pattern-add-range : | | Internal functions |
| pattern-add-string : | | Internal functions |
| pattern-get-double : | | Internal functions |
| pattern-get-integer : | | Internal functions |
| pattern-get-range : | | Internal functions |
| pattern-get-string : | | Internal functions |
|
R | | |
| range-get : | | Internal functions |
| refresh : | | Exported functions |
|
S | | |
| slant : | | Exported generic functions |
| slant : | | Exported generic functions |
| spacing : | | Exported generic functions |
| spacing : | | Exported generic functions |
| stretch : | | Exported generic functions |
| stretch : | | Exported generic functions |
|
T | | |
| translate-match : | | Internal functions |
|
W | | |
| weight : | | Exported generic functions |
| weight : | | Exported generic functions |
| with-protection : | | Internal macros |
| with-result : | | Internal macros |
|
A.3 Variables
| Index Entry | | Section |
|
* | | |
| *config* : | | Internal special variables |
|
+ | | |
| +family+ : | | Internal special variables |
| +file+ : | | Internal special variables |
| +size+ : | | Internal special variables |
| +slant+ : | | Internal special variables |
| +spacing+ : | | Internal special variables |
| +weight+ : | | Internal special variables |
| +width+ : | | Internal special variables |
|
F | | |
| family : | | Exported classes |
| file : | | Exported classes |
|
S | | |
| slant : | | Exported classes |
| Slot, family : | | Exported classes |
| Slot, file : | | Exported classes |
| Slot, slant : | | Exported classes |
| Slot, spacing : | | Exported classes |
| Slot, stretch : | | Exported classes |
| Slot, weight : | | Exported classes |
| spacing : | | Exported classes |
| Special Variable, *config* : | | Internal special variables |
| Special Variable, +family+ : | | Internal special variables |
| Special Variable, +file+ : | | Internal special variables |
| Special Variable, +size+ : | | Internal special variables |
| Special Variable, +slant+ : | | Internal special variables |
| Special Variable, +spacing+ : | | Internal special variables |
| Special Variable, +weight+ : | | Internal special variables |
| Special Variable, +width+ : | | Internal special variables |
| stretch : | | Exported classes |
|
W | | |
| weight : | | Exported classes |
|
A.4 Data types