dragonfly_harfbuzz 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bf9f016957a6112b6780a98641577c56fb5332ed5fb8a4928c17219f57fe8b2
|
4
|
+
data.tar.gz: 4afcd3a4330851dc40b09d52d4e6cf5e77679fde8b56a8cda3c664d62ae5f283
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 337964e96d448279649158b151b72002bd7a27466bd7e31bab4db88a981d49478fd91be5454a3e8378fc1fade11329be2a62c937dfdaae965937925d8bf75fc7
|
7
|
+
data.tar.gz: bda1125020e0e7d74427b0ee09a954e0606ba1640f9c4dcbd6b79368107ca3e69cd36298647c0caa4bc0a409c2c2da4808ce51630917b20fa91faed104390db5
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,7 @@ module DragonflyHarfbuzz
|
|
5
5
|
class HbView
|
6
6
|
def call(content, str, options = {})
|
7
7
|
options = options.each_with_object({}) { |(k, v), memo| memo[k.to_s] = v } # stringify keys
|
8
|
+
unicodes = options.fetch('unicodes', nil)
|
8
9
|
|
9
10
|
raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext)
|
10
11
|
|
@@ -14,7 +15,7 @@ module DragonflyHarfbuzz
|
|
14
15
|
|
15
16
|
flatten_svg = options.fetch('flatten_svg', false)
|
16
17
|
markup_svg = options.fetch('markup_svg', flatten_svg)
|
17
|
-
split_paths = options.fetch('split_paths',
|
18
|
+
split_paths = options.fetch('split_paths', false)
|
18
19
|
|
19
20
|
content.shell_update(ext: format) do |old_path, new_path|
|
20
21
|
args = %W[
|
@@ -36,7 +37,7 @@ module DragonflyHarfbuzz
|
|
36
37
|
content.ext = format
|
37
38
|
|
38
39
|
if format =~ /svg/i
|
39
|
-
content.update(MarkupSvgService.call(str, content.data, split_paths: split_paths), 'name' => "temp.#{format}") if markup_svg
|
40
|
+
content.update(MarkupSvgService.call((str || str_from_unicodes(unicodes)), content.data, split_paths: split_paths), 'name' => "temp.#{format}") if markup_svg
|
40
41
|
content.update(FlattenSvgService.call(content.data), 'name' => "temp.#{format}") if flatten_svg
|
41
42
|
content.update(DomAttrsService.call(content.data, options[:font_size], options[:margin]), 'name' => "temp.#{format}")
|
42
43
|
end
|
@@ -49,6 +50,12 @@ module DragonflyHarfbuzz
|
|
49
50
|
|
50
51
|
private
|
51
52
|
|
53
|
+
def str_from_unicodes(unicodes)
|
54
|
+
unicodes.split(",").map do |hexstring|
|
55
|
+
Array(hexstring).pack("H*").force_encoding('utf-16be').encode('utf-8')
|
56
|
+
end.join
|
57
|
+
end
|
58
|
+
|
52
59
|
def hb_view_command
|
53
60
|
'hb-view'
|
54
61
|
end
|
@@ -5,15 +5,28 @@ module DragonflyHarfbuzz
|
|
5
5
|
let(:app) { test_app.configure_with(:harfbuzz) }
|
6
6
|
let(:processor) { DragonflyHarfbuzz::Processors::HbView.new }
|
7
7
|
let(:content) { Dragonfly::Content.new(app, SAMPLES_DIR.join('sample.otf')) }
|
8
|
-
let(:string) { '
|
8
|
+
let(:string) { 'ABC def' }
|
9
9
|
let(:svg) { processor.call(content, string) }
|
10
10
|
let(:call) { DragonflyHarfbuzz::FlattenSvgService.call(string, svg) }
|
11
11
|
|
12
|
-
|
12
|
+
before { processor.call(content, string, flatten_svg: true) }
|
13
13
|
|
14
|
-
describe '
|
15
|
-
|
16
|
-
|
14
|
+
describe 'lines' do
|
15
|
+
it { content.data.must_include "line=\"#{string}\" class=\"line\"" }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'words' do
|
19
|
+
it { content.data.must_include '<g word="ABC" class="word">' }
|
20
|
+
it { content.data.must_include '<g word="def" class="word">' }
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'characters' do
|
24
|
+
it { content.data.must_include '<svg character="A" class="character"' }
|
25
|
+
it { content.data.must_include '<svg character="B" class="character"' }
|
26
|
+
it { content.data.must_include '<svg character="C" class="character"' }
|
27
|
+
it { content.data.must_include '<svg character="d" class="character"' }
|
28
|
+
it { content.data.must_include '<svg character="e" class="character"' }
|
29
|
+
it { content.data.must_include '<svg character="f" class="character"' }
|
17
30
|
end
|
18
31
|
end
|
19
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dragonfly_harfbuzz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Celizna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|