dieses 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2853498dbdb4547423d4974f7e496ee6e97f9ecc879cc8ae0e72efcb7d3c7ea5
4
- data.tar.gz: b01845c3815d257b6d5ac96bd88cab77a71b00cfe552d0fe8076e6fc91914541
3
+ metadata.gz: e460b0467bf1fb5b34295fb10d8cb1a477b45c3ce46b00f75c7b910c51277c60
4
+ data.tar.gz: 8b689557c7f6357840f7a549acba2f1e3eba31464fbbbbce77fb0e4007ae1e72
5
5
  SHA512:
6
- metadata.gz: 2dffcb272a37ef6c6c21f34733613fc56cd3c16c26e81d17db5420f60d16a3c5beae19f5c1dd72ddeef9616d83ecbfb068a7e08b3088fea4a417989ef54e4d0f
7
- data.tar.gz: 4fc3e0b3a711437c41514ddeb885a6bc99e484d31090e3f0f802c841c35c26f421d8a50abbbfeaee412da53d4b8097c325384141a3303a3886b9d7b79d1bbb06
6
+ metadata.gz: 92c64d445a336625cb86715d975914eafa3c00150139d66bd9a996bba4231e79871df2697ee3d680e22647190fd3d23435d09d530057f294e404182e4faf3b85
7
+ data.tar.gz: 0be3ede03b34c7c64df50ebdf7c3a5bd72b72a98c93d84f8927dd17282b96ed1e714ec38ddf614c36d4a80e359970a8bed5aed9adec475e1c3110460f6c6aea8
data/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@ Changelog
3
3
 
4
4
  All notable changes to this project will be documented in this file.
5
5
 
6
+ [0.0.3] - 2021-08-25
7
+ --------------------
8
+
9
+ ### Added
10
+
11
+ - Allow styling per sheet
12
+
13
+ ### Changed
14
+
15
+ - Reimplement sheets/thumbnail
16
+
6
17
  [0.0.2] - 2021-08-21
7
18
  --------------------
8
19
 
@@ -10,11 +10,15 @@ module Dieses
10
10
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
11
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
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}; }
13
+ svg { stroke: %8{color}; }
14
+ svg { stroke-width: %8{medium}; }
15
+ .altcolor { stroke: %8{altcolor}; }
16
+ .extrafine { stroke-width: %8{extrafine}; }
17
+ .fine { stroke-width: %8{fine}; }
18
+ .medium { stroke-width: %8{medium}; }
19
+ .broad { stroke-width: %8{broad}; }
20
+ .extrabroad { stroke-width: %8{extrabroad}; }
21
+ .dashed { stroke-dasharray: %8{dashed}; }
18
22
  </style>
19
23
  <g id="sheet">
20
24
  %{content}
@@ -55,16 +59,18 @@ module Dieses
55
59
  DEFAULT_LINEWIDTH = 0.04
56
60
  DEFAULT_DASHES = [2, 2].freeze
57
61
 
58
- def variables(**kwargs) # rubocop:disable Metrics/PerceivedComplexity
62
+ def variables(**kwargs) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/PerceivedComplexity
59
63
  paper.to_h.merge(kwargs).tap do |variables|
60
- linewidth = (variables[:medium] || DEFAULT_LINEWIDTH).to_f
64
+ linewidth = (variables[:linewidth] || variables[:medium] || DEFAULT_LINEWIDTH).to_f
61
65
 
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(' ')
66
+ variables[:color] ||= DEFAULT_COLOR
67
+ variables[:altcolor] ||= DEFAULT_ALTCOLOR
68
+ variables[:medium] ||= linewidth.to_s
69
+ variables[:extrafine] ||= (linewidth / 4.0).to_s
70
+ variables[:fine] ||= (linewidth / 2.0).to_s
71
+ variables[:broad] ||= (linewidth * 2.0).to_s
72
+ variables[:extrabroad] ||= (linewidth * 4.0).to_s
73
+ variables[:dashed] ||= DEFAULT_DASHES.map(&:to_s).join(' ')
68
74
  end
69
75
  end
70
76
  end
@@ -43,20 +43,20 @@ module Dieses
43
43
 
44
44
  module Bundle
45
45
  def quartet
46
- hline :ascender, :thick, after: proc { height }
46
+ hline :ascender, :broad, after: proc { height }
47
47
  hline :waist, :altcolor, after: proc { x_height }
48
48
  hline :base, after: proc { height }
49
- hline :descender, :thick, after: proc { gap }
49
+ hline :descender, :broad, after: proc { gap }
50
50
  end
51
51
 
52
52
  # codebeat:disable[ABC]
