Improved Type3 handling
This commit is contained in:
parent
463f240670
commit
2547bc80e3
@ -1,4 +1,5 @@
|
|||||||
local read_pk = require'luametalatex-font-pk'
|
local read_pk = require'luametalatex-font-pk'
|
||||||
|
local strip_floats = require'luametalatex-pdf-utils'.strip_floats
|
||||||
return function(pdf, fontdir, usedcids)
|
return function(pdf, fontdir, usedcids)
|
||||||
local pk = read_pk(fontdir.name)
|
local pk = read_pk(fontdir.name)
|
||||||
local designsize = pk.designsize/1044654.326 -- 1044654.326=2^20*72/72.27 -- designsize in bp
|
local designsize = pk.designsize/1044654.326 -- 1044654.326=2^20*72/72.27 -- designsize in bp
|
||||||
@ -24,5 +25,5 @@ return function(pdf, fontdir, usedcids)
|
|||||||
glyph.dx/2^16, glyph.dy, left, lower, right, upper, glyph.w, glyph.h, left, lower, glyph.w, glyph.h, glyph.data
|
glyph.dx/2^16, glyph.dy, left, lower, right, upper, glyph.w, glyph.h, left, lower, glyph.w, glyph.h, glyph.data
|
||||||
)))
|
)))
|
||||||
end
|
end
|
||||||
return bbox, matrix, '[' .. table.concat(widths, ' ') .. ']', '<<' .. table.concat(charprocs) .. '>>'
|
return bbox, matrix, pdf:indirect(nil, strip_floats('[' .. table.concat(widths, ' ') .. ']')), '<<' .. table.concat(charprocs) .. '>>'
|
||||||
end
|
end
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
local strip_floats = require'luametalatex-pdf-utils'.strip_floats
|
||||||
|
|
||||||
local tounicode = {
|
local tounicode = {
|
||||||
[-3] = require'luametalatex-pdf-font-cmap3',
|
[-3] = require'luametalatex-pdf-font-cmap3',
|
||||||
require'luametalatex-pdf-font-cmap1',
|
require'luametalatex-pdf-font-cmap1',
|
||||||
@ -254,8 +256,8 @@ local function buildfont3(pdf, fontdir, usedcids)
|
|||||||
local enc = cidmap1byte(pdf)
|
local enc = cidmap1byte(pdf)
|
||||||
local bbox, matrix, widths, charprocs = buildfontpk(pdf, fontdir, usedcids) -- TOOD
|
local bbox, matrix, widths, charprocs = buildfontpk(pdf, fontdir, usedcids) -- TOOD
|
||||||
local touni = pdf:stream(nil, "", tounicode[1](fontdir, usedcids)) -- Done late to allow for defaults set from the font file
|
local touni = pdf:stream(nil, "", tounicode[1](fontdir, usedcids)) -- Done late to allow for defaults set from the font file
|
||||||
return string.format(
|
return strip_floats(string.format(
|
||||||
"<</Type/Font/Subtype/Type3/FontBBox[%f %f %f %f]/FontMatrix[%f %f %f %f %f %f]/CharProcs%s/Encoding%s/FirstChar %i/LastChar %i/Widths%s/ToUnicode %i 0 R>>",
|
"<</Type/Font/Subtype/Type3/FontBBox[%f %f %f %f]/FontMatrix[%f %f %f %f %f %f]/CharProcs%s/Encoding%s/FirstChar %i/LastChar %i/Widths %i 0 R/ToUnicode %i 0 R>>",
|
||||||
-- "<</Type/Font/Subtype/Type3/FontBBox[%f %f %f %f]/FontMatrix[%f %f %f %f %f %f]/CharProcs%s/Encoding%s/FirstChar %i/LastChar %i/Widths[%s]/ToUnicode %i 0 R/FontDescriptor %i 0 R>>",
|
-- "<</Type/Font/Subtype/Type3/FontBBox[%f %f %f %f]/FontMatrix[%f %f %f %f %f %f]/CharProcs%s/Encoding%s/FirstChar %i/LastChar %i/Widths[%s]/ToUnicode %i 0 R/FontDescriptor %i 0 R>>",
|
||||||
bbox[1], bbox[2], bbox[3], bbox[4],
|
bbox[1], bbox[2], bbox[3], bbox[4],
|
||||||
matrix[1], matrix[2], matrix[3], matrix[4], matrix[5], matrix[6],
|
matrix[1], matrix[2], matrix[3], matrix[4], matrix[5], matrix[6],
|
||||||
@ -265,7 +267,7 @@ local function buildfont3(pdf, fontdir, usedcids)
|
|||||||
usedcids[#usedcids][1],
|
usedcids[#usedcids][1],
|
||||||
widths,
|
widths,
|
||||||
touni
|
touni
|
||||||
) -- , descriptor) -- TODO
|
)) -- , descriptor) -- TODO
|
||||||
end
|
end
|
||||||
return function(pdf, fontdir, usedcids)
|
return function(pdf, fontdir, usedcids)
|
||||||
if fontdir.format == "type3" then
|
if fontdir.format == "type3" then
|
||||||
|
Loading…
Reference in New Issue
Block a user