I'm trying to use imagemagick to generate some images of Kannada text. The problem is that complex characters are being rendered separately (not together as they should be... imagine that "ku" should be one character, but it is rendered first as "k-" and then as "-u")
Concretely, ಗ್ರಾಮ ಕೋಡ್ gets rendered as this:
The command I am using is:
convert -background lightblue -fill blue -pointsize 48 -font '/Library/Fonts/Kannada Sangam MN.ttf' label:#Kannada_test.txt label_utf8.gif
On another program, TextEdit, the same font renders the text fine:
Any hints as to how I can get imagemagick to display these complex characters properly?
I’m afraid you can’t, because ImageMagick seems to be incapable of handling combining marks. That is, it cannot combine them with preceding characters to produce proper graphic presentation but render a spacing glyph for the mark.
Related
I'm trying to create a font using FontForge which is 'simply' the alphanumeric characters from Lato (original version) as well as the greek alphabet characters from Lato (extended version). I opened both fonts in FontForge and copied and pasted the greek letters over to the original version. I generated the font and displayed it in Google Chrome. But the characters that I've copied come out jagged / distorted. I've also tried opening the original font, then going to element and then merge fonts and selecting the extended version font and then generating a font from that but the same problem occurs.
The screenshot provided below shows the distortion going on. The top line shows how the letters should look. The bottom line shows how the letters actually look. Many of the letters - even the ones that were in the original (such as the 'a') - aren't displaying properly. The bottom and top of some characters has been flattened and for other characters, extended. Notice the top of the alpha, rho and epsilon are pointed and aren't smooth as they should be. The top of the beta has been flattened. Look at the top and bottom of the 'o' - both have been flattened as if to fit into a minimum allowable area.
If I zoom in a lot, the jagged edges become smooth again.
What can I do to fix this?
So apparently Overleaf now can render emojis using packages of Noto Color Emojis, where you can use {\NotoEmoji \symbol{"1F343} \symbol{"1F338} } to input an emoji with corresponding unicodes.
My question is how to input complex emojis that are composed of multiple emojis? For example, this one 👩👩👦👦, the unicode is U+1F469 U+200D U+1F469 U+200D U+1F466 U+200D U+1F466.
I've tried combinations like
\symbol{"1F469200d1f469200d...1f466}
\symbol{"1F469 200d 1f469 200d...1f466}
\symbol{"1F469} \symbol{"200d}...\symbol{"1f466}}
But none of them works.
You don't need to concatenate them. Here's the solution that I tried in Overleaf and it worked fine.
{\Large
\NotoEmoji
% family emoji
\symbol{"1F468}\symbol{"200D}\symbol{"1F469}\symbol{"200D}\symbol{"1F467}\symbol{"200D}\symbol{"1F466}
}
Expected Output
👨👩👧👦 Family: Man, Woman, Girl, Boy,
You can use the same trick for Emoji Skin Tone Modifiers in Overleaf where the modifier comes right after the emoji Unicode.
{\Large
\NotoEmoji
% Waving Hand emoji
\symbol{"1F44B}%
% Waving Hand: Light Skin Tone
\symbol{"1F44B}\symbol{"1F3FB}
}
Expected Output
👋
👋🏻
Here's the Overleaf Project page about Displaying Color Emojis in Latex that you can check out.
Updated 2020-11-28 : Adding emoji as an image in Latex
Since you mentioned adding emojis as images, I'm also including my solution for that.
\usepackage{tcolorbox}
% change font size here
\includegraphics[height=12]{family-man-woman-girl-boy.png}
The image can be downloaded from EmojiPedia.
A disability project I'm building (here for your interest). Uses a set of copyright-free icons. Here are some examples of them in use.
It's bothering us that all of the icons are of white people. We'd like to make them more diverse and representative.
The icons are pngs. Here's an example. I feel like there must be a command line way of replacing one colour with another. If I had that, then I could do a lot of things semi-automatically, but I have NO idea if such a thing is possible.
Is it?
You can replace a specific color with another using ImageMagick or GraphicsMaqick. In your screenshot, the "flesh" is color #FFEFC6. Use -fill newcolor -opaque oldcolor to replace this color with another (and use "-fuzz 10%" to replace all pixels whose color is "close" to oldcolor):
magick pdzSe.png -fill black -fuzz 10% -opaque "#FFEFC6" black.png
magick pdzSe.png -fill orange -fuzz 10% -opaque "#FFEFC6" orange.png
magick pdzSe.png -fill brown -fuzz 10% -opaque "#FFEFC6" brown.png
If you want to use GraphicsMagick, replace magick with gm convert, and if you want to use ImageMagick version 6, replace magick with convert. If you're running on Windows, you'll need to replace the % with %%.
This should be enough to get you started, but it's a crude solution that doesn't account for blended pixels such as those appearing in your sample "thumbs-up" icon. Below are the results of running the same commands against "thumbs-up", enlarged 4x so you can see the "halo" effect around the edges of the "flesh". Getting rid of the "halos" will require more work, specific to your icon set. Ideally you'd have the original vector art-work to update, but I suppose that's not the case.
In fact, the original artwork is available at straight-street.com (search for "good") and working with the original SVG files is much simpler; there is no "halo" issue. Here I just used a text editor to change the color FFEFC6 to FF8888:
I am not certain whether this is the right place to ask this, but I do not know of any other sites that would fit better. And the question has something to do with programming, so:
I Am Writing a formatted txt-guide. Please take a look at this excerpt: http://mad-gaksha.homelinux.net/public/width.txt. I need to have full-width characters displayed so that they occupy exactly twice the space as half-width characters. While monospaced fonts seems to work fine with only half-width chars, most fullwidth "fixed-width" fonts I've tried didn't produce the desired result.
In firefox, this works when I set the monospace font (Edit>Preferences>Content>Advanced)to "monospace". But only for a font-size of 14. Same thing with gedit, the fixed-width font MS-Gothic, works only for font sizes 13/14.
As I find this behaviour quite strange and wouldn't want my readers to be troubled by technical details, does anyone have suggestions or give any resources or could explain what's going on here? Why does it seem so hard just to display each glyph with a fixed size?
Thanks in advance for taking your time.
It looks like it's to do with rounding fractional pixels.
A font renderer may adjust horizontal positioning when the width of a glyph isn't a whole number of screen pixels. I believe the Cairo rendering used by gedit and Firefox on Linux doesn't do sub-pixel positioning for fonts so this may be necessary here.
In a true monospace font this doesn't matter because every glyph has the same width so receives the same treatment, but where there is a mixture of full- and half-width characters, the rounding won't be uniform unless the glyphs happen to be a whole number of pixels wide (which happens in your case at font size 14).
Note that on Windows for most small sizes, fonts like MS Gothic will be rendered using custom built-in bitmaps in the font file, instead of rendering the outlines and their metrics. This makes all glyphs necessarily a fixed number of pixels wide. However this does result in the typical old-school ‘jaggy’ rendering style.
If you are producing formatted-text files there is really nothing you can do about this. You can only hope that your target audience has Japanese monospaced fonts that are suitable and can switch to them at a particular font size.
I would agree with Clement's comment that using HTML to get the rendering you want would be more robust, modern and convenient. Using HTML for layout relieves you of having to worry about lining up characters, and allows you to get fonts that are less ugly than all that half-width-monospaced Latin.
I'm looking for a font which contains a graphic character which is (essentially), the space character, inverted. I'm looking for a graphic character equivalent to the largest-possible solid-black box. The closest I have been able to find is Wingings 2 character 162, but that doesn't fill the entire available character space. When I insert two consecutive Wingdings 2 162 characters, there is still appreciable whitespace between them when displayed or printed. Does anyone know of a black-box font/character which would fill all available character space?
All characters are going to have whitespace between them, or they would be unreadable. This is called "kerning". You can adjust the kerning and line-height in whatever program you are using to send the malicious fax, if you want to be sure to use the maximum amount of toner per page.
Have you considered creating your own font using a software package like this or like this? You could edit the space character to be a solid black square. But as Chris McCall mentioned, you may still have space between characters of any size due to kerning applied by the layout engine that draws the fonts.
You other option is to owner draw your own text and programmatically replacing spaces with black boxes. You would have complete control over kerning and everything else.
I don't know if this is exactly what you were looking for, but...
I was looking for the same thing, since I wanted to create a "textbox" when I wanted to write text using the spritefont, but I never knew how long the total string was going to be, so I wanted something that I could "write" in the same location right before the string with a contrasting color which could be expected to be as long as the string it needed to encompass. That being the case, try:
Webdings - character 103.
I tried lining them up and there wasn't even any space in between. Perfect.