dieses 0.0.3 → 0.1.0
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/CHANGELOG.md +8 -0
- data/README.md +1 -1
- data/lib/dieses/application/common.rb +2 -0
- data/lib/dieses/application/pen.rb +1 -19
- data/lib/dieses/application/sheets/table.rb +50 -0
- data/lib/dieses/application/sheets/thumbnail.rb +4 -4
- data/lib/dieses/support/ruler.rb +39 -0
- data/lib/dieses/support.rb +1 -0
- data/lib/dieses/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 228a00e8d18798888221d4dd9a0f9437e57b9dd0b360f8902f6e2e6d0bc4fd41
|
4
|
+
data.tar.gz: 23dec797ddb7dc00e6d3bd0490a6e8bc4016d2ebc498ed4184e71d4af848d407
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b52961fcc1d1b8b9ece35de31977b2f4719917deb4725d545a544bb8975c379eb66acde2f33decdf96ea32e1a2298bf2b4cfbb857de3c36091da1f5153305f0
|
7
|
+
data.tar.gz: 2bec77689964240ab83d088a3b97175e80d77e53870e0c8bed91db3b9fbc6d57edaf296cbc40b120172882bf687f1f89a735db237e3fd88bdcc5c39f1ae778d1
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@ Dieses
|
|
2
2
|
======
|
3
3
|
|
4
4
|
[](https://github.com/alaturka/dieses/actions/workflows/test.yml)
|
5
|
-
[](https://codebeat.co/projects/github-com-alaturka-dieses-dev)
|
6
6
|
|
7
7
|
Guide sheets for penmanship, calligraphy, lettering, and sketching.
|
8
8
|
[Click](https://github.com/alaturka/dieses/tree/master/docs/sheets) to reach the all available guide sheet combinations.
|
@@ -9,28 +9,10 @@ module Dieses
|
|
9
9
|
@canvas = canvas
|
10
10
|
end
|
11
11
|
|
12
|
-
def draw(unit:, multiple:
|
12
|
+
def draw(unit:, multiple: 1, &block)
|
13
13
|
Draw.(self, Ruler.(unit, multiple), &block)
|
14
14
|
end
|
15
15
|
|
16
|
-
Ruler = Struct.new :unit, :multiple do
|
17
|
-
def self.call(unit, multiple = nil)
|
18
|
-
new unit, (multiple || 1)
|
19
|
-
end
|
20
|
-
|
21
|
-
def major
|
22
|
-
@major ||= multiple * unit
|
23
|
-
end
|
24
|
-
|
25
|
-
def even(length)
|
26
|
-
major * (length / major).to_i
|
27
|
-
end
|
28
|
-
|
29
|
-
def measure(n)
|
30
|
-
n * unit
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
16
|
class Draw
|
35
17
|
extend Forwardable
|
36
18
|
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dieses
|
4
|
+
module Application
|
5
|
+
module Sheets
|
6
|
+
class Table < Sheet
|
7
|
+
sheet :table, 'Table'
|
8
|
+
|
9
|
+
style linewidth: 0.2, color: '#007f80'
|
10
|
+
|
11
|
+
TABLES = {
|
12
|
+
'1': Param.(row: 2, col: 2),
|
13
|
+
'2': Param.(row: 5, col: 2),
|
14
|
+
'3': Param.(row: 4, col: 4),
|
15
|
+
'4': Param.(row: 10, col: 4)
|
16
|
+
}.freeze
|
17
|
+
|
18
|
+
variate table: TABLES.keys, unit: 1 do
|
19
|
+
self.name = table
|
20
|
+
|
21
|
+
param = TABLES[table]
|
22
|
+
self.desc = "Table #{table} (#{param.row}x#{param.col} table on A4 paper)"
|
23
|
+
end
|
24
|
+
|
25
|
+
def call # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
26
|
+
row, col = TABLES[param.table].to_a
|
27
|
+
|
28
|
+
cell_width, total_width = Ruler.divide(unit: param.unit, multiple: col, length: canvas.width)
|
29
|
+
cell_height, total_height = Ruler.divide(unit: param.unit, multiple: row, length: canvas.height)
|
30
|
+
|
31
|
+
draw unit: param.unit do
|
32
|
+
repeat row + 1 do
|
33
|
+
hline :hline, length: total_width
|
34
|
+
down cell_height
|
35
|
+
end
|
36
|
+
repeat row do
|
37
|
+
down cell_height / 2
|
38
|
+
hline :half, :dashed, :fine, length: total_width
|
39
|
+
down cell_height / 2
|
40
|
+
end
|
41
|
+
repeat col + 1 do
|
42
|
+
vline :vline, length: total_height
|
43
|
+
right cell_width
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -8,22 +8,22 @@ module Dieses
|
|
8
8
|
|
9
9
|
style linewidth: 0.3, color: '#007f80'
|
10
10
|
|
11
|
-
|
11
|
+
DENSITIES = {
|
12
12
|
'1': Param.(row: 5, col: 3, width: 10, height: 10),
|
13
13
|
'2': Param.(row: 4, col: 4, width: 8, height: 10),
|
14
14
|
'3': Param.(row: 5, col: 5, width: 6, height: 8),
|
15
15
|
'4': Param.(row: 6, col: 5, width: 6, height: 6)
|
16
16
|
}.freeze
|
17
17
|
|
18
|
-
variate density:
|
18
|
+
variate density: DENSITIES.keys, unit: 5 do
|
19
19
|
self.name = density
|
20
20
|
|
21
|
-
param =
|
21
|
+
param = DENSITIES[density]
|
22
22
|
self.desc = "Density #{density} (#{param.row}x#{param.col} thumbnails on A4 paper)"
|
23
23
|
end
|
24
24
|
|
25
25
|
def call
|
26
|
-
row, col, width, height =
|
26
|
+
row, col, width, height = DENSITIES[param.density].to_a
|
27
27
|
|
28
28
|
draw unit: param.unit do
|
29
29
|
repeat row do
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dieses
|
4
|
+
module Support
|
5
|
+
class Ruler
|
6
|
+
def self.call(unit, multiple = 1)
|
7
|
+
new unit, (multiple || 1)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.divide(unit:, multiple:, length:)
|
11
|
+
ruler = new(unit, multiple)
|
12
|
+
[ruler.division(length), ruler.even(length)]
|
13
|
+
end
|
14
|
+
|
15
|
+
attr_reader :unit, :multiple
|
16
|
+
|
17
|
+
def initialize(unit, multiple = 1)
|
18
|
+
@unit = unit.to_f
|
19
|
+
@multiple = multiple.to_f
|
20
|
+
end
|
21
|
+
|
22
|
+
def major
|
23
|
+
@major ||= multiple * unit
|
24
|
+
end
|
25
|
+
|
26
|
+
def even(length)
|
27
|
+
major * division(length)
|
28
|
+
end
|
29
|
+
|
30
|
+
def division(length)
|
31
|
+
(length / major).to_i.to_f
|
32
|
+
end
|
33
|
+
|
34
|
+
def measure(n)
|
35
|
+
n * unit
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/dieses/support.rb
CHANGED
data/lib/dieses/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dieses
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Recai Oktaş
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -176,6 +176,7 @@ files:
|
|
176
176
|
- lib/dieses/application/sheets/print.rb
|
177
177
|
- lib/dieses/application/sheets/ruled.rb
|
178
178
|
- lib/dieses/application/sheets/spencerian.rb
|
179
|
+
- lib/dieses/application/sheets/table.rb
|
179
180
|
- lib/dieses/application/sheets/thumbnail.rb
|
180
181
|
- lib/dieses/error.rb
|
181
182
|
- lib/dieses/geometry.rb
|
@@ -196,6 +197,7 @@ files:
|
|
196
197
|
- lib/dieses/support/hash.rb
|
197
198
|
- lib/dieses/support/kernel.rb
|
198
199
|
- lib/dieses/support/math.rb
|
200
|
+
- lib/dieses/support/ruler.rb
|
199
201
|
- lib/dieses/version.rb
|
200
202
|
homepage: https://alaturka.github.io/dieses
|
201
203
|
licenses:
|