From c27bd98cb78fe181d316960984f13842fd8ec1a9 Mon Sep 17 00:00:00 2001
From: Max Chernoff <49086429+gucci-on-fleek@users.noreply.github.com>
Date: Wed, 5 Jul 2023 00:21:42 -0600
Subject: [PATCH 3/3] Document provide_charproc_data callback

---
 manual/luatex-callbacks.tex | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/manual/luatex-callbacks.tex b/manual/luatex-callbacks.tex
index 22638f75..a696fa52 100644
--- a/manual/luatex-callbacks.tex
+++ b/manual/luatex-callbacks.tex
@@ -1157,6 +1157,35 @@ returned string is used. By default the \UTF\ representation is shown which is
 not always that useful, especially when there is no real representation. Keep in
 mind that setting this callback can change the log in an incompatible way.
 
+\subsection{\cbk {provide_charproc_data}}
+
+\topicindex{callbacks+fonts}
+
+The \type {provide_charproc_data} callback is triggered when the backend is
+writing out a user-defined Type~3 font:
+
+\startfunctioncall
+function(<number> mode, <number> id, <number> char)
+    if mode == 1 then
+        -- preroll
+        return
+    elseif mode == 2 then
+        -- write out the glyph contents
+        return <number> stream, <number> width
+    elseif mode == 3 then
+        -- the overall font scale
+        return <number> scale
+    end
+end
+\stopfunctioncall
+
+To make a user-defined Type~3 font, you need to set \type {encodingbytes = 0}
+and \type {psname = "none"} at the top-level when defining the font. From the
+\type {glyph_not_found} callback, you should return the overall font scale
+(conventionally 0.001) in mode~3, and the index of a \PDF\ stream (where the
+first operator is either \type {d0} or \type {d1}) and the width of the glyph
+(in sp's) in mode~2. You can generally ignore mode~1.
+
 \stopsection
 
 \stopchapter
-- 
2.41.0

