diff --git a/packages/pdf.lua b/packages/pdf.lua index 9de3fd2a5..4022b6d71 100644 --- a/packages/pdf.lua +++ b/packages/pdf.lua @@ -26,7 +26,10 @@ SILE.registerCommand("pdf:bookmark", function (options, _) -- European languages, we use UTF-16BE for internationalization. local ustr = SU.utf8_to_utf16be_hexencoded(title) SILE.typesetter:pushHbox({ - value = nil, height = 0, width = 0, depth = 0, + value = nil, + height = SILE.measurement(0), + width = SILE.measurement(0), + depth = SILE.measurement(0), outputYourself = function () local d = "</A<>>>" SILE.outputters.libtexpdf._init() @@ -50,9 +53,9 @@ end SILE.registerCommand("pdf:literal", function (_, content) SILE.typesetter:pushHbox({ value = nil, - height = 0, - width = 0, - depth = 0, + height = SILE.measurement(0), + width = SILE.measurement(0), + depth = SILE.measurement(0), outputYourself = function (_, _, _) SILE.outputters.libtexpdf._init() pdf.add_content(content[1]) @@ -66,12 +69,12 @@ SILE.registerCommand("pdf:link", function (options, content) local llx, lly SILE.typesetter:pushHbox({ value = nil, - height = 0, - width = 0, - depth = 0, + height = SILE.measurement(0), + width = SILE.measurement(0), + depth = SILE.measurement(0), outputYourself = function (_, typesetter, _) - llx = typesetter.frame.state.cursorX - lly = SILE.documentState.paperSize[2] - typesetter.frame.state.cursorY + llx = typesetter.frame.state.cursorX:tonumber() + lly = (SILE.documentState.paperSize[2] - typesetter.frame.state.cursorY):tonumber() SILE.outputters.libtexpdf._init() pdf.begin_annotation() end @@ -81,12 +84,14 @@ SILE.registerCommand("pdf:link", function (options, content) SILE.typesetter:pushHbox({ value = nil, - height = 0, - width = 0, - depth = 0, + height = SILE.measurement(0), + width = SILE.measurement(0), + depth = SILE.measurement(0), outputYourself = function (_, typesetter, _) local d = "<>>>" - pdf.end_annotation(d, llx, lly, typesetter.frame.state.cursorX, SILE.documentState.paperSize[2] -typesetter.frame.state.cursorY + hbox.height) + local x = typesetter.frame.state.cursorX:tonumber() + local y = (SILE.documentState.paperSize[2] - typesetter.frame.state.cursorY + hbox.height):tonumber() + pdf.end_annotation(d, llx, lly, x, y) end }) end) @@ -96,9 +101,9 @@ SILE.registerCommand("pdf:metadata", function (options, _) local val = SU.required(options, "val", "pdf:metadata") SILE.typesetter:pushHbox({ value = nil, - height = 0, - width = 0, - depth = 0, + height = SILE.measurement(0), + width = SILE.measurement(0), + depth = SILE.measurement(0), outputYourself = function (_, _, _) SILE.outputter._init() pdf.metadata(key, val) diff --git a/packages/ruby.lua b/packages/ruby.lua index e30e017ce..9377dea36 100644 --- a/packages/ruby.lua +++ b/packages/ruby.lua @@ -1,3 +1,6 @@ +-- Japaneese language support defines units which are useful here +SILE.call("language", { main = "ja" }, {}) + SILE.registerCommand("ruby:font", function (_, _) SILE.call("font", { size = "0.6zw", weight = 800 }) end) diff --git a/packages/tate.lua b/packages/tate.lua index 802492d8c..61b9cd465 100644 --- a/packages/tate.lua +++ b/packages/tate.lua @@ -1,3 +1,6 @@ +-- Japaneese language support defines units which are useful here +SILE.call("language", { main = "ja" }, {}) + SILE.tateFramePrototype = pl.class({ _base = SILE.framePrototype, direction = "TTB-RTL", @@ -37,7 +40,7 @@ local outputLatinInTate = function (self, typesetter, line) local vorigin = -typesetter.frame.state.cursorY self:oldOutputYourself(typesetter,line) typesetter.frame.state.cursorY = -vorigin - typesetter.frame:advanceWritingDirection(self:lineContribution().length) + typesetter.frame:advanceWritingDirection(self:lineContribution()) -- My baseline moved typesetter.frame:advanceWritingDirection(SILE.measurement("0.5zw") ) typesetter.frame:advancePageDirection(-SILE.measurement("0.25zw")) @@ -46,9 +49,9 @@ end local outputTateChuYoko = function (self, typesetter, line) -- My baseline moved - local em = SILE.toPoints("1zw") - typesetter.frame:advanceWritingDirection(-(em) + em/4 - self:lineContribution()/2) - typesetter.frame:advancePageDirection(2*self.height - self.width.length/2) + local em = SILE.measurement("1zw") + typesetter.frame:advanceWritingDirection(-em + em/4 - self:lineContribution()/2) + typesetter.frame:advancePageDirection(2*self.height - self.width/2) self:oldOutputYourself(typesetter,line) typesetter.frame:advanceWritingDirection(-self:lineContribution()*1.5+self.height*3/4)