Skip to content

Commit

Permalink
Add few backgrounds and fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
owaiswiz committed Nov 30, 2019
1 parent 94b7711 commit 635b787
Show file tree
Hide file tree
Showing 10 changed files with 5 additions and 5 deletions.
Binary file added lib/assets/backgrounds/1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lib/assets/backgrounds/2.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lib/assets/backgrounds/3.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lib/assets/backgrounds/4.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lib/assets/backgrounds/5.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lib/assets/fonts/CANDY.TTF
Binary file not shown.
Binary file added lib/assets/fonts/PlatonickNF.ttf
Binary file not shown.
Binary file added lib/assets/fonts/UndergroundNF.ttf
Binary file not shown.
Binary file added lib/assets/fonts/nauvo___.ttf
Binary file not shown.
10 changes: 5 additions & 5 deletions lib/kawaii_text/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ class Generator
PRIMARY_TEXT_LAYER_FILENAME = "primary"
OFFSET_TEXT_LAYER_FILENAME = "offset"
MERGED_TEXT_LAYER_FILENAME = "merged"
FINAL_OUTUT_FILENAME = "output"

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
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
@text = text
@font_path = font_path || get_random_font_from_fonts_folder
@backgrounds_folder = backgrounds_folder || KawaiiText.backgrounds_dir
@background_filepath = background_filepath
@working_directory = working_directory
@supported_formats = supported_formats || SUPPORTED_BACKGROUND_FILEFORMATS
@working_directory = working_directory || "live_image_preview"
@working_directory = working_directory || "."
@output_file_name = output_file_name || "output"

@primary_text_layer_config = primary_text_layer_config || PrimaryTextLayerConfig.default
@offset_text_layer_config = offset_text_layer_config || OffsetTextLayerConfig.default
Expand All @@ -42,7 +42,7 @@ def get_random_background_from_backgrounds_folder
end

def get_random_font_from_fonts_folder
fonts = Dir["#{KawaiiText.fonts_dir}/**/**.ttf"]
fonts = Dir["#{KawaiiText.fonts_dir}/**/**.{ttf,TTF}"]
fonts.sample
end

Expand Down Expand Up @@ -84,7 +84,7 @@ def merge_text_layers
def merge_text_and_background_layers
file_1_path = "#{@working_directory}/#{MERGED_TEXT_LAYER_FILENAME}.png"
file_2_path = @background_filepath
file_output_path = "#{@working_directory}/#{FINAL_OUTUT_FILENAME}.png"
file_output_path = "#{@working_directory}/#{@output_file_name}.png"
merge_images file_1_path: file_1_path, file_2_path: file_2_path, file_output_path: file_output_path
end

Expand Down

0 comments on commit 635b787

Please sign in to comment.