obf 0.9.8.31 → 0.9.8.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/obf/pdf.rb +25 -21
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 239d820afb7dc6da2f8acf5987caa95c6678811093a3810bf92da9a6091010a8
4
- data.tar.gz: 32500a980838e9e326cce0e25afbd69e6b02991a5c682cb46c4259663dc673d8
3
+ metadata.gz: 16b1632c3cbc9a1ae6257270d4efb70929ded87aa79c1b73a5ed7c553e452df6
4
+ data.tar.gz: 37d0c8a2c6eed4b4ce9ba26bf97f76d12040b33def794d1524cc2ea4028ab0ad
5
5
  SHA512:
6
- metadata.gz: c469f2e6d1d24f7ff2c2a1313e627b2f8565f75cb3e992c151a9704574a2fd3e6bdf5ca4ce5e4505071a4d23b041102919a57d25b85eea36163ffefb0ddad1fe
7
- data.tar.gz: 47a2ce4bfd802e4e6aa208dcf82379bf1e0fab72e3de404aa38079e6ec69e1618a920c76133adafaf85e324dadd633d8144e29ca6bd744336a1805e4533af945
6
+ metadata.gz: 236aefcd275d5d2323895a6c463b7d08028f4b6b746e41df12efd723ca3829324edfd5030c07ac2a4e9b7f54999660f2a9efc5d40b97790ee24c90b395fdb3bd
7
+ data.tar.gz: 2f5fe9234e980e76d4bfd23affa13a0966ab1bd6c8f394a7cb2fc7f614c0f8baac92662a0ecd3b48632e282ea0747a1c751c31441fa086bb349da05553197848
@@ -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
- # 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.fallback_fonts = ['Times-Roman', 'THFahKwangBold', 'MiedingerBook', 'Helvetica']
54
-
55
- font = opts['font'] if opts['font'] && File.exists?(opts['font'])
56
- if font && File.exists?(font)
57
- # pdf.font(font)
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' => 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
- # pdf.font('Helvetica')
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
- # pdf.font(options['font']) if options['font'] && File.exists?(options['font'])
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
- if font && File.exists?(font)
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
- # pdf.font('Helvetica')
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: obf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8.31
4
+ version: 0.9.8.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Whitmer