-
Hi, I've been following the watermark tutorial to check how to use the library (need to add some text on top of an image). Tried couple of other examples found here and there as well and with none of them am I able to display a text that is not those squares you get when your encoding is messed up. I didn't find any place in the doc on how to specify the encoding. Is there any magic trick I missed? Thanks for your help Environment: docker ruby:3.1.2-alpine3.15 + vips APK / Rails 7.0.5.1 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @fdutey, It should work, I would guess the fonts are missing, or fc cannot find them. For example, on this system (ubuntu 23.04) with this program: #!/usr/bin/ruby
require 'vips'
im = Vips::Image.new_from_file ARGV[0], access: :sequential
text = Vips::Image.text ARGV[2], dpi: 600, rgba: true
text = text.rotate 45
text = (text * [1, 1, 1, 0.3]).cast(:uchar)
text = text.embed 100, 100, text.width + 200, text.height + 200
text = text.replicate 1 + im.width / text.width, 1 + im.height / text.height
text = text.crop 0, 0, im.width, im.height
im = im.composite(text, "over")
im.write_to_file ARGV[1] I can run: ./watermark.rb ~/pics/nina.jpg x.jpg '<span color="red">Hello</span> <i>world!</i> 😃😂🫠' To make: |
Beta Was this translation helpful? Give feedback.
-
To debug fontconfig issues, you can use FC_DEBUG=1 ./watermark.rb ~/pics/nina.jpg x.jpg '<span color="red">Hello</span> <i>world!</i> 😃😂🫠' To show a crazy amount of debugging information around font file selection. |
Beta Was this translation helpful? Give feedback.
To debug fontconfig issues, you can use
fc-list
to show all current fonts,fc-cache
to rebuild the font cache, and run progs with (for example):To show a crazy amount of debugging information around font file selection.