--- a/tex/context/base/mkxl/font-cff.lmt
+++ b/tex/context/base/mkxl/font-cff.lmt
@@ -838,6 +838,8 @@
     local flexhints    = { }
     local ignorehint   = false
     local nofflexhints = 0
+    local hinting      = false -- keep type one hints
+    local hintsets     = false -- { at = index in result, h = { { y, dy } }, v = { { x, dx } } }
 
     local encode       = { }
     local chars        = { }
@@ -957,11 +959,85 @@
             return r, x1, y1
         end
 
-        pack_result_tagged = function(t,width,xoffset,yoffset)
---             local result = { encode[width] }
---             local r = 1
-            local result = { encode[width], encode[xoffset or 0], c_hmoveto }
-            local r = 3
+        -- When we keep type one hints, all stems are declared at the start, set after set as
+        -- a type one interpreter collects them. With hint replacement each set becomes a
+        -- hintmask in front of the path element where the set starts.
+
+        local function packstems(result,r,hintsets,k,op)
+            local n    = 0
+            local edge = 0
+            for i=1,#hintsets do
+                local stems = hintsets[i][k]
+                for j=1,#stems do
+                    local s = stems[j]
+                    r = r + 1 ; result[r] = encode[s[1] - edge]
+                    r = r + 1 ; result[r] = encode[s[2]]
+                    n = n + 1
+                    if n % 23 == 0 then
+                        -- the width and 23 stems fit in the operand stack (48)
+                        r = r + 1 ; result[r] = chars[op]
+                        edge = 0
+                    else
+                        edge = s[1] + s[2]
+                    end
+                end
+            end
+            if n % 23 ~= 0 then
+                r = r + 1 ; result[r] = chars[op]
+            end
+            return r, n
+        end
+
+        local function setbits(mask,first,count) -- first is zero based
+            for b=first,first+count-1 do
+                local m = b // 8 + 1
+                mask[m] = mask[m] | (0x80 >> (b % 8))
+            end
+        end
+
+        local function packhints(result,r,hintsets)
+            local replace = #hintsets > 1
+            local masks   = { }
+            local nh, nv
+            r, nh = packstems(result,r,hintsets,"h",replace and 18 or 1) -- hstemhm or hstem
+            r, nv = packstems(result,r,hintsets,"v",replace and 23 or 3) -- vstemhm or vstem
+            if replace then
+                local h = 0
+                local v = nh
+                for i=1,#hintsets do
+                    local set  = hintsets[i]
+                    local mask = { }
+                    for j=1,(nh+nv+7)//8 do
+                        mask[j] = 0
+                    end
+                    setbits(mask,h,#set.h)
+                    setbits(mask,v,#set.v)
+                    h = h + #set.h
+                    v = v + #set.v
+                    masks[set.at] = chars[19] .. char(unpack(mask)) -- hintmask
+                end
+                -- the first set comes before the initial (sidebearing) moveto
+                r = r + 1 ; result[r] = masks[1]
+                masks[1] = nil
+            end
+            return r, masks
+        end
+
+        pack_result_tagged = function(t,width,xoffset,yoffset,hintsets)
+            local result = { encode[width] }
+            local r      = 1
+            local masks  = false
+            if hintsets then
+                local n = 0
+                for i=1,#hintsets do
+                    n = n + #hintsets[i].h + #hintsets[i].v
+                end
+                if n <= 96 then -- the type 2 limit, a glyph with more stems stays unhinted
+                    r, masks = packhints(result,r,hintsets)
+                end
+            end
+            r = r + 1 ; result[r] = encode[xoffset or 0]
+            r = r + 1 ; result[r] = c_hmoveto
             local n = #t
             local x = 0
             local y = yoffset or 0
@@ -971,6 +1047,9 @@
             for i=1,n do
                 local ti = t[i]
                 local tg = ti[#ti]
+                if masks and masks[i] then
+                    r = r + 1 ; result[r] = masks[i]
+                end
                 if tg == "c" then
                     r, x, y = pack_curveto(result,r,x,y,ti[5],ti[6],ti[1],ti[2],ti[3],ti[4])
                 elseif tg == "l" then
@@ -1840,7 +1919,18 @@
         top = 0
     end
 
-    local function getstem()
+    -- Type one stems are relative to the sidebearing point (sby is zero).
+
+    local function addstems(horizontal)
+        local set  = hintsets[#hintsets]
+        local list = horizontal and set.h or set.v
+        local d    = horizontal and 0 or lsb
+        for i=1,top-1,2 do
+            list[#list+1] = { stack[i] + d, stack[i+1] }
+        end
+    end
+
+    local function getstem(t)
         if top == 0 then
             -- bad
         elseif top % 2 ~= 0 then
@@ -1849,6 +1939,9 @@
         if trace_charstrings then
             showstate("stem")
         end
+        if hintsets then
+            addstems(t == 1) -- hstem or vstem
+        end
         stems = stems + (top // 2)
         top   = 0
     end
@@ -1893,12 +1986,18 @@
         if trace_charstrings then
             showstate("vstem3")
         end
+        if hintsets then
+            addstems(false) -- three plain stems
+        end
         top = 0
     end
 
     local function gethstem3()
         if trace_charstrings then
             showstate("hstem3")
+        end
+        if hintsets then
+            addstems(true) -- three plain stems
         end
         top = 0
     end
@@ -1965,6 +2064,14 @@
             end
             if stack[top] == hints then
                 popped = stack[top-2]
+                if hintsets then
+                    -- hint replacement: a new set starts at the next path element
+                    local n = #hintsets
+                    if hintsets[n].at > r then
+                        n = n - 1 -- nothing drawn with the previous set
+                    end
+                    hintsets[n+1] = { at = r + 1, h = { }, v = { } }
+                end
             else
                 popped = 3 --ff no, taco yes
             end
@@ -2825,6 +2932,7 @@
 
         nofflexhints = 0
         ignorehint   = false
+        hintsets     = hinting and { { at = 1, h = { }, v = { } } }
 
         xmin    = 0
         xmax    = 0
@@ -2891,7 +2999,7 @@
                 stream = concat(result)
                 result = nil
             else
-                stream = pack_result_tagged(result,width,lsb) -- version == "cff" and -lsb or 0
+                stream = pack_result_tagged(result,width,lsb,nil,hintsets) -- version == "cff" and -lsb or 0
                 justpass = jp
             end
          -- if trace_charstrings then
@@ -2970,6 +3078,7 @@
         seacs        = { }
         nofflexhints = 0
         ignorehint   = false
+        hinting      = false
     end
 
     local function setwidths(private)
@@ -2989,7 +3098,7 @@
         return dictionary.vsindex or type(data) == "table" and data.vsindex or 0
     end
 
-    parsecharstrings = function(fontdata,data,glphs,doshapes,tversion,streams,nobias,istypeone)
+    parsecharstrings = function(fontdata,data,glphs,doshapes,tversion,streams,nobias,istypeone,keephints)
 
         local dictionary  = data.dictionaries[1]
         local charstrings = dictionary.charstrings
@@ -2997,6 +3106,7 @@
         keepcurve = doshapes
         version   = tversion
         typeone   = istypeone or false
+        hinting   = keephints or false
         strings   = data.strings
         globals   = data.routines or { }
         locals    = dictionary.subroutines or { }
--- a/tex/context/base/mkxl/font-onr.lmt
+++ b/tex/context/base/mkxl/font-onr.lmt
@@ -215,6 +215,27 @@
           + C("FontType")           * num
         ) ) / function  (t,k,v) t[lower(k)] = v end
       + P(1)
+    )^0 * Carg(1)
+
+    -- The hinting part of the private dictionary, only needed when we keep the hints
+    -- (fonts.type1.keephints).
+
+    local p_filterprivate = (
+        P("/") * Carg(1) * ( (
+            C("BlueValues")         * arr
+          + C("OtherBlues")         * arr
+          + C("FamilyBlues")        * arr
+          + C("FamilyOtherBlues")   * arr
+          + C("BlueScale")          * num
+          + C("BlueShift")          * num
+          + C("BlueFuzz")           * num
+          + C("StdHW")              * arr
+          + C("StdVW")              * arr
+          + C("StemSnapH")          * arr
+          + C("StemSnapV")          * arr
+          + C("ForceBold")          * boo
+        ) ) / function  (t,k,v) t[lower(k)] = v end
+      + (1 - subroutines - charstrings)
     )^0 * Carg(1)
 
     -- cache this?
@@ -224,7 +245,7 @@
 
     local caching   = true -- mainly for MS and HH as they test huge files with many instances
 
-    local function loadpfbvector(filename,shapestoo,streams)
+    local function loadpfbvector(filename,shapestoo,streams,keephints)
         -- for the moment limited to encoding only
 
         local fullname = resolvers.findfile(filename)
@@ -284,6 +305,7 @@
         if not metadata then
             metadata = lpegmatch(p_filtermetadata,ascii,1,{})
         end
+        local private = keephints and lpegmatch(p_filterprivate,binary,1,{}) or nil
 
         glyphs   = { }
         routines = { }
@@ -305,7 +327,7 @@
             }
             local version = metadata.FontType or 1
             -- only cff 1 in type 1 fonts
-            fonts.handlers.otf.readers.parsecharstrings(false,data,glyphs,true,"cff0",streams,true,true)
+            fonts.handlers.otf.readers.parsecharstrings(false,data,glyphs,true,"cff0",streams,true,true,keephints)
         elseif not names then
             lpegmatch(p_filternames,binary,1,filename)
         end
@@ -326,7 +348,7 @@
             })
         end
 
