## 2.7 Callback functions

Properties (like `thickness`, `direction`, etc.) can be set at fixed values with `\override`, e.g.

```\override Stem.thickness = #2.0
```

Properties can also be set to a Scheme procedure,

```\override Stem.thickness = #(lambda (grob)
(if (= UP (ly:grob-property grob 'direction))
2.0
7.0))
c b a g b a g b
```

In this case, the procedure is executed as soon as the value of the property is requested during the formatting process.

Most of the typesetting engine is driven by such callbacks. Properties that typically use callbacks include

`stencil`

The printing routine, that constructs a drawing for the symbol

`X-offset`

The routine that sets the horizontal position

`X-extent`

The routine that computes the width of an object

The procedure always takes a single argument, being the grob.

That procedure may access the usual value of the property, by first calling the function that is the usual callback for that property, which can by found in the Internals Reference or the file ’define-grobs.scm’:

```\relative c'' {
\override Flag.X-offset = #(lambda (flag)
(let ((default (ly:flag::calc-x-offset flag)))
(* default 4.0)))
c4. d8 a4. g8
}
```

From within a callback, the easiest method for evaluating a markup is to use grob-interpret-markup. For example:

```my-callback = #(lambda (grob)
(grob-interpret-markup grob (markup "foo")))
```

Other languages: deutsch, español, français.