53
53
  def sextet
54
- hline :ascender2, :thick, after: proc { height }
54
+ hline :ascender2, :broad, after: proc { height }
55
55
  hline :ascender1, :dashed, after: proc { height }
56
56
  hline :waist, :altcolor, after: proc { x_height }
57
57
  hline :base, after: proc { height }
58
58
  hline :descender1, :dashed, after: proc { height }
59
- hline :descender2, :thick, after: proc { gap }
59
+ hline :descender2, :broad, after: proc { gap }
60
60
  end
61
61
  # codebeat:enable[ABC]
62
62
  end
@@ -35,6 +35,7 @@ module Dieses
35
35
  klass.define :proto
36
36
  klass.define :variants, default: {}
37
37
  klass.define :param, default: Param.new
38
+ klass.define :style, default: Param.new
38
39
  end
39
40
  end
40
41
 
@@ -81,7 +82,7 @@ module Dieses
81
82
 
82
83
  def produce(**kwargs)
83
84
  call
84
- canvas.render(**kwargs)
85
+ canvas.render(variables: self.class.style.to_h, **kwargs)
85
86
  end
86
87
 
87
88
  private
@@ -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, :thin, angle: 55.0
12
- cline :connective, :thin, :dashed, angle: 50.0
11
+ cline :slant, :fine, angle: 55.0
12
+ cline :connective, :fine, :dashed, angle: 50.0
13
13
 
14
14
  def call
15
15
  scribes
@@ -8,7 +8,7 @@ module Dieses
8
8
 
9
9
  include Mixins::Scribes[:quartet].with unit: [5, 7, 10]
10
10
 
11
- cline :slant, :thin, angle: 60.0
11
+ cline :slant, :fine, angle: 60.0
12
12
 
13
13
  def call
14
14
  scribes
@@ -8,7 +8,7 @@ module Dieses
8
8
 
9
9
  include Mixins::Scribes[:quartet].with unit: [5, 7, 10]
10
10
 
11
- cline :slant, :thin, angle: 81.0
11
+ cline :slant, :fine, angle: 81.0
12
12
 
13
13
  def call
14
14
  scribes
@@ -17,8 +17,8 @@ module Dieses
17
17
  hline :hline
18
18
  vline :vline
19
19
 
20
- cline :slant, :thin, angle: 52.0
21
- cline :connective, :thin, :dashed, angle: 30.0
20
+ cline :slant, :fine, angle: 52.0
21
+ cline :connective, :fine, :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, :thin, angle: 52.0
12
- cline :connective, :thin, :dashed, angle: 30.0
11
+ cline :slant, :fine, angle: 52.0
12
+ cline :connective, :fine, :dashed, angle: 30.0
13
13
 
14
14
  def call
15
15
  scribes
@@ -6,16 +6,20 @@ module Dieses
6
6
  class Thumbnail < Sheet
7
7
  sheet :thumbnail, 'Thumbnails'
8
8
 
9
+ style linewidth: 0.3, color: '#007f80'
10
+
9
11
  DENSITY = {
10
- '1': Param.(row: 4, col: 4, width: 8, height: 10),
11
- '3': Param.(row: 3, col: 6, width: 8, height: 10),
12
- '2': Param.(row: 5, col: 5, width: 6, height: 8),
13
- '4': Param.(row: 4, col: 7, width: 6, height: 8)
12
+ '1': Param.(row: 5, col: 3, width: 10, height: 10),
13
+ '2': Param.(row: 4, col: 4, width: 8, height: 10),
14
+ '3': Param.(row: 5, col: 5, width: 6, height: 8),
15
+ '4': Param.(row: 6, col: 5, width: 6, height: 6)
14
16
  }.freeze
15
17
 
16
- variate density: %i[1 2 3 4], unit: 5 do
17
- self.name = density.to_s
18
- self.desc = "Density #{density}"
18
+ variate density: DENSITY.keys, unit: 5 do
19
+ self.name = density
20
+
21
+ param = DENSITY[density]
22
+ self.desc = "Density #{density} (#{param.row}x#{param.col} thumbnails on A4 paper)"
19
23
  end
20
24
 
21
25
  def call
@@ -25,9 +29,9 @@ module Dieses
25
29
  repeat row do
26
30
  repeat col do
27
31
  rect :rect, width: width, height: height
28
- right(width + 1)
32
+ right(width + 1.25)
29
33
  end
30
- down(height + 1)
34
+ down(height + 1.25)
31
35
  end
32
36
  end
33
37
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dieses
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
  end
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.2
4
+ version: 0.0.3
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-21 00:00:00.000000000 Z
11
+ date: 2021-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler