obf 0.9.6 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/Nepali.TTF +0 -0
  3. data/lib/obf/pdf.rb +19 -2
  4. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7058a4160f0f89f37c44f869cca61907dcf05a33e2ff4a59b1f976f72ab57fe7
4
- data.tar.gz: ebd891975b2b6023196a3259a215c73a4202d7f7c90c623c44537ebafafe549f
3
+ metadata.gz: ab53704c829fb50bcdda577a16db9eb74ca670821741ea853978e10c1f086b62
4
+ data.tar.gz: eba4fd06b4b60d3fac934754a391bad6349bc0dfd8589b3c24a43a0daf12045e
5
5
  SHA512:
6
- metadata.gz: 592b569ed4e58a352163fd79bd562315706f2529e00ea0fd6743a9c436ed9e7231d17bab2660ca96931a592074ca33e390d33b53c5a4036c4d0b3c68e85b1581
7
- data.tar.gz: ede1121a66e89e7bf7dc96db134b8950d25beae60180c961827d86e749974b15f7a36870e0c5025435cae3492dc2bb21a912c18a9376dcab762306fdc91f2c9b
6
+ metadata.gz: fc1ddd6bd4594967e4f7d719555dc9282cec43c79ba62d848c2be9e2ebc24dcd3b6d0521d3101e1c16933c4595a8b1f396578ffc6f53029342f92291ba8636ea
7
+ data.tar.gz: 97e1bdfd92ec95ed2859908b79a437f3c2cbe5ea9582d6c538930fbeef4ace850112ae7857663f86d07c67e4f551d288b622533b9f5f1f3c47bf12772a92fafd
Binary file
@@ -3,7 +3,8 @@ module OBF::PDF
3
3
  @@footer_url ||= nil
4
4
 
5
5
  RTL_SCRIPTS = %w(Arabic Hebrew Nko Kharoshthi Phoenician Syriac Thaana Tifinagh Tamil)
6
-
6
+ NEPALI_ALPHABET = "कखगघङचछजझञटठडढणतथदधनपफबभमयरलवशषसहक्षत्रज्ञअआइईउऊऋएऐओऔअंअः"
7
+
7
8
  def self.footer_text
8
9
  @@footer_text
9
10
  end
@@ -42,6 +43,14 @@ module OBF::PDF
42
43
  }
43
44
  }
44
45
  pdf = Prawn::Document.new(doc_opts)
46
+ pdf.font_families['THFahKwangBold'] = {
47
+ normal: {font: 'THFahKwangBold', file: File.expand_path('../../THFahKwangBold.ttf', __FILE__)}
48
+ }
49
+ pdf.font_families['Nepali'] = {
50
+ normal: {font: 'Nepali', file: File.expand_path('../../Nepali.ttf', __FILE__)}
51
+ }
52
+ pdf.fallback_fonts = ['THFahKwangBold', 'Nepali']
53
+
45
54
  font = opts['font'] if opts['font'] && File.exists?(opts['font'])
46
55
  font ||= File.expand_path('../../TimesNewRoman.ttf', __FILE__)
47
56
  pdf.font(font) if File.exists?(font)
@@ -66,6 +75,7 @@ module OBF::PDF
66
75
  'links' => false,
67
76
  'text_on_top' => !!opts['text_on_top'],
68
77
  'transparent_background' => !!opts['transparent_background'],
78
+ 'symbol_background' => opts['symbol_background'],
69
79
  'text_case' => opts['text_case']
70
80
  })
71
81
  pdf.render_file(path)
@@ -80,6 +90,7 @@ module OBF::PDF
80
90
  'links' => true,
81
91
  'text_on_top' => !!opts['text_on_top'],
82
92
  'transparent_background' => !!opts['transparent_background'],
93
+ 'symbol_background' => opts['symbol_background'],
83
94
  'text_case' => opts['text_case']
84
95
  })
85
96
  end
@@ -91,6 +102,7 @@ module OBF::PDF
91
102
  'font' => font,
92
103
  'text_on_top' => !!opts['text_on_top'],
93
104
  'transparent_background' => !!opts['transparent_background'],
105
+ 'symbol_background' => opts['symbol_background'],
94
106
  'text_case' => opts['text_case']
95
107
  })
96
108
  end
@@ -188,6 +200,9 @@ module OBF::PDF
188
200
  font = options['font']
189
201
  if text.match(/\p{Thai}/)
190
202
  font = File.expand_path('../../THFahKwangBold.ttf', __FILE__)
203
+ # TODO: I think this can be moved to fallback_fonts instead
204
+ # elsif text.match(Regexp.new("[" + NEPALI_ALPHABET + "]")
205
+ # font = File.expand_path('../../Nepali.ttf', __FILE__)
191
206
  end
192
207
  pdf.font(font) if font && File.exists?(font)
193
208
  direction = text.match(rtl_regex) ? :rtl : :ltr
@@ -207,8 +222,10 @@ module OBF::PDF
207
222
  image = (obj['images_hash'] || {})[button['image_id']]
208
223
  if image
209
224
  bg = 'white'
210
- if options['transparent_background']
225
+ if options['transparent_background'] || options['symbol_background'] == 'transparent'
211
226
  bg = "\##{fill}"
227
+ elsif options['symbol_background'] == 'black'
228
+ bg = 'black'
212
229
  end
213
230
  image_local_path = image && OBF::Utils.save_image(image, options['zipper'], bg)
214
231
  if image_local_path && File.exist?(image_local_path)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: obf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Whitmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-08 00:00:00.000000000 Z
11
+ date: 2019-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -145,6 +145,7 @@ extra_rdoc_files:
145
145
  files:
146
146
  - LICENSE
147
147
  - README.md
148
+ - lib/Nepali.TTF
148
149
  - lib/THFahKwangBold.ttf
149
150
  - lib/TimesNewRoman.ttf
150
151
  - lib/obf.rb