kawaii_text 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +24 -0
- data/README.md +125 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/examples/examples.rb +16 -0
- data/examples/output/custom_background.png +0 -0
- data/examples/output/custom_offset_textlayer_config.png +0 -0
- data/examples/output/custom_primary_text_layer_config.png +0 -0
- data/examples/output/simple.png +0 -0
- data/kawaii_text.gemspec +42 -0
- data/lib/assets/backgrounds/1.jpeg +0 -0
- data/lib/assets/backgrounds/2.jpeg +0 -0
- data/lib/assets/backgrounds/3.jpeg +0 -0
- data/lib/assets/backgrounds/4.jpeg +0 -0
- data/lib/assets/backgrounds/5.jpeg +0 -0
- data/lib/assets/fonts/CANDY.TTF +0 -0
- data/lib/assets/fonts/PlatonickNF.ttf +0 -0
- data/lib/assets/fonts/UndergroundNF.ttf +0 -0
- data/lib/assets/fonts/nauvo___.ttf +0 -0
- data/lib/kawaii_text.rb +9 -0
- data/lib/kawaii_text/directory_helpers.rb +17 -0
- data/lib/kawaii_text/generator.rb +115 -0
- data/lib/kawaii_text/text_layer_config.rb +30 -0
- data/lib/kawaii_text/version.rb +3 -0
- metadata +129 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d80e40cb94b79f9fff495d3c7816765c4e206720292bad162957aa8e9c98e1bd
|
4
|
+
data.tar.gz: 418f4e89b3311c3631b54e1f60db658d8190d79e3cedbddde04221528f832f16
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c08034767a155a88b13ed37f1988ccecafbcbc15f8024893e8494899e1968592726a337424ffbff4ba98f316b822f8880f222604e7ab695bdb42dae84ff2ce8e
|
7
|
+
data.tar.gz: edc4371c71b4bb7a39a32f163c3ead2307967dc1beadc1eb53b862a3306e9b1b856565bb7bf6f4a143fc2cbf485188e2cee21208ff28100b65a0f22f155391e1
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
kawaii_text (0.1.0)
|
5
|
+
rmagick
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
minitest (5.13.0)
|
11
|
+
rake (10.5.0)
|
12
|
+
rmagick (4.0.0)
|
13
|
+
|
14
|
+
PLATFORMS
|
15
|
+
ruby
|
16
|
+
|
17
|
+
DEPENDENCIES
|
18
|
+
bundler (~> 1.17)
|
19
|
+
kawaii_text!
|
20
|
+
minitest (~> 5.0)
|
21
|
+
rake (~> 10.0)
|
22
|
+
|
23
|
+
BUNDLED WITH
|
24
|
+
1.17.3
|
data/README.md
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
# KawaiiText
|
2
|
+
|
3
|
+
## What is this ?
|
4
|
+
Its a ruby gem to render your text to an image with fancy fonts and some effects with backgrounds. Might be suitable if
|
5
|
+
you ever had to generate these kind of things automatically for using them as cover or
|
6
|
+
header images. It makes use of ImageMagick for all image manipulations
|
7
|
+
|
8
|
+
## Why does this exist ?
|
9
|
+
I had a need for something like this for a project of mine and wasn't able to find anything that fit my use case.
|
10
|
+
|
11
|
+
## Examples
|
12
|
+
![Simple](https://github.com/owaiswiz/kawaiitext/blob/master/examples/output/simple.png?raw=true "Simple")
|
13
|
+
|
14
|
+
![Custom Background](https://github.com/owaiswiz/kawaiitext/blob/master/examples/output/custom_background.png?raw=true "Custom Background")
|
15
|
+
|
16
|
+
![Custom Offset Text Layer Config](https://github.com/owaiswiz/kawaiitext/blob/master/examples/output/custom_offset_textlayer_config.png?raw=true "Custom Offset Text Layer Config")
|
17
|
+
|
18
|
+
## Installation
|
19
|
+
|
20
|
+
Add this line to your application's Gemfile:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
gem 'kawaii_text'
|
24
|
+
```
|
25
|
+
|
26
|
+
And then execute:
|
27
|
+
|
28
|
+
$ bundle
|
29
|
+
|
30
|
+
Or install it yourself as:
|
31
|
+
|
32
|
+
$ gem install kawaii_text
|
33
|
+
|
34
|
+
## Usage
|
35
|
+
|
36
|
+
### 1. Require
|
37
|
+
```ruby
|
38
|
+
require "kawaii_text"
|
39
|
+
```
|
40
|
+
|
41
|
+
### 2. Basic Usage
|
42
|
+
By default, this gem randomly picks a background image and font along with a default color and some stroke styles. The output is saved to the same directory as the script is run in a file named "output.png".
|
43
|
+
```ruby
|
44
|
+
KawaiiText::Generator.new(text: "Daisy in a field of roses")
|
45
|
+
```
|
46
|
+
#### Output
|
47
|
+
![Simple](https://github.com/owaiswiz/kawaiitext/blob/master/examples/output/simple.png?raw=true "Simple")
|
48
|
+
|
49
|
+
### 3. Advanced Usage
|
50
|
+
The generator takes a lot of keyword arguments while initialization which can be used to modify various settings. The description of supported arguments and what they do are given below:
|
51
|
+
|
52
|
+
1. **text** (required, *string*) - Specifies the text to be rendered.
|
53
|
+
```ruby
|
54
|
+
KawaiiText::Generator.new(text: "Daisy in a field of roses")
|
55
|
+
```
|
56
|
+
___
|
57
|
+
2. **font_path** (optional, *string*) - Specifies the font to be used (.ttf file). By default it randomly picks a font out of the 4 included with this library.
|
58
|
+
```ruby
|
59
|
+
KawaiiText::Generator.new(text: "bury a friend", font_path: "/home/owaiswiz/Roboto.ttf")
|
60
|
+
```
|
61
|
+
___
|
62
|
+
3. **background_filepath** (optional, *string*) - Specifies the background file to be used. By default, a folder with 4 backgrounds included with this library is used and a random file from that folder is selected.
|
63
|
+
```ruby
|
64
|
+
KawaiiText::Generator.new(text: "bury a friend", backgrounds_folder: "/home/owaiswiz/images/rak.png")
|
65
|
+
```
|
66
|
+
___
|
67
|
+
4. **backgrounds_folder** (optional, *string*) - Specifies the folder to be used for randomly picking a background. By default, a folder with 4 backgrounds included with this library is used. ***(Has no effect if background_filepath is specified)***.
|
68
|
+
```ruby
|
69
|
+
KawaiiText::Generator.new(text: "bury a friend", backgrounds_folder: "/home/owaiswiz/images")
|
70
|
+
```
|
71
|
+
___
|
72
|
+
5. **supported_formats** (optional, *array of strings*) - Specifies the file types to consider while randomly picking a background from backgrounds_folder. By default its value is ["jpg", "jpeg", "png", "gif"]. ***(Has no effect if background_filepath is specified)***.
|
73
|
+
```ruby
|
74
|
+
KawaiiText::Generator.new(text: "bury a friend", backgrounds_folder: "/home/owaiswiz/images", supported_formats: ["png", "bmp"])
|
75
|
+
```
|
76
|
+
___
|
77
|
+
6. **working_directory** (optional, *string*) - Specifies the path to the directory where output is saved. By default its value is the current directory from which you are running ruby.
|
78
|
+
```ruby
|
79
|
+
KawaiiText::Generator.new(text: "bury a friend", working_directory: "/home/owaiswiz/generated_images")
|
80
|
+
```
|
81
|
+
___
|
82
|
+
7. **output_file_name** (optional, *string*) - Specifies the name of the output file. By default its value is "output".
|
83
|
+
```ruby
|
84
|
+
KawaiiText::Generator.new(text: "bury a friend", output_file_name: "uncomfortable.png")
|
85
|
+
```
|
86
|
+
___
|
87
|
+
8. **primary_text_layer_config** (optional, *PrimaryTextLayerConfig*) - Configures the stroke size, stroke color and stroke fill color for the primary text layer.
|
88
|
+
```ruby
|
89
|
+
config = KawaiiText::PrimaryTextLayerConfig.new
|
90
|
+
config.pointsize = 72
|
91
|
+
config.stroke_width = 5
|
92
|
+
config.stroke_color = "#e24906"
|
93
|
+
config.stroke_fill_color = "#dc9f66"
|
94
|
+
|
95
|
+
KawaiiText::Generator.new(text: "Jokes", primary_text_layer_config: config)
|
96
|
+
|
97
|
+
```
|
98
|
+
***Output:***
|
99
|
+
![Custom Primary Text Layer Config](https://github.com/owaiswiz/kawaiitext/blob/master/examples/output/custom_primary_text_layer_config.png?raw=true "Custom Primary Text Layer Config")
|
100
|
+
___
|
101
|
+
9. **offset_text_layer_config** (optional, *OffsetTextLayerConfig*) - Configures the stroke size, stroke color and stroke fill color for the primary text layer.
|
102
|
+
```ruby
|
103
|
+
config = KawaiiText::OffsetTextLayerConfig.default
|
104
|
+
config.stroke_color = "#59C3C3"
|
105
|
+
config.stroke_fill_color = "#DCB6D5"
|
106
|
+
config.stroke_fill_color = "none"
|
107
|
+
config.stroke_width = 2
|
108
|
+
KawaiiText::Generator.new text: "bury a friend", offset_text_layer_config: config
|
109
|
+
```
|
110
|
+
***Output:***
|
111
|
+
![Custom Offset Text Layer Config](https://github.com/owaiswiz/kawaiitext/blob/master/examples/output/custom_offset_textlayer_config.png?raw=true "Custom Offset Text Layer Config")
|
112
|
+
|
113
|
+
### Dependencies
|
114
|
+
* Make sure you have ImageMagick installed.
|
115
|
+
* RMagick (should be automatically installed if not available)
|
116
|
+
|
117
|
+
## Development
|
118
|
+
|
119
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
120
|
+
|
121
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
122
|
+
|
123
|
+
## Contributing
|
124
|
+
|
125
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/owaiswiz/kawaiitext.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "kawaii_text"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "kawaii_text"
|
2
|
+
|
3
|
+
#Simple using defaults
|
4
|
+
KawaiiText::Generator.new text: "Daisy in a field of roses"
|
5
|
+
|
6
|
+
#Custom Background
|
7
|
+
KawaiiText::Generator.new text: "Everything I Wanted", background_filepath: "/home/owaiswiz/Projects/Ruby/kawaiitext/lib/assets/backgrounds/3.jpeg"
|
8
|
+
|
9
|
+
#Custom Offset Text Layer Settings - Similar can be done for primary layer (refer usage)
|
10
|
+
config = KawaiiText::OffsetTextLayerConfig.default
|
11
|
+
config.stroke_color = "\"#59C3C3\""
|
12
|
+
config.stroke_fill_color = "\"#DCB6D5\""
|
13
|
+
config.stroke_fill_color = "\"none\""
|
14
|
+
config.stroke_width = 2
|
15
|
+
KawaiiText::Generator.new text: "bury a friend", offset_text_layer_config: config
|
16
|
+
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/kawaii_text.gemspec
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "kawaii_text/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "kawaii_text"
|
8
|
+
spec.version = KawaiiText::VERSION
|
9
|
+
spec.authors = ["Owais"]
|
10
|
+
spec.email = ["owaiswiz@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{A Ruby Library that renders text in fancy font with some effects to an image}
|
13
|
+
spec.homepage = "https://github.com/owaiswiz/kawaiitext"
|
14
|
+
|
15
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
16
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
17
|
+
if spec.respond_to?(:metadata)
|
18
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
19
|
+
|
20
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
21
|
+
spec.metadata["source_code_uri"] = "https://github.com/owaiswiz/kawaiitext"
|
22
|
+
spec.metadata["changelog_uri"] = "https://github.com/owaiswiz/kawaiitext/releases"
|
23
|
+
else
|
24
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
25
|
+
"public gem pushes."
|
26
|
+
end
|
27
|
+
|
28
|
+
# Specify which files should be added to the gem when it is released.
|
29
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
30
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
31
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
32
|
+
end
|
33
|
+
spec.bindir = "exe"
|
34
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
35
|
+
spec.require_paths = ["lib"]
|
36
|
+
|
37
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
38
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
39
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
40
|
+
|
41
|
+
spec.add_runtime_dependency "rmagick"
|
42
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/kawaii_text.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module KawaiiText
|
2
|
+
def self.root
|
3
|
+
File.dirname __dir__
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.assets
|
7
|
+
File.join root, 'assets'
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.backgrounds_dir
|
11
|
+
File.join assets, 'backgrounds'
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.fonts_dir
|
15
|
+
File.join assets, 'fonts'
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
require "rmagick"
|
2
|
+
|
3
|
+
module KawaiiText
|
4
|
+
class Generator
|
5
|
+
SUPPORTED_BACKGROUND_FILEFORMATS = ["jpg", "jpeg", "png", "gif"]
|
6
|
+
BACKGROUND_TO_TEXT_LAYER_WIDTH_RATIO = 1.15
|
7
|
+
BACKGROUND_TO_TEXT_LAYER_HEIGHT_RATIO = 1.05
|
8
|
+
PRIMARY_TEXT_LAYER_FILENAME = "primary"
|
9
|
+
OFFSET_TEXT_LAYER_FILENAME = "offset"
|
10
|
+
MERGED_TEXT_LAYER_FILENAME = "merged"
|
11
|
+
|
12
|
+
def initialize text:, font_path: nil, backgrounds_folder: nil, background_filepath: nil, supported_formats: nil, working_directory: nil, primary_text_layer_config: nil, offset_text_layer_config: nil, output_file_name: nil
|
13
|
+
@text = text
|
14
|
+
@font_path = font_path || get_random_font_from_fonts_folder
|
15
|
+
@backgrounds_folder = backgrounds_folder || KawaiiText.backgrounds_dir
|
16
|
+
@background_filepath = background_filepath
|
17
|
+
@working_directory = working_directory
|
18
|
+
@supported_formats = supported_formats || SUPPORTED_BACKGROUND_FILEFORMATS
|
19
|
+
@working_directory = working_directory || "."
|
20
|
+
@output_file_name = output_file_name || "output"
|
21
|
+
|
22
|
+
@primary_text_layer_config = primary_text_layer_config || PrimaryTextLayerConfig.default
|
23
|
+
@offset_text_layer_config = offset_text_layer_config || OffsetTextLayerConfig.default
|
24
|
+
|
25
|
+
@background_filepath ||= get_random_background_from_backgrounds_folder
|
26
|
+
@background_image = open_image @background_filepath
|
27
|
+
|
28
|
+
generate_primary_text_layer
|
29
|
+
generate_offset_text_layer
|
30
|
+
merge_text_layers
|
31
|
+
merge_text_and_background_layers
|
32
|
+
cleanup
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
def open_image file_path
|
37
|
+
Magick::ImageList.new(file_path)
|
38
|
+
end
|
39
|
+
|
40
|
+
def get_random_background_from_backgrounds_folder
|
41
|
+
files = Dir["#{@backgrounds_folder}/**/**.{#{@supported_formats.join(',')}}"]
|
42
|
+
files.sample
|
43
|
+
end
|
44
|
+
|
45
|
+
def get_random_font_from_fonts_folder
|
46
|
+
fonts = Dir["#{KawaiiText.fonts_dir}/**/**.{ttf,TTF}"]
|
47
|
+
fonts.sample
|
48
|
+
end
|
49
|
+
|
50
|
+
def generate_primary_text_layer
|
51
|
+
generate_text_layer @primary_text_layer_config, PRIMARY_TEXT_LAYER_FILENAME
|
52
|
+
end
|
53
|
+
|
54
|
+
def generate_offset_text_layer
|
55
|
+
generate_text_layer @offset_text_layer_config, OFFSET_TEXT_LAYER_FILENAME
|
56
|
+
end
|
57
|
+
|
58
|
+
def generate_text_layer text_layer_config, output_file_name
|
59
|
+
text_layer_width = (@background_image.columns / BACKGROUND_TO_TEXT_LAYER_WIDTH_RATIO).round
|
60
|
+
text_layer_height = (@background_image.rows / BACKGROUND_TO_TEXT_LAYER_HEIGHT_RATIO).round
|
61
|
+
|
62
|
+
command = ["convert"]
|
63
|
+
command << "-size #{text_layer_width}x#{text_layer_height}"
|
64
|
+
command << "-background transparent"
|
65
|
+
command << "-font \"#{@font_path}\"" if @font_path
|
66
|
+
command << "-gravity center"
|
67
|
+
command << "-pointsize #{text_layer_config.pointsize}"
|
68
|
+
command << "-strokewidth #{text_layer_config.stroke_width}"
|
69
|
+
command << "-stroke \"#{text_layer_config.stroke_color}\""
|
70
|
+
command << "-fill \"#{text_layer_config.stroke_fill_color}\""
|
71
|
+
command << "-interline-spacing #{text_layer_config.pointsize/2}"
|
72
|
+
command << "caption:\"#{@text}\""
|
73
|
+
command << "\"#{@working_directory}/#{output_file_name}.png\""
|
74
|
+
|
75
|
+
`#{command.join " "}`
|
76
|
+
end
|
77
|
+
|
78
|
+
def merge_text_layers
|
79
|
+
file_1_path = "#{@working_directory}/#{PRIMARY_TEXT_LAYER_FILENAME}.png"
|
80
|
+
file_2_path = "#{@working_directory}/#{OFFSET_TEXT_LAYER_FILENAME}.png"
|
81
|
+
file_output_path = "#{@working_directory}/#{MERGED_TEXT_LAYER_FILENAME}.png"
|
82
|
+
merge_images offset: "-3+4", file_1_path: file_1_path, file_2_path: file_2_path, file_output_path: file_output_path
|
83
|
+
end
|
84
|
+
|
85
|
+
def merge_text_and_background_layers
|
86
|
+
file_1_path = "#{@working_directory}/#{MERGED_TEXT_LAYER_FILENAME}.png"
|
87
|
+
file_2_path = @background_filepath
|
88
|
+
file_output_path = "#{@working_directory}/#{@output_file_name}.png"
|
89
|
+
merge_images file_1_path: file_1_path, file_2_path: file_2_path, file_output_path: file_output_path
|
90
|
+
end
|
91
|
+
|
92
|
+
def merge_images offset: nil, file_1_path:, file_2_path:, file_output_path:
|
93
|
+
command = ["composite"]
|
94
|
+
command << "-dissolve 100"
|
95
|
+
command << "-gravity center"
|
96
|
+
command << "-geometry #{offset}" if offset
|
97
|
+
command << "\"#{file_1_path}\""
|
98
|
+
command << "\"#{file_2_path}\""
|
99
|
+
command << "-alpha Set"
|
100
|
+
command << "\"#{file_output_path}\""
|
101
|
+
|
102
|
+
`#{command.join " "}`
|
103
|
+
end
|
104
|
+
|
105
|
+
def cleanup
|
106
|
+
self.class.delete_if_exists "#{@working_directory}/#{PRIMARY_TEXT_LAYER_FILENAME}.png"
|
107
|
+
self.class.delete_if_exists "#{@working_directory}/#{OFFSET_TEXT_LAYER_FILENAME}.png"
|
108
|
+
self.class.delete_if_exists "#{@working_directory}/#{MERGED_TEXT_LAYER_FILENAME}.png"
|
109
|
+
end
|
110
|
+
|
111
|
+
def self.delete_if_exists file_path
|
112
|
+
File.delete file_path if File.exists? file_path
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module KawaiiText
|
2
|
+
class TextLayerConfig
|
3
|
+
attr_accessor :pointsize, :stroke_width, :stroke_color, :stroke_fill_color
|
4
|
+
|
5
|
+
def self.default
|
6
|
+
config = TextLayerConfig.new
|
7
|
+
config.pointsize = 72
|
8
|
+
config.stroke_width = 3
|
9
|
+
config.stroke_color = "none"
|
10
|
+
config.stroke_fill_color = "none"
|
11
|
+
config
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class PrimaryTextLayerConfig < TextLayerConfig
|
16
|
+
def self.default
|
17
|
+
config = TextLayerConfig.default
|
18
|
+
config.stroke_fill_color = "white"
|
19
|
+
config
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class OffsetTextLayerConfig < TextLayerConfig
|
24
|
+
def self.default
|
25
|
+
config = TextLayerConfig.default
|
26
|
+
config.stroke_color = "green"
|
27
|
+
config
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kawaii_text
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Owais
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-11-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.17'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.17'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rmagick
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- owaiswiz@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".travis.yml"
|
78
|
+
- Gemfile
|
79
|
+
- Gemfile.lock
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- bin/console
|
83
|
+
- bin/setup
|
84
|
+
- examples/examples.rb
|
85
|
+
- examples/output/custom_background.png
|
86
|
+
- examples/output/custom_offset_textlayer_config.png
|
87
|
+
- examples/output/custom_primary_text_layer_config.png
|
88
|
+
- examples/output/simple.png
|
89
|
+
- kawaii_text.gemspec
|
90
|
+
- lib/assets/backgrounds/1.jpeg
|
91
|
+
- lib/assets/backgrounds/2.jpeg
|
92
|
+
- lib/assets/backgrounds/3.jpeg
|
93
|
+
- lib/assets/backgrounds/4.jpeg
|
94
|
+
- lib/assets/backgrounds/5.jpeg
|
95
|
+
- lib/assets/fonts/CANDY.TTF
|
96
|
+
- lib/assets/fonts/PlatonickNF.ttf
|
97
|
+
- lib/assets/fonts/UndergroundNF.ttf
|
98
|
+
- lib/assets/fonts/nauvo___.ttf
|
99
|
+
- lib/kawaii_text.rb
|
100
|
+
- lib/kawaii_text/directory_helpers.rb
|
101
|
+
- lib/kawaii_text/generator.rb
|
102
|
+
- lib/kawaii_text/text_layer_config.rb
|
103
|
+
- lib/kawaii_text/version.rb
|
104
|
+
homepage: https://github.com/owaiswiz/kawaiitext
|
105
|
+
licenses: []
|
106
|
+
metadata:
|
107
|
+
homepage_uri: https://github.com/owaiswiz/kawaiitext
|
108
|
+
source_code_uri: https://github.com/owaiswiz/kawaiitext
|
109
|
+
changelog_uri: https://github.com/owaiswiz/kawaiitext/releases
|
110
|
+
post_install_message:
|
111
|
+
rdoc_options: []
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
requirements: []
|
125
|
+
rubygems_version: 3.0.6
|
126
|
+
signing_key:
|
127
|
+
specification_version: 4
|
128
|
+
summary: A Ruby Library that renders text in fancy font with some effects to an image
|
129
|
+
test_files: []
|