obf 0.9.8.31 → 0.9.8.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/obf/pdf.rb +25 -21
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16b1632c3cbc9a1ae6257270d4efb70929ded87aa79c1b73a5ed7c553e452df6
|
4
|
+
data.tar.gz: 37d0c8a2c6eed4b4ce9ba26bf97f76d12040b33def794d1524cc2ea4028ab0ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 236aefcd275d5d2323895a6c463b7d08028f4b6b746e41df12efd723ca3829324edfd5030c07ac2a4e9b7f54999660f2a9efc5d40b97790ee24c90b395fdb3bd
|
7
|
+
data.tar.gz: 2f5fe9234e980e76d4bfd23affa13a0966ab1bd6c8f394a7cb2fc7f614c0f8baac92662a0ecd3b48632e282ea0747a1c751c31441fa086bb349da05553197848
|
data/lib/obf/pdf.rb
CHANGED
@@ -44,20 +44,28 @@ module OBF::PDF
|
|
44
44
|
}
|
45
45
|
pdf = Prawn::Document.new(doc_opts)
|
46
46
|
# remember: https://www.alphabet-type.com/tools/charset-checker/
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
47
|
+
pdf.font_families.update('THFahKwangBold' => {
|
48
|
+
normal: {font: 'THFahKwangBold', file: File.expand_path('../../THFahKwangBold.ttf', __FILE__)}
|
49
|
+
})
|
50
|
+
pdf.font_families.update('MiedingerBook' => {
|
51
|
+
normal: {font: 'MiedingerBook', file: File.expand_path('../../MiedingerBook.ttf', __FILE__)}
|
52
|
+
})
|
53
|
+
pdf.font_families.update('Arial' => {
|
54
|
+
normal: {font: 'Arial', file: File.expand_path('../../Arial.ttf', __FILE__)}
|
55
|
+
})
|
56
|
+
pdf.font_families.update('TimesNewRoman' => {
|
57
|
+
normal: {font: 'TimesNewRoman', file: File.expand_path('../../TimesNewRoman.ttf', __FILE__)}
|
58
|
+
})
|
59
|
+
default_font = 'TimesNewRoman'
|
60
|
+
if opts['font'] && !opts['font'].match(/TimesNewRoman/) && File.exists?(opts['font'])
|
61
|
+
pdf.font_families.update('DocDefault' => {
|
62
|
+
normal: {font: 'DocDefault', file: font}
|
63
|
+
})
|
64
|
+
default_font = 'DocDefault'
|
58
65
|
else
|
59
|
-
# pdf.font('Times-Roman')
|
60
66
|
end
|
67
|
+
pdf.fallback_fonts = ['TimesNewRoman', 'THFahKwangBold', 'MiedingerBook', 'Helvetica']
|
68
|
+
pdf.font(default_font)
|
61
69
|
|
62
70
|
multi_render_paths = []
|
63
71
|
if obj['boards']
|
@@ -94,7 +102,7 @@ module OBF::PDF
|
|
94
102
|
'pages' => obj['pages'],
|
95
103
|
'backlinks' => obj['backlinks'][board['id']] || [],
|
96
104
|
'headerless' => !!opts['headerless'],
|
97
|
-
'font' =>
|
105
|
+
'font' => default_font,
|
98
106
|
'links' => false,
|
99
107
|
'text_on_top' => !!opts['text_on_top'],
|
100
108
|
'transparent_background' => !!opts['transparent_background'],
|
@@ -150,7 +158,7 @@ module OBF::PDF
|
|
150
158
|
if !options['headerless']
|
151
159
|
header_height = 80
|
152
160
|
pdf.bounding_box([0, doc_height], :width => doc_width, :height => header_height) do
|
153
|
-
|
161
|
+
pdf.font('Arial')
|
154
162
|
pdf.line_width = 2
|
155
163
|
pdf.font_size 16
|
156
164
|
pdf.fill_color "eeeeee"
|
@@ -242,7 +250,7 @@ module OBF::PDF
|
|
242
250
|
end
|
243
251
|
|
244
252
|
# board
|
245
|
-
|
253
|
+
pdf.font(options['font'])
|
246
254
|
pdf.font_size 12
|
247
255
|
padding = 10
|
248
256
|
grid_height = doc_height - header_height - text_height - (padding * 2)
|
@@ -344,11 +352,7 @@ module OBF::PDF
|
|
344
352
|
if text.match(Regexp.new("[" + NEPALI_ALPHABET + "]"))
|
345
353
|
font = File.expand_path('../../MiedingerBook.ttf', __FILE__)
|
346
354
|
end
|
347
|
-
|
348
|
-
# pdf.font(font)
|
349
|
-
else
|
350
|
-
# pdf.font('Times-Roman')
|
351
|
-
end
|
355
|
+
pdf.font(font)
|
352
356
|
direction = text.match(rtl_regex) ? :rtl : :ltr
|
353
357
|
if options['text_case'] == 'upper'
|
354
358
|
text = text.upcase
|
@@ -413,7 +417,7 @@ module OBF::PDF
|
|
413
417
|
# footer
|
414
418
|
pdf.fill_color "bbbbbb"
|
415
419
|
obj['name'] = nil if obj['name'] == 'Unnamed Board'
|
416
|
-
|
420
|
+
pdf.font('Arial')
|
417
421
|
if OBF::PDF.footer_text || obj['name']
|
418
422
|
text = [obj['name'], OBF::PDF.footer_text].compact.join(', ')
|
419
423
|
offset = options['pages'] ? 400 : 300
|