Skip to content

Commit

Permalink
fix(frames): Reset font to Gentium to output frame IDs
Browse files Browse the repository at this point in the history
Fixes #915
  • Loading branch information
simoncozens committed Jul 8, 2020
1 parent aceb805 commit 102dd09
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions core/libtexpdf-output.lua
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ SILE.outputters.libtexpdf = {
self.rule(frame:right(), frame:top(), 0.5, frame:height())
self.rule(frame:left(), frame:bottom(), frame:width(), 0.5)
--self.rule(frame:left() + frame:width()/2 - 5, (frame:top() + frame:bottom())/2+5, 10, 10)
local stuff = SILE.shaper:createNnodes(frame.id, SILE.font.loadDefaults({}))
local gentium = SILE.font.loadDefaults({family="Gentium Plus", language="en"})
local stuff = SILE.shaper:createNnodes(frame.id, gentium)
stuff = stuff[1].nodes[1].value.glyphString -- Horrible hack
local buf = {}
for i = 1, #stuff do
Expand All @@ -156,8 +157,13 @@ SILE.outputters.libtexpdf = {
buf[#buf+1] = string.char(glyph % 0x100)
end
buf = table.concat(buf, "")
if font == 0 then SILE.outputter.setFont(SILE.font.loadDefaults({})) end
local oldfont = font
SILE.outputter.setFont(gentium)
pdf.setstring(frame:left():tonumber(), (SILE.documentState.paperSize[2] - frame:top()):tonumber(), buf, string.len(buf), font, 0)
if oldfont then
pdf.loadfont(oldfont)
font = oldfont
end
pdf.colorpop()
end,

Expand All @@ -182,5 +188,5 @@ SILE.outputters.libtexpdf = {
SILE.outputter = SILE.outputters.libtexpdf

if not SILE.outputFilename and SILE.masterFilename then
SILE.outputFilename = SILE.masterFilename..".pdf"
SILE.outputFilename = SILE.masterFilename..".pdf"
end
2 changes: 1 addition & 1 deletion libtexpdf
Submodule libtexpdf updated 6 files
+58 −10 .gitignore
+1 −3 .travis.yml
+0 −2 Makefile.am
+1,545 −0 Makefile.in
+11,088 −0 build-aux/ltmain.sh
+23 −0 m4/ltversion.m4

0 comments on commit 102dd09

Please sign in to comment.