Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the right way to display emoticons?

In your own application that is.

[edit]

Alright, so I agree completely -- more than you know -- without equivocation that graphical emoticons are an abomination. But! That doesn't help me when the project owners tell me that we must support graphical emoticons.

[/edit]

The problem more complex than it would initially seem, especially when you take into account editing, word wrapping, variable width fonts, and color emoticons.

So my question is really to people who have done this, have you come up with a satisfactory way of rendering emoticons that isn't just one massive hack?

To start the discussion:

In two implementations I've tried the following approaches.

In a 3D application where lines of text where rendered to "textures"; I replaced emoticon strings with images, matching the type of the text renders, so the emoticon becomes just another element of the text.

Essentially the text rendering engine had to be modified at the deepest levels. This produces good results, but is very time consuming, and very hard to get right (Or at least for me anyway ;P)

In the second approach (With a different language and platform) I decided to try a higher-level "fake" by replacing emoticon strings with a single character and drawing emotions over the replaced character. This of course has lots of limitations, but has the benefit of being fairly fast to implement, and it's possible to reach a reasonably stable state without an excess of effort.

like image 937
Aaron H. Avatar asked Dec 22 '22 14:12

Aaron H.


2 Answers

  1. Create a new font. This is left as an exercise for the reader
  2. Transcode your strings into the character set of your new font.
  3. Draw:
  • Make repeated calls operating environment function to calculate Text Metrics - to locate the position of your emoticons.
  • Draw the emoticons before the text (if you're using the font to enhance whatever background image is - say a face, with the font glyphs drawing the black on the face) or after the text (in which case the glyph for each emoticon is moot, and only the size of the glyphs is important).
  • like image 152
    Josh Avatar answered Dec 31 '22 09:12

    Josh


    Is it an acceptable answer to suggest you should consider not converting emoticons? The entire point of textual emoticons is that they're recognizable...in text form.

    [edit] Please don't let this opinion/suggestion dissuade anyone from helping answer this question. Sometimes you can't fight the clients, though it may be worth a couple more attempts.

    like image 45
    Dave Rutledge Avatar answered Dec 31 '22 10:12

    Dave Rutledge