|
@@ -65,6 +65,11 @@ module.exports = function(theme) {
|
65
|
65
|
|
66
|
66
|
var totalHeight = lines.length * theme[type + 'LineHeight'] + (lines.length - 1) * theme[type + 'LineSpacing'];
|
67
|
67
|
|
|
68
|
+ // save caption height for measuring citation top
|
|
69
|
+ if (type === 'caption') {
|
|
70
|
+ theme.captionTotalHeight = totalHeight;
|
|
71
|
+ }
|
|
72
|
+
|
68
|
73
|
// horizontal alignment
|
69
|
74
|
var x = theme[type + 'Align'] === "left" ? left : theme[type + 'Align'] === "right" ? right : (left + right) / 2;
|
70
|
75
|
|
|
@@ -79,7 +84,12 @@ module.exports = function(theme) {
|
79
|
84
|
y = bottom - totalHeight;
|
80
|
85
|
} else {
|
81
|
86
|
// Vertical align top
|
82
|
|
- y = top;
|
|
87
|
+ if (type === 'citation' && theme.captionTotalHeight) {
|
|
88
|
+ y = theme.captionTop + theme.captionTotalHeight + theme[type + 'TopMargin'];
|
|
89
|
+ }
|
|
90
|
+ else {
|
|
91
|
+ y = top
|
|
92
|
+ }
|
83
|
93
|
}
|
84
|
94
|
|
85
|
95
|
// draw text
|