Page 1 of 2
Issue with rendering text with exclamation point at the end
Posted: 2016-12-08T19:48:30-07:00
by GarbageSauce
Hi guys. So this line here
Code: Select all
magick -background none -fill #000000 -font H:/python27/fonts/BW-penn.ttf -size x90 -gravity center label:"GO TIGERS!" asdf.png
Renders with the G clipped off. Removing the -gravity center argument does fix the problem although the text gets moved a tad. Is there a way to fix this?
Since the font I am forced to use doesn't exist anywhere else, you can download it here. This problem doesn't exist with the default ImageMagick font.
http://www.filedropper.com/bw-penn
Re: Issue with rendering text with exclamation point at the end
Posted: 2016-12-08T20:43:17-07:00
by fmw42
You have to escape the !. On unix \! and on windows ^!
If that does not work, then it is the font glyph set that is bad.
Re: Issue with rendering text with exclamation point at the end
Posted: 2016-12-08T20:47:58-07:00
by GeeMack
GarbageSauce wrote:Renders with the G clipped off. Removing the -gravity center argument does fix the problem although the text gets moved a tad. Is there a way to fix this?
Using IM 7.0.3-9 on Windows 10, I get the same result, the clipped off "G", using any monospace font. I tried some very common Windows fonts like Consolas and Courier-New, and a couple less common monospace fonts I use for numbering tickets, etc. I'd call this a bug, and it should probably be added to the
Bugs section of the forum.
Some fonts I use have particular glyphs that spill outside the bounding box, especially when using less common characters like "Å" or some symbols. As a workaround I often add a space and a newline before and after the text, then clean it down with "-trim", then re-add a specified border. It's clunky, but it does what I need. The command would look something like this...
Code: Select all
magick -background none -bordercolor none -fill black ^
-font Courier-New -size x90 label:"\n YOUR TEXT HERE! \n" -trim -border 5x5 output.png
But yes, your issue looks like a bug that should be repaired by the developers.
EDITED TO ADD: With some additional testing it looks like some of my proportional fonts also exhibit this issue. If you use
fmw42's suggestion and escape the exclamation points with a backslash "\!" it doesn't seem to cause that problem.
Re: Issue with rendering text with exclamation point at the end
Posted: 2016-12-08T21:05:23-07:00
by GarbageSauce
Thanks man. Your method seems to work. It does seem a bit scary since the only way to get the text to return to its original size is by increasing x90 to x410. Yikes. But thanks again. I'll report the bug.
EDIT: I didn't see the other posts. The thing with adding \n works great. I tried both "GO TIGERS^!" and "GO TIGERS"^! and both didn't work. The first one adds a star before the exclamation point (lol?) and the second just straight up doesn't work.
Re: Issue with rendering text with exclamation point at the end
Posted: 2016-12-08T21:12:45-07:00
by fmw42
^! is for Windows. You cannot use that on Unix. On Unix, you need to use \!
Using \! on my Mac with your font worked fine. No cut off or loss of characters.
Code: Select all
im7 magick -background none -fill "#000000" -font /library/fonts/BW-penn.ttf -size x90 -gravity center label:"GO TIGERS\!" asdf.png
Also on unix, hex colors need quoting
Re: Issue with rendering text with exclamation point at the end
Posted: 2016-12-08T21:14:08-07:00
by GarbageSauce
I am using Windows.
Re: Issue with rendering text with exclamation point at the end
Posted: 2016-12-08T21:16:38-07:00
by fmw42
Windows needs \ for directories, does it not? Unless you are using cygwin. If you are then you need unix escapes \!
H:/python27/fonts/BW-penn.ttt should be? H:\python27\fonts/BW-penn.ttf
Re: Issue with rendering text with exclamation point at the end
Posted: 2016-12-08T21:21:06-07:00
by GarbageSauce
I tried all 4 combinations of forward slash, backward slash, inside quotes, and outside quotes. Still nothing.
Re: Issue with rendering text with exclamation point at the end
Posted: 2016-12-08T21:24:41-07:00
by fmw42
I am not a Windows user, so do not know Windows syntax well. But what is your IM version and Windows version and are you using cygwin or not?
Re: Issue with rendering text with exclamation point at the end
Posted: 2016-12-08T21:24:57-07:00
by GeeMack
fmw42 wrote:^! is for Windows. You cannot use that on Unix. On Unix, you need to use \!
*** Edited to delete an incorrect comment.
Re: Issue with rendering text with exclamation point at the end
Posted: 2016-12-08T21:25:46-07:00
by fmw42
What misalignment issue?
Re: Issue with rendering text with exclamation point at the end
Posted: 2016-12-08T21:29:01-07:00
by GeeMack
fmw42 wrote:What misalignment issue?
The OP's issue with the first character in a label getting clipped if the gravity is set to center. Even more experiments show me that the gravity setting is the issue. If I get a few minutes I'll try to post some samples of the results.
Re: Issue with rendering text with exclamation point at the end
Posted: 2016-12-08T21:31:37-07:00
by fmw42
If so, then report it on the bugs forum. Be sure it is not bad font glyphs for that particular font glyph set. Not all fonts with the same name have equally defined glyphs.
Re: Issue with rendering text with exclamation point at the end
Posted: 2016-12-09T07:42:40-07:00
by GarbageSauce
I am using ImageMagick-7.0.3-9-Q16-x64-static.exe and no cygwin.
Re: Issue with rendering text with exclamation point at the end
Posted: 2016-12-09T10:58:49-07:00
by fmw42
If this does not work, then you will need a Windows user to correct my syntax.
Code: Select all
magick -background none -fill #000000 -font H:\python27\fonts\BW-penn.ttf -size x90 -gravity center label:"GO TIGERS^!" asdf.png