# How to get ":size" from font-spec

Emacs Asked by Enze Chi on December 11, 2020

How can I get :size from font-spec using Elisp?

What about the function font-get? For example:

(font-get (font-spec :size 10) :size) ; => 10

Quoth its docstring:

font-get is a built-in function in C source code'.

(font-get FONT KEY)

Probably introduced at or before Emacs version 23.1.

Return the value of FONT's property KEY.
FONT is a font-spec, a font-entity, or a font-object.
KEY is any symbol, but these are reserved for specific meanings:
:family, :weight, :slant, :width, :foundry, :adstyle, :registry,
:size, :name, :script, :otf
See the documentation of font-spec' for their meanings.
In addition, if FONT is a font-entity or a font-object, values of
:script and :otf are different from those of a font-spec as below:

The value of :script may be a list of scripts that are supported by the font.

The value of :otf is a cons (GSUB . GPOS) where GSUB and GPOS are lists
representing the OpenType features supported by the font by this form:
((SCRIPT (LANGSYS FEATURE ...) ...) ...)
SCRIPT, LANGSYS, and FEATURE are all symbols representing OpenType
Layout tags.

In addition to the keys listed abobe, the following keys are reserved
for the specific meanings as below:

The value of :combining-capability is non-nil if the font-backend of
FONT supports rendering of combining characters for non-OTF fonts.
The following functions can be used to obtain information about a
font.  For these functions, the FONT argument can be a font object, a
font entity, or a font spec.

-- Function: font-get font property
This function returns the value of the font property PROPERTY for
FONT.

If FONT is a font spec and the font spec does not specify PROPERTY,
the return value is ‘nil’.  If FONT is a font object or font
entity, the value for the :SCRIPT property may be a list of scripts
supported by the font.

Correct answer by Basil on December 11, 2020

## Related Questions

### use-package: autoload function outside the main package file

1  Asked on November 15, 2021

### Force Emacs to start in text mode

1  Asked on November 15, 2021 by ddc

### Auto-indentation for Meteor/spacebars

1  Asked on November 13, 2021

### How can I get the tag value associated with a current custom variable?

1  Asked on November 13, 2021 by gct

### How to disable keybinding (C-o) in ido-find-file?

2  Asked on November 13, 2021

### Move point inside of image overlay

2  Asked on November 10, 2021 by cardano

### Required color-theme file missing in Emacs 26

1  Asked on November 10, 2021

### Emacs 26.3: Weird frame title issue with KDE

1  Asked on November 10, 2021 by ed-sabol

### Ignore meta key when inputting unicode on OSX

0  Asked on November 10, 2021

### Recurrent pop-up when queued email sends without internet connection

1  Asked on November 7, 2021

### compilation sentinel: symbol’s value as variable is void for quote, >, <, =, etc

1  Asked on November 5, 2021

### Keybindings with Shift key does not work when CAPS is on

1  Asked on September 2, 2021 by tian

### How to find a file recursively on Microsoft Windows with findutils (gnu find) installed?

1  Asked on September 2, 2021 by vasantha-ganesh

### How to call org-sparse-tree from Lisp?

1  Asked on September 2, 2021 by user2567544

### Flycheck – Eslint: ‘config file: missing or incorrect’

1  Asked on September 2, 2021 by ben-krck

### Displaying some characters with all-icon instead of my current font

1  Asked on September 2, 2021 by lhooq

### Emacs fails to open gnuplot files with extension .gp

1  Asked on September 2, 2021 by paul-c

### Spacemacs kept repositioning the cursor when there’s unmatched parenthesis

1  Asked on September 2, 2021 by searene

### Automatically activating python virtual environments with pyvenv

1  Asked on September 2, 2021 by jacob-pavlock

### In a Python code is it possible to give a color to called functions?

1  Asked on September 2, 2021