dieses 0.0.1 → 0.0.2
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 +12 -2
- data/README.md +1 -1
- data/lib/dieses/application/canvas.rb +32 -11
- data/lib/dieses/application/cli.rb +1 -1
- data/lib/dieses/application/mixins/lines.rb +11 -11
- data/lib/dieses/application/mixins/scribes.rb +10 -22
- data/lib/dieses/application/mixins/squares.rb +1 -1
- data/lib/dieses/application/pen.rb +13 -16
- data/lib/dieses/application/sheets/copperplate.rb +2 -2
- data/lib/dieses/application/sheets/cursive.rb +1 -1
- data/lib/dieses/application/sheets/graph.rb +2 -2
- data/lib/dieses/application/sheets/italics.rb +1 -1
- data/lib/dieses/application/sheets/lettering.rb +4 -4
- data/lib/dieses/application/sheets/lined.rb +1 -1
- data/lib/dieses/application/sheets/print.rb +1 -1
- data/lib/dieses/application/sheets/ruled.rb +2 -2
- data/lib/dieses/application/sheets/spencerian.rb +2 -2
- data/lib/dieses/application/sheets/thumbnail.rb +1 -1
- data/lib/dieses/geometry/element.rb +1 -1
- data/lib/dieses/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2853498dbdb4547423d4974f7e496ee6e97f9ecc879cc8ae0e72efcb7d3c7ea5
|
4
|
+
data.tar.gz: b01845c3815d257b6d5ac96bd88cab77a71b00cfe552d0fe8076e6fc91914541
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2dffcb272a37ef6c6c21f34733613fc56cd3c16c26e81d17db5420f60d16a3c5beae19f5c1dd72ddeef9616d83ecbfb068a7e08b3088fea4a417989ef54e4d0f
|
7
|
+
data.tar.gz: 4fc3e0b3a711437c41514ddeb885a6bc99e484d31090e3f0f802c841c35c26f421d8a50abbbfeaee412da53d4b8097c325384141a3303a3886b9d7b79d1bbb06
|
data/CHANGELOG.md
CHANGED
@@ -3,12 +3,22 @@ Changelog
|
|
3
3
|
|
4
4
|
All notable changes to this project will be documented in this file.
|
5
5
|
|
6
|
-
[0.0.
|
6
|
+
[0.0.2] - 2021-08-21
|
7
7
|
--------------------
|
8
8
|
|
9
|
-
|
9
|
+
### Changed
|
10
|
+
|
11
|
+
- Use inline CSS for styling
|
12
|
+
- Fix left over names
|
13
|
+
- Bump Ruby version to 3.0.2
|
10
14
|
|
11
15
|
[0.0.1] - 2021-08-09
|
12
16
|
--------------------
|
13
17
|
|
14
18
|
New release for the new project name.
|
19
|
+
|
20
|
+
[0.0.0] - 2021-08-09
|
21
|
+
--------------------
|
22
|
+
|
23
|
+
Initial release.
|
24
|
+
|
data/README.md
CHANGED
@@ -8,8 +8,14 @@ module Dieses
|
|
8
8
|
TEMPLATE = <<~XML
|
9
9
|
<?xml version="1.0" standalone="no"?>
|
10
10
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
11
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="%{width}mm" height="%{height}mm" viewBox="0 0 %{width} %{height}" %{header}>
|
12
|
-
|
11
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="%{width}mm" height="%{height}mm" viewBox="0 0 %{width} %{height}" shape-rendering="geometricPrecision" %{header}>
|
12
|
+
<style>
|
13
|
+
svg { stroke: %{color}; stroke-width: %{medium}; }
|
14
|
+
.altcolor { stroke: %{altcolor}; }
|
15
|
+
.thin { stroke-width: %{thin}; }
|
16
|
+
.thick { stroke-width: %{thick}; }
|
17
|
+
.dashed { stroke-dasharray: %{dashed}; }
|
18
|
+
</style>
|
13
19
|
<g id="sheet">
|
14
20
|
%{content}
|
15
21
|
</g>
|
@@ -25,10 +31,6 @@ module Dieses
|
|
25
31
|
@elements = Set.new
|
26
32
|
end
|
27
33
|
|
28
|
-
def to_h
|
29
|
-
@paper.to_h
|
30
|
-
end
|
31
|
-
|
32
34
|
def <<(items)
|
33
35
|
[*items].each do |item|
|
34
36
|
case item
|
@@ -39,12 +41,31 @@ module Dieses
|
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
42
|
-
def render(header: EMPTY_STRING,
|
43
|
-
# We avoid prettifying XML through REXML which is pretty slow, at the cost of
|
44
|
-
format(TEMPLATE, **
|
44
|
+
def render(header: EMPTY_STRING, variables: EMPTY_HASH)
|
45
|
+
# We avoid prettifying XML through REXML which is pretty slow, at the cost of a somewhat hacky code.
|
46
|
+
format(TEMPLATE, **variables(**variables),
|
45
47
|
content: Geometry.to_svg(elements, paper, prefix: ' ' * 4),
|
46
|
-
header: header
|
47
|
-
|
48
|
+
header: header)
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
DEFAULT_COLOR = '#ed008c'
|
54
|
+
DEFAULT_ALTCOLOR = 'blue'
|
55
|
+
DEFAULT_LINEWIDTH = 0.04
|
56
|
+
DEFAULT_DASHES = [2, 2].freeze
|
57
|
+
|
58
|
+
def variables(**kwargs) # rubocop:disable Metrics/PerceivedComplexity
|
59
|
+
paper.to_h.merge(kwargs).tap do |variables|
|
60
|
+
linewidth = (variables[:medium] || DEFAULT_LINEWIDTH).to_f
|
61
|
+
|
62
|
+
variables[:color] ||= DEFAULT_COLOR
|
63
|
+
variables[:altcolor] ||= DEFAULT_ALTCOLOR
|
64
|
+
variables[:medium] ||= linewidth.to_s
|
65
|
+
variables[:thick] ||= (linewidth * 2.0).to_s
|
66
|
+
variables[:thin] ||= (linewidth / 2.0).to_s
|
67
|
+
variables[:dashed] ||= DEFAULT_DASHES.map(&:to_s).join(' ')
|
68
|
+
end
|
48
69
|
end
|
49
70
|
end
|
50
71
|
end
|
@@ -5,20 +5,20 @@ module Dieses
|
|
5
5
|
module Mixins
|
6
6
|
module Lines
|
7
7
|
module ClassMethods
|
8
|
-
Line = Struct.new :
|
8
|
+
Line = Struct.new :tags, :after, :style, :step, keyword_init: true
|
9
9
|
|
10
|
-
def hline(
|
11
|
-
(param.hlines ||= []) << Line.new(
|
10
|
+
def hline(*tags, after: Undefined, style: EMPTY_HASH)
|
11
|
+
(param.hlines ||= []) << Line.new(tags: tags, after: after, style: style)
|
12
12
|
end
|
13
13
|
|
14
|
-
def vline(
|
15
|
-
(param.vlines ||= []) << Line.new(
|
14
|
+
def vline(*tags, after: Undefined, style: EMPTY_HASH)
|
15
|
+
(param.vlines ||= []) << Line.new(tags: tags, after: after, style: style)
|
16
16
|
end
|
17
17
|
|
18
|
-
Cross = Struct.new :
|
18
|
+
Cross = Struct.new :tags, :angle, :style, keyword_init: true
|
19
19
|
|
20
|
-
def cline(
|
21
|
-
(param.clines ||= []) << Cross.new(
|
20
|
+
def cline(*tags, angle:, style: EMPTY_HASH)
|
21
|
+
(param.clines ||= []) << Cross.new(tags: tags, angle: angle, style: style)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -55,7 +55,7 @@ module Dieses
|
|
55
55
|
draw unit: unit, multiple: multiple do
|
56
56
|
repeat do
|
57
57
|
param.hlines.each do |line|
|
58
|
-
hline
|
58
|
+
hline(*line.tags, style: line.style)
|
59
59
|
down line.step
|
60
60
|
end
|
61
61
|
end
|
@@ -70,7 +70,7 @@ module Dieses
|
|
70
70
|
draw unit: unit, multiple: multiple do
|
71
71
|
repeat do
|
72
72
|
param.vlines.each do |line|
|
73
|
-
vline
|
73
|
+
vline(*line.tags, style: line.style)
|
74
74
|
right line.step
|
75
75
|
end
|
76
76
|
end
|
@@ -86,7 +86,7 @@ module Dieses
|
|
86
86
|
repeat do
|
87
87
|
param.clines.each do |slant|
|
88
88
|
repeat do
|
89
|
-
cline
|
89
|
+
cline(*slant.tags, angle: slant.angle, style: slant.style)
|
90
90
|
cross
|
91
91
|
end
|
92
92
|
end
|
@@ -43,34 +43,22 @@ module Dieses
|
|
43
43
|
|
44
44
|
module Bundle
|
45
45
|
def quartet
|
46
|
-
hline :ascender, after: proc { height
|
47
|
-
|
48
|
-
hline :
|
49
|
-
|
50
|
-
hline :base, after: proc { height },
|
51
|
-
style: Style.(stroke: 'red', 'stroke-width': '0.1', 'stroke-dasharray': '2, 2')
|
52
|
-
hline :descender, after: proc { gap },
|
53
|
-
style: Style.(stroke: 'blue', 'stroke-width': '0.2')
|
46
|
+
hline :ascender, :thick, after: proc { height }
|
47
|
+
hline :waist, :altcolor, after: proc { x_height }
|
48
|
+
hline :base, after: proc { height }
|
49
|
+
hline :descender, :thick, after: proc { gap }
|
54
50
|
end
|
55
51
|
|
56
|
-
# rubocop:disable Metrics/MethodLength
|
57
52
|
# codebeat:disable[ABC]
|
58
53
|
def sextet
|
59
|
-
hline :ascender2,
|
60
|
-
|
61
|
-
hline :
|
62
|
-
|
63
|
-
hline :
|
64
|
-
|
65
|
-
hline :base, after: proc { height },
|
66
|
-
style: Style.(stroke: 'red', 'stroke-width': '0.1')
|
67
|
-
hline :descender1, after: proc { height },
|
68
|
-
style: Style.(stroke: 'grey', 'stroke-width': '0.1', 'stroke-dasharray': '2, 2')
|
69
|
-
hline :descender2, after: proc { gap },
|
70
|
-
style: Style.(stroke: 'blue', 'stroke-width': '0.2')
|
54
|
+
hline :ascender2, :thick, after: proc { height }
|
55
|
+
hline :ascender1, :dashed, after: proc { height }
|
56
|
+
hline :waist, :altcolor, after: proc { x_height }
|
57
|
+
hline :base, after: proc { height }
|
58
|
+
hline :descender1, :dashed, after: proc { height }
|
59
|
+
hline :descender2, :thick, after: proc { gap }
|
71
60
|
end
|
72
61
|
# codebeat:enable[ABC]
|
73
|
-
# rubocop:enable Metrics/MethodLength
|
74
62
|
end
|
75
63
|
|
76
64
|
def included(base)
|
@@ -10,7 +10,7 @@ module Dieses
|
|
10
10
|
draw unit: Undefined.default(unit, param.unit), multiple: Undefined.default(multiple, param.multiple) do
|
11
11
|
repeat do
|
12
12
|
repeat do
|
13
|
-
square :square, width: multiple
|
13
|
+
square :square, width: multiple
|
14
14
|
right multiple
|
15
15
|
end
|
16
16
|
down multiple
|
@@ -79,40 +79,37 @@ module Dieses
|
|
79
79
|
Offsite = Class.new StopIteration
|
80
80
|
|
81
81
|
module Elements
|
82
|
-
def hline(
|
82
|
+
def hline(*tags, length: Undefined, style: Undefined)
|
83
83
|
length = Undefined.equal?(length) ? perfect.width : ruler.measure(length)
|
84
|
-
add Geometry::Line.new(pos, pos.translate(x: length)),
|
84
|
+
add Geometry::Line.new(pos, pos.translate(x: length)), tags, style
|
85
85
|
end
|
86
86
|
|
87
|
-
def vline(
|
87
|
+
def vline(*tags, length: Undefined, style: Undefined)
|
88
88
|
length = Undefined.equal?(length) ? perfect.height : ruler.measure(length)
|
89
|
-
add Geometry::Line.new(pos, pos.translate(y: length)),
|
89
|
+
add Geometry::Line.new(pos, pos.translate(y: length)), tags, style
|
90
90
|
end
|
91
91
|
|
92
|
-
def cline(
|
93
|
-
add perfect.intersect(Geometry::Equation.slant_from_direction(point: pos, angle: -angle)),
|
92
|
+
def cline(*tags, angle:, style: Undefined)
|
93
|
+
add perfect.intersect(Geometry::Equation.slant_from_direction(point: pos, angle: -angle)), tags, style
|
94
94
|
end
|
95
95
|
|
96
|
-
def rect(
|
96
|
+
def rect(*tags, width:, height:, style: Undefined)
|
97
97
|
width, height = ruler.measure(width), ruler.measure(height)
|
98
|
-
|
98
|
+
style = { fill: 'none' }.merge Undefined.default(style, EMPTY_HASH).to_h
|
99
|
+
add Geometry::Rect.new(width, height, position: pos), tags, style
|
99
100
|
end
|
100
101
|
|
101
|
-
def square(
|
102
|
-
rect(
|
102
|
+
def square(*tags, width:, style: Undefined)
|
103
|
+
rect(tags, width: width, height: width, style: style)
|
103
104
|
end
|
104
105
|
|
105
106
|
private
|
106
107
|
|
107
|
-
|
108
|
-
|
109
|
-
def add(element, tag, style)
|
108
|
+
def add(element, tags, style)
|
110
109
|
raise Offsite unless element && perfect.cover?(element)
|
111
110
|
|
112
|
-
tag = Undefined.default(tag, caller_locations(1, 1).first.label.to_sym)
|
113
|
-
|
114
111
|
element.tap do
|
115
|
-
buffer << element.classify(
|
112
|
+
buffer << element.classify(tags, **Undefined.default(style, EMPTY_HASH).to_h)
|
116
113
|
end
|
117
114
|
end
|
118
115
|
|
@@ -8,8 +8,8 @@ module Dieses
|
|
8
8
|
|
9
9
|
include Mixins::Scribes[:sextet].with unit: [5, 7], ratio: [3/2r, 2/1r]
|
10
10
|
|
11
|
-
cline :slant,
|
12
|
-
cline :connective,
|
11
|
+
cline :slant, :thin, angle: 55.0
|
12
|
+
cline :connective, :thin, :dashed, angle: 50.0
|
13
13
|
|
14
14
|
def call
|
15
15
|
scribes
|
@@ -14,8 +14,8 @@ module Dieses
|
|
14
14
|
self.desc = "#{square} squares with #{unit} mm unit"
|
15
15
|
end
|
16
16
|
|
17
|
-
hline :hline
|
18
|
-
vline :vline
|
17
|
+
hline :hline
|
18
|
+
vline :vline
|
19
19
|
|
20
20
|
def call
|
21
21
|
lines multiple: param.square
|
@@ -14,11 +14,11 @@ module Dieses
|
|
14
14
|
self.desc = "#{square} squares with #{unit} mm unit"
|
15
15
|
end
|
16
16
|
|
17
|
-
hline :hline
|
18
|
-
vline :vline
|
17
|
+
hline :hline
|
18
|
+
vline :vline
|
19
19
|
|
20
|
-
cline :slant,
|
21
|
-
cline :connective,
|
20
|
+
cline :slant, :thin, angle: 52.0
|
21
|
+
cline :connective, :thin, :dashed, angle: 30.0
|
22
22
|
|
23
23
|
def call
|
24
24
|
lines multiple: param.square
|
@@ -8,8 +8,8 @@ module Dieses
|
|
8
8
|
|
9
9
|
include Mixins::Scribes[:sextet].with unit: [5, 7], ratio: [3/2r, 2/1r]
|
10
10
|
|
11
|
-
cline :slant,
|
12
|
-
cline :connective,
|
11
|
+
cline :slant, :thin, angle: 52.0
|
12
|
+
cline :connective, :thin, :dashed, angle: 30.0
|
13
13
|
|
14
14
|
def call
|
15
15
|
scribes
|
@@ -24,7 +24,7 @@ module Dieses
|
|
24
24
|
draw unit: param.unit do
|
25
25
|
repeat row do
|
26
26
|
repeat col do
|
27
|
-
rect :rect, width: width, height: height
|
27
|
+
rect :rect, width: width, height: height
|
28
28
|
right(width + 1)
|
29
29
|
end
|
30
30
|
down(height + 1)
|
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.0.2
|
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-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -219,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
219
|
- !ruby/object:Gem::Version
|
220
220
|
version: '0'
|
221
221
|
requirements: []
|
222
|
-
rubygems_version: 3.2.
|
222
|
+
rubygems_version: 3.2.26
|
223
223
|
signing_key:
|
224
224
|
specification_version: 4
|
225
225
|
summary: Guide sheets generator for penmanship, calligraphy, lettering, and sketching
|