magick_title icon indicating copy to clipboard operation
magick_title copied to clipboard

Image with @- text is created for any text

Open installero opened this issue 7 years ago • 5 comments

Whatever text I pass as an argument I always get something like this:

test_543a34ed72295e849bf8db8d9f2ee2827298caa7

> require 'magick_title'
 => true

> MagickTitle.options[:font] = 'Lato-Medium.ttf'
 => "Lato-Medium.ttf"

> MagickTitle.say("Hello!")
 => #<MagickTitle::Image:0x0000000193b6a0 @text="Hello!", @old_path=nil, @options={:root=>"./", :font=>"Lato-Medium.ttf", :font_path=>#<Proc:0x00000001898f18@/home/install/.rvm/gems/ruby-2.4.1/gems/magick_title-0.2.0/lib/magick_title/options.rb:32>, :font_size=>50, :destination=>#<Proc:0x00000001898ef0@/home/install/.rvm/gems/ruby-2.4.1/gems/magick_title-0.2.0/lib/magick_title/options.rb:34>, :extension=>"png", :text_transform=>nil, :width=>800, :height=>nil, :background_color=>"#ffffff", :background_alpha=>"00", :color=>"#68962c", :weight=>400, :kerning=>0, :line_height=>0, :command_path=>nil, :log_command=>false, :cache=>true, :to_html=>{:parent=>{:tag=>"h1", :class=>"image-title"}, :class=>"magick-title"}}, @filename="hello_3a34ca411e95b0bff880e5ee9d730e5efa47ad88.png", @path="./public/system/titles", @url="/system/titles/hello_3a34ca411e95b0bff880e5ee9d730e5efa47ad88.png">

Here are the versions of imagemagick, ruby and magick_title gem that I use.

$ convert --version
Version: ImageMagick 6.8.9-9 Q16 x86_64 2017-07-31 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png rsvg tiff wmf x xml zlib

$ ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]

$ gem list magick_title

*** LOCAL GEMS ***

magick_title (0.2.0)

installero avatar Jan 14 '18 18:01 installero

Does the font exist in the font path?

citrus avatar Jan 15 '18 18:01 citrus

Yes, the convert call would throw an error otherwise. Something like this:

2.4.1 :002 > MagickTitle.say("Hello!")
convert: unable to read font `./fonts/PermanentMarker.ttf' @ warning/annotate.c/RenderType/872.
 => #<MagickTitle::Image:0x00000002a2d490 @text="Hello!", @old_path=nil, @options={:root=>"./", :font=>"PermanentMarker.ttf", :font_path=>#<Proc:0x00000002a2cfe0@/home/install/.rvm/gems/ruby-2.4.1/gems/magick_title-0.2.0/lib/magick_title/options.rb:32>, :font_size=>50, :destination=>#<Proc:0x00000002a2cfb8@/home/install/.rvm/gems/ruby-2.4.1/gems/magick_title-0.2.0/lib/magick_title/options.rb:34>, :extension=>"png", :text_transform=>nil, :width=>800, :height=>nil, :background_color=>"#ffffff", :background_alpha=>"00", :color=>"#68962c", :weight=>400, :kerning=>0, :line_height=>0, :command_path=>nil, :log_command=>false, :cache=>true, :to_html=>{:parent=>{:tag=>"h1", :class=>"image-title"}, :class=>"magick-title"}}, @filename="hello_44294732cd4f7a3173257d6d4da4a3e1c6d19801.png", @path="./public/system/titles", @url="/system/titles/hello_44294732cd4f7a3173257d6d4da4a3e1c6d19801.png">

installero avatar Jan 15 '18 18:01 installero

Hmm ok.. Does it work without specifying Lato as the font?

citrus avatar Jan 16 '18 00:01 citrus

Nope, the default font seems to be the PermanentMarker.ttf and convert can't find it, as I mentioned earlier.

installero avatar Jan 16 '18 09:01 installero

Same issue.

1v avatar Jan 05 '20 14:01 1v