-        return names, encoding, glyphs, metadata
+        return names, encoding, glyphs, metadata, private
 
     end
 
--- a/tex/context/base/mkxl/font-shp.lmt
+++ b/tex/context/base/mkxl/font-shp.lmt
@@ -35,6 +35,23 @@
 local keep_hints = false
 
 directives.register("fonts.truetype.keephints", function(v) keep_hints = v end)
+
+-- When embedding a Type 1 font, keep its hinting: the stems (hint replacement becomes a hintmask)
+-- and the hinting part of the private dictionary. Off by default.
+
+local keep_type1_hints = false
+
+directives.register("fonts.type1.keephints", function(v) keep_type1_hints = v end)
+
+local function todeltas(t) -- the cff private dictionary has delta arrays
+    if t then
+        local d = { }
+        for i=1,#t do
+            d[i] = t[i] - (t[i-1] or 0)
+        end
+        return d
+    end
+end
 
 local function packoutlines(data,makesequence)
     if not pack_outlines then
@@ -281,12 +298,13 @@
             end
         end
     elseif size > 0 and (kind == "pfb") then
-        local hash = makehash(filename,sub,instance)
+        local hash = makehash(filename,sub,instance,keep_type1_hints and "hinted" or nil)
         data = containers.read(cache,hash)
         if not data or data.time ~= time or data.size  ~= size then
