Skip to content

\qr-code markup command

Jean Abou Samra requested to merge jeanas/lilypond:qrcode into master

Inserting QR-codes is a feature that was requested multiple times. Cf.

https://github.com/frescobaldi/frescobaldi/issues/312

https://lists.gnu.org/archive/html/lilypond-user/2018-05/msg00350.html

https://lists.gnu.org/archive/html/lilypond-user/2012-07/msg00143.html

https://lists.gnu.org/archive/html/lilypond-user-fr/2022-07/msg00005.html

While this can of course be done with an image, it becomes cumbersome to generate those images for each score one publishes, especially if every part has its own QR code for example. It is much more convenient to insert the URL directly into the LilyPond input. This also opens up the possibility to make sites similar to Mutopia insert a QR code automatically in the footer, with part of the URL computed in Scheme from the file name or such.

There was prior art in https://lsr.di.unimi.it/LSR/Item?id=1153, which did not, however, allow inserting the URL directly into the input, instead requiring to copy a bit array representing the code, still generated externally.

This patch goes further by implementing a minimal QR code encoder in Scheme, allowing the syntax

\markup \qr-code #10 "https://lilypond.org"

The first three commits are from !1861 (merged) and !1862 (merged). Only the last commit should be reviewed here.

I am aware that this is a comparatively large patch. I don't know how to further split it meaningfully, but I will happily leave it on review for longer than usual if requested by reviewers.

Edited by Jean Abou Samra

Merge request reports