Hi Hans,

In lpdf-emb.lmt, there's a commented-out definition of
lpdf.registerfontmethod that I'd like to use. I've uncommented this in
my installation and it's worked pretty well for me, so can you please
uncomment/enable this by default in the distribution?

If you want further background, this is how I'm using it:

   lpdf.registerfontmethod("rawpdf", function(filename, details)
       return
           details.properties.indexdata[1],
           0.001,
           function(char)
               return char.code, char.width / t3_to_sp
           end,
           function() end,
           function() end
   end)
   
   local function make_glyph(codepoint, unicode, width, height, code)
       local spec <const> = {
           width   = width * t3_to_sp,
           height  = height * t3_to_sp,
           depth   = 0,
           unicode = { utf8.codepoint(unicode or "", 1, -1, true) },
           code = width .. " 0 d0 " .. code,
       }
       local tfmdata <const> = fonts.hashes.identifiers[font.current()]
       tfmdata.characters[codepoint] = spec
       
       fonts.dropins.swapone(
           "rawpdf",
           tfmdata,
           { code = spec },
           codepoint
       )
   
       fonts.constructors.addcharacters(
           font.current(),
           { characters = { [codepoint] = spec } }
       )
   end

I specifically need something that writes out a raw PDF stream. I'm
using this to write a 4000+ page PDF file to be included by pdfTeX, so I
can't have any XObject indirection or similar, otherwise the number of
objects skyrockets and pdfTeX (+qpdf) gets really slow.

If you're curious, the actual code where I'm using this is here:

   
https://github.com/gucci-on-fleek/unnamed-emoji/blob/master/source/svg-to-pdf.cld
   
https://github.com/gucci-on-fleek/unnamed-emoji/blob/master/source/unnamed-emoji.lua

I know that what I'm doing in the .cld file is wildly unsupported, but
I'm the only one who will ever need to run that. I am planning on
distributing the .lua file though, so I'd like to get this change in the
distribution.

I'm also open to using a different interface instead if you don't want
to publicly-expose lpdf.registerfontmethod.

Thanks,
-- Max
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

Reply via email to