From 0189223a1a40debb4cb3b146ce182eb806cd28f2 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Fri, 26 Apr 2019 00:56:11 +0200 Subject: 2019-04-25 10:44:00 --- tex/context/base/mkiv/lpdf-emb.lua | 46 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) (limited to 'tex/context/base/mkiv/lpdf-emb.lua') diff --git a/tex/context/base/mkiv/lpdf-emb.lua b/tex/context/base/mkiv/lpdf-emb.lua index 0f5d14cf1..744011341 100644 --- a/tex/context/base/mkiv/lpdf-emb.lua +++ b/tex/context/base/mkiv/lpdf-emb.lua @@ -1708,6 +1708,8 @@ function lpdf.flushfonts() end end + -- this is no not yet ok for tfm / type 1 + for hash, details in sortedhash(mainfonts) do if next(details.indices) then local filename = details.filename @@ -1729,8 +1731,8 @@ function lpdf.flushfonts() local format = properties.format local writer = mainwriters[format] if not writer then - -- at some point we should do this in the frontend but - -- luatex does it anyway then + -- This will move to the tpk module where we will also deal + -- with bitmaps then. local encoding, pfbfile, encfile = getmapentry(filename) if encoding and pfbfile then filename = pfbfile @@ -1770,6 +1772,46 @@ function lpdf.flushfonts() writer = mainwriters[format] end end + if not writer then + local pfbfile = file.replacesuffix(filename,"pfb") + if encoding and pfbfile then + filename = pfbfile + format = "type1" + -- + -- another (temp) hack + local size = details.fontdata.parameters.size + local factor = details.fontdata.parameters.factor + local descriptions = { } + local characters = details.fontdata.characters + -- + local names, _, _, metadata = fonts.constructors.handlers.pfb.loadvector(pfbfile) + local reverse = table.swapped(names) + local vector = encoding.vector + local indices = details.indices + local remapped = { } + local factor = number.dimenfactors.bp * size / 65536 + for k, v in next, indices do + local name = vector[k] + local index = reverse[name] or 0 + local width = factor * (characters[k].width or 0) + descriptions[k] = { + width = width, + index = index, + name = name, + } + remapped[index] = true + end + details.indices = remapped + -- + details.rawdata.descriptions = descriptions + details.filename = filename + details.rawdata.metadata = { } + -- + properties.filename = filename + properties.format = format + writer = mainwriters[format] + end + end if writer then if trace_fonts then report_fonts("using main writer %a",format) -- cgit v1.2.3