shogi_koma 0.0.4 → 0.0.6

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
- SHA1:
3
- metadata.gz: ec2d2b63f97bbdbf1c316d34254cf37d1f5262c8
4
- data.tar.gz: dd9e8fbd289eaac2658dd8e20010a890749fc146
2
+ SHA256:
3
+ metadata.gz: 7006549d9682989e456fbd720bb13eab1d86f24e4e371cc0f4ee41f859ef50f7
4
+ data.tar.gz: e7bfcc042fb4f5fac11769bb5610376eb5ab001afa6c230b405494691e04a737
5
5
  SHA512:
6
- metadata.gz: cd24230b3e36836d6901cc8f906cc0ffab61a35cf1df6fb579b26bf7655877101eb97e9ce2a24611f338c3111bbb52e0eea14b5fd96cc0a0963b247d36a25bf5
7
- data.tar.gz: d9abe77247fef9c1372d5bfe5e279d0f755dc292fc64db886068e8be1f7b2739bd6b95636458feeba88ed9596e021ec19544fdd9dff68bc62b567df79cf120ab
6
+ metadata.gz: 7334f9c148ab19dd9106a56f9aeff5ba6a4f91c5c28f3f0b422ee426a73e5c51b225474851273ae6eef9667da633507864841680920707d0e755b5dfcc9ae8b5
7
+ data.tar.gz: 94243255b8037eeb37f91d12c479caa53a97725fcaf0ec82c959cb13f051a997776ec827c3d150db519c21de64443765ba2d3703117fc20d3c7d6bb54e5c823f
data/.travis.yml CHANGED
@@ -3,4 +3,4 @@ rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
5
  - 2.1.0
6
- - ruby-head
6
+ # - ruby-head
data/NEWS.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # NEWS
2
2
 
3
+ ## 0.0.5: 2014-08-18
4
+
5
+ ### Changes
6
+
7
+ * Improvements
8
+ * Add a parameter "border_scale".
9
+
10
+ * Fixes
11
+ * Removed needless require.
12
+
3
13
  ## 0.0.4: 2014-01-05
4
14
 
5
15
  ### Changes
data/README.md CHANGED
@@ -37,7 +37,7 @@ require "shogi_koma"
37
37
  painter = ShogiKoma::Painter.new
38
38
  #painter.width = 200 # as default
39
39
  #painter.height = 200 # as default
40
- #painter.font = "IPAMincho" # as default
40
+ #painter.font = "xxx" # default: "Hiragino Mincho" or "MS Mincho" or "Noto"
41
41
  painter.write_to_png("歩", "shogi_koma-fu1.png")
42
42
  painter.write_to_png("歩兵", "shogi_koma-fu2.png")
43
43
  ```
@@ -55,7 +55,6 @@ Cairo::ImageSurface.new(:argb32, width, height) do |surface|
55
55
  Cairo::Context.new(surface) do |context|
56
56
  context.scale(width, height)
57
57
  painter = ShogiKoma::Painter.new
58
- #painter.font = "IPAMincho" # as default
59
58
  painter.draw(context, "歩")
60
59
  end
61
60
  end
data/Rakefile CHANGED
@@ -1,9 +1,10 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rake/testtask"
2
3
 
3
- desc "Run test"
4
- task :test do
5
- Bundler::GemHelper.install_tasks
6
- ruby("-rubygems", "test/run-test.rb")
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
7
8
  end
8
9
 
9
10
  task :default => :test
@@ -3,12 +3,16 @@ require "fontdock"
3
3
 
4
4
  module ShogiKoma
5
5
  class Painter
6
- attr_accessor :width, :height, :font
6
+ attr_accessor :width, :height, :font, :border_scale
7
7
  attr_reader :body_color, :frame_color, :text_color
8
8
  def initialize
9
9
  @width = 200
10
10
  @height = 200
11
- @font = "IPAMincho"
11
+ ["Hiragino Mincho", "MS Mincho", "Noto"].each do |font_name|
12
+ @font = Fontdock::Local.find(font_name)
13
+ break if @font
14
+ end
15
+ @border_scale = 1.0
12
16
  set_body_rgb(1, 0.8, 0.2)
13
17
  set_frame_color(:black)
14
18
  set_text_color(:black)
@@ -62,7 +66,8 @@ module ShogiKoma
62
66
  end
63
67
 
64
68
  def draw_body(context)
65
- context.set_line_width(0.01)
69
+ border_width = 0.01 * @border_scale
70
+ context.set_line_width(border_width)
66
71
  context.move_to(0.2, 0.2)
67
72
  context.line_to(0.5, 0.1)
68
73
  context.line_to(0.8, 0.2)
@@ -1,3 +1,3 @@
1
1
  module ShogiKoma
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.6"
3
3
  end
data/lib/shogi_koma.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require "shogi_koma/version"
2
2
  require "shogi_koma/painter"
3
- require "shogi_koma/font"
4
3
 
5
4
  module ShogiKoma
6
5
  end
data/shogi_koma.gemspec CHANGED
@@ -24,6 +24,6 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency("test-unit")
25
25
  spec.add_development_dependency("test-unit-notify")
26
26
  spec.add_development_dependency("test-unit-rr")
27
- spec.add_development_dependency("bundler", "~> 1.3")
27
+ spec.add_development_dependency("bundler")
28
28
  spec.add_development_dependency("rake")
29
29
  end
@@ -1,4 +1,4 @@
1
- require "shogi_koma/painter"
1
+ require "test_helper"
2
2
  require "cairo"
3
3
 
4
4
  class PainterTest < Test::Unit::TestCase
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
4
+ require "shogi_koma"
5
+
6
+ require "test-unit"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shogi_koma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masafumi Yokoyama
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-05 00:00:00.000000000 Z
11
+ date: 2023-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cairo
@@ -84,16 +84,16 @@ dependencies:
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '1.3'
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '1.3'
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -128,13 +128,13 @@ files:
128
128
  - lib/shogi_koma/version.rb
129
129
  - sample/shogikoma.rb
130
130
  - shogi_koma.gemspec
131
- - test/run-test.rb
132
- - test/test-painter.rb
131
+ - test/painter_test.rb
132
+ - test/test_helper.rb
133
133
  homepage: https://github.com/myokoym/shogi_koma
134
134
  licenses:
135
135
  - MIT
136
136
  metadata: {}
137
- post_install_message:
137
+ post_install_message:
138
138
  rdoc_options: []
139
139
  require_paths:
140
140
  - lib
@@ -149,11 +149,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  requirements: []
152
- rubyforge_project:
153
- rubygems_version: 2.2.0
154
- signing_key:
152
+ rubygems_version: 3.5.3
153
+ signing_key:
155
154
  specification_version: 4
156
155
  summary: An image generater for Shogi's pieces
157
156
  test_files:
158
- - test/run-test.rb
159
- - test/test-painter.rb
157
+ - test/painter_test.rb
158
+ - test/test_helper.rb
data/test/run-test.rb DELETED
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "test-unit"
4
- require "test/unit/notify"
5
- require "test/unit/rr"
6
-
7
- base_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
8
- $LOAD_PATH.unshift(File.join(base_dir, "lib"))
9
- $LOAD_PATH.unshift(File.join(base_dir, "test"))
10
-
11
- exit Test::Unit::AutoRunner.run(true)