@@ -26,7 +26,10 @@ SILE.registerCommand("pdf:bookmark", function (options, _)
26
26
-- European languages, we use UTF-16BE for internationalization.
27
27
local ustr = SU .utf8_to_utf16be_hexencoded (title )
28
28
SILE .typesetter :pushHbox ({
29
- value = nil , height = 0 , width = 0 , depth = 0 ,
29
+ value = nil ,
30
+ height = SILE .measurement (0 ),
31
+ width = SILE .measurement (0 ),
32
+ depth = SILE .measurement (0 ),
30
33
outputYourself = function ()
31
34
local d = " <</Title<" .. ustr .. " >/A<</S/GoTo/D(" .. dest .. " )>>>>"
32
35
SILE .outputters .libtexpdf ._init ()
50
53
SILE .registerCommand (" pdf:literal" , function (_ , content )
51
54
SILE .typesetter :pushHbox ({
52
55
value = nil ,
53
- height = 0 ,
54
- width = 0 ,
55
- depth = 0 ,
56
+ height = SILE . measurement ( 0 ) ,
57
+ width = SILE . measurement ( 0 ) ,
58
+ depth = SILE . measurement ( 0 ) ,
56
59
outputYourself = function (_ , _ , _ )
57
60
SILE .outputters .libtexpdf ._init ()
58
61
pdf .add_content (content [1 ])
@@ -66,12 +69,12 @@ SILE.registerCommand("pdf:link", function (options, content)
66
69
local llx , lly
67
70
SILE .typesetter :pushHbox ({
68
71
value = nil ,
69
- height = 0 ,
70
- width = 0 ,
71
- depth = 0 ,
72
+ height = SILE . measurement ( 0 ) ,
73
+ width = SILE . measurement ( 0 ) ,
74
+ depth = SILE . measurement ( 0 ) ,
72
75
outputYourself = function (_ , typesetter , _ )
73
- llx = typesetter .frame .state .cursorX
74
- lly = SILE .documentState .paperSize [2 ] - typesetter .frame .state .cursorY
76
+ llx = typesetter .frame .state .cursorX : tonumber ()
77
+ lly = ( SILE .documentState .paperSize [2 ] - typesetter .frame .state .cursorY ): tonumber ()
75
78
SILE .outputters .libtexpdf ._init ()
76
79
pdf .begin_annotation ()
77
80
end
@@ -81,12 +84,14 @@ SILE.registerCommand("pdf:link", function (options, content)
81
84
82
85
SILE .typesetter :pushHbox ({
83
86
value = nil ,
84
- height = 0 ,
85
- width = 0 ,
86
- depth = 0 ,
87
+ height = SILE . measurement ( 0 ) ,
88
+ width = SILE . measurement ( 0 ) ,
89
+ depth = SILE . measurement ( 0 ) ,
87
90
outputYourself = function (_ , typesetter , _ )
88
91
local d = " <</Type/Annot/Subtype/Link/C [ 1 0 0 ]/A<<" .. target .. " (" .. dest .. " )>>>>"
89
- pdf .end_annotation (d , llx , lly , typesetter .frame .state .cursorX , SILE .documentState .paperSize [2 ] - typesetter .frame .state .cursorY + hbox .height )
92
+ local x = typesetter .frame .state .cursorX :tonumber ()
93
+ local y = (SILE .documentState .paperSize [2 ] - typesetter .frame .state .cursorY + hbox .height ):tonumber ()
94
+ pdf .end_annotation (d , llx , lly , x , y )
90
95
end
91
96
})
92
97
end )
@@ -96,9 +101,9 @@ SILE.registerCommand("pdf:metadata", function (options, _)
96
101
local val = SU .required (options , " val" , " pdf:metadata" )
97
102
SILE .typesetter :pushHbox ({
98
103
value = nil ,
99
- height = 0 ,
100
- width = 0 ,
101
- depth = 0 ,
104
+ height = SILE . measurement ( 0 ) ,
105
+ width = SILE . measurement ( 0 ) ,
106
+ depth = SILE . measurement ( 0 ) ,
102
107
outputYourself = function (_ , _ , _ )
103
108
SILE .outputter ._init ()
104
109
pdf .metadata (key , val )
0 commit comments