-            local names, encoding, streams, metadata = pfb.loadvector(filename,false,true)
+            local names, encoding, streams, metadata, private = pfb.loadvector(filename,false,true,keep_type1_hints)
             if streams then
                 local fontbbox = metadata.fontbbox or { 0, 0, 0, 0 }
+                local private  = private or { }
              -- local widths   = { }
                 for i=0,#streams do
                     local s = streams[i]
@@ -333,6 +351,18 @@
                         underlineposition  = metadata.underlineposition,
                         underlinethickness = metadata.underlinethickness,
                         weight             = metadata.weight,
+                        bluevalues         = todeltas(private.bluevalues),
+                        otherblues         = todeltas(private.otherblues),
+                        familyblues        = todeltas(private.familyblues),
+                        familyotherblues   = todeltas(private.familyotherblues),
+                        bluescale          = private.bluescale,
+                        blueshift          = private.blueshift,
+                        bluefuzz           = private.bluefuzz,
+                        stdhw              = private.stdhw and private.stdhw[1],
+                        stdvw              = private.stdvw and private.stdvw[1],
+                        stemsnaph          = todeltas(private.stemsnaph),
+                        stemsnapv          = todeltas(private.stemsnapv),
+                        forcebold          = private.forcebold,
                     },
                 }
                 data = cachethem(cache,hash,data)
--- a/tex/context/base/mkxl/lpdf-emb.lmt
+++ b/tex/context/base/mkxl/lpdf-emb.lmt
@@ -1409,6 +1409,7 @@
             local stdvw              = cffinfo.stdvw
             local stemsnaph          = cffinfo.stemsnaph
             local stemsnapv          = cffinfo.stemsnapv
+            local forcebold          = cffinfo.forcebold
             --
             if defaultwidth == 0 then defaultwidth     = nil end
             if nomimalwidth == 0 then nominalwidth     = nil end
@@ -1462,6 +1463,7 @@
                                     .. (stdvw            and (stdvw            .. todictkey(11))    or "")
                                     .. (stemsnaph        and (stemsnaph        .. todictkey(12,12)) or "")
                                     .. (stemsnapv        and (stemsnapv        .. todictkey(12,13)) or "")
+                                    .. (forcebold        and (todictboolean(true) .. todictkey(12,14)) or "")
                                     .. (defaultwidthx    and (defaultwidthx    .. todictkey(20))    or "")
                                     .. (nominalwidthx    and (nominalwidthx    .. todictkey(21))    or "")
             local privatesize        = todictnumber(#private)
