Function: font-put

font-put is a function defined in font.c.

Signature

(font-put FONT PROP VAL)

Documentation

Set one property of FONT: give property KEY value VAL.

FONT is a font-spec, a font-entity, or a font-object.

If FONT is a font-spec, KEY can be any symbol. But if KEY is the one accepted by the function font-spec (which see), VAL must be what allowed in font-spec.

If FONT is a font-entity or a font-object, KEY must not be the one accepted by font-spec.

See also font-get for KEYs that have special meanings.

View in manual

Probably introduced at or before Emacs version 23.1.

Source Code

// Defined in /usr/src/emacs/src/font.c
{
  int idx;

  idx = get_font_prop_index (prop);
  if (idx >= 0 && idx < FONT_EXTRA_INDEX)
    {
      CHECK_FONT_SPEC (font);
      ASET (font, idx, font_prop_validate (idx, Qnil, val));
    }
  else
    {
      if (EQ (prop, QCname)
	  || EQ (prop, QCscript)
	  || EQ (prop, QClang)
	  || EQ (prop, QCotf))
	CHECK_FONT_SPEC (font);
      else
	CHECK_FONT (font);
      font_put_extra (font, prop, font_prop_validate (0, prop, val));
    }
  return val;
}