Function: font-get
font-get is a function defined in font.c.
Signature
(font-get FONT KEY)
Documentation
Return the value of FONT's property KEY.
FONT is a font-spec, a font-entity, or a font-object.
KEY can be any symbol, but these are reserved for specific meanings:
:foundry, :family, :adstyle, :registry, :weight, :slant, :width,
:size, :dpi, :spacing, :avgwidth, :script, :lang, :otf
See the documentation of font-spec for their meanings.
If FONT is a font-entity or a font-object, then values of
:script and :otf properties 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, of
this form: ((SCRIPT (LANGSYS FEATURE ...) ...) ...), where
SCRIPT, LANGSYS, and FEATURE are all symbols representing OpenType
Layout tags. See otf-script-alist for the OpenType script tags.
In addition to the keys listed above, the following keys are reserved for the specific meanings as below:
The value of :type is a symbol that identifies the font backend to be
used, such as ftcrhb or xfthb on X , harfbuzz or uniscribe on
MS-Windows, ns on Cocoa/GNUstep, etc.
The value of :combining-capability is non-nil if the font-backend of
FONT supports rendering of combining characters for non-OTF fonts.
Probably introduced at or before Emacs version 23.1.
Source Code
// Defined in /usr/src/emacs/src/font.c
{
int idx;
Lisp_Object val;
CHECK_FONT (font);
CHECK_SYMBOL (key);
idx = get_font_prop_index (key);
if (idx >= FONT_WEIGHT_INDEX && idx <= FONT_WIDTH_INDEX)
return font_style_symbolic (font, idx, 0);
if (idx >= 0 && idx < FONT_EXTRA_INDEX)
return AREF (font, idx);
val = Fassq (key, AREF (font, FONT_EXTRA_INDEX));
if (NILP (val) && FONT_OBJECT_P (font))
{
struct font *fontp = XFONT_OBJECT (font);
if (EQ (key, QCotf))
{
if (fontp->driver->otf_capability)
val = fontp->driver->otf_capability (fontp);
else
val = Fcons (Qnil, Qnil);
}
else if (EQ (key, QCcombining_capability))
{
if (fontp->driver->combining_capability)
val = fontp->driver->combining_capability (fontp);
}
}
else
val = Fcdr (val);
return val;
}