obf 0.8.6 → 0.8.7
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/THFahKwangBold.ttf +0 -0
- data/lib/obf/pdf.rb +6 -0
- data/lib/obf/utils.rb +2 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a24c6f88d3866605e099d601217d1679d85ca109
|
4
|
+
data.tar.gz: eb49209bd5d474cecf64ffbd3e5af029e5bbff60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c515cdba421eca70481804d796e6679dcaf992a2028871320586eb9a90317c2423c534e127792858f0169462469035c32ab95ed578aa1c8a81cdb87fae6db1b
|
7
|
+
data.tar.gz: 8b6ca823246ec74748cceded855952d150600a771ae9d9f4129b972f5924662c822d9127ffdb70f882b64e5d0c1d28e767c4d62c11b6011ba5515ebb00b12a4b
|
Binary file
|
data/lib/obf/pdf.rb
CHANGED
@@ -156,6 +156,11 @@ module OBF::PDF
|
|
156
156
|
pdf.fill_and_stroke_rounded_rectangle [0, button_height], button_width, button_height, default_radius
|
157
157
|
vertical = options['text_on_top'] ? button_height - text_height : button_height - 5
|
158
158
|
|
159
|
+
font = options['font']
|
160
|
+
if text.match(/\p{Thai}/)
|
161
|
+
font = File.expand_path('../../THFahKwangBold.ttf', __FILE__)
|
162
|
+
end
|
163
|
+
pdf.font(font) if font && File.exists?(font)
|
159
164
|
text = (button['label'] || button['vocalization']).to_s
|
160
165
|
direction = text.match(rtl_regex) ? :rtl : :ltr
|
161
166
|
if options['text_case'] == 'upper'
|
@@ -201,6 +206,7 @@ module OBF::PDF
|
|
201
206
|
vertical = options['text_on_top'] ? button_height : text_height
|
202
207
|
pdf.text_box text, :at => [0, vertical], :width => button_width, :height => text_height, :align => :center, :valign => :center, :overflow => :shrink_to_fit, :direction => direction
|
203
208
|
end
|
209
|
+
pdf.font(options['font']) if options['font'] && File.exists?(options['font'])
|
204
210
|
end
|
205
211
|
index = col + (row * obj['grid']['columns'])
|
206
212
|
OBF::Utils.update_current_progress(index.to_f / (obj['grid']['rows'] * obj['grid']['columns']).to_f)
|
data/lib/obf/utils.rb
CHANGED
@@ -8,7 +8,8 @@ module OBF::Utils
|
|
8
8
|
content_type = url.split(/;/)[0].split(/:/)[1]
|
9
9
|
data = Base64.strict_decode64(url.split(/\,/, 2)[1])
|
10
10
|
else
|
11
|
-
|
11
|
+
uri = url.match(/\%/) ? url : URI.escape(url)
|
12
|
+
res = Typhoeus.get(uri)
|
12
13
|
content_type = res.headers['Content-Type']
|
13
14
|
data = res.body
|
14
15
|
end
|
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.8.
|
4
|
+
version: 0.8.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:
|
11
|
+
date: 2018-02-16 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/THFahKwangBold.ttf
|
148
149
|
- lib/TimesNewRoman.ttf
|
149
150
|
- lib/obf.rb
|
150
151
|
- lib/obf/avz.rb
|