表情符号的正确显示方式是什么?

发布于 2024-07-06 07:22:29 字数 616 浏览 6 评论 0原文

在您自己的应用程序中。

[编辑]

好吧,所以我完全同意——比你知道的还要多——毫不含糊地认为图形表情符号是令人厌恶的。 但! 当项目所有者告诉我我们必须支持图形表情符号时,这对我没有帮助。

[/edit]

这个问题比最初看起来更复杂,特别是当你考虑到编辑、自动换行、可变宽度时字体和颜色表情符号。

所以我的问题实际上是针对那些做过这件事的人,你们是否想出了一种令人满意的方式来呈现表情符号,而不仅仅是一次大规模的黑客攻击?

开始讨论:

在两个实现中,我已经尝试了以下方法。

在 3D 应用程序中,文本行渲染为“纹理”; 我用图像替换了表情符号字符串,匹配文本渲染的类型,因此表情符号变成了文本的另一个元素。

本质上,文本渲染引擎必须进行最深层次的修改。 这产生了良好的结果,但非常耗时,并且很难正确(或者至少对我来说无论如何;P)

在第二种方法(使用不同的语言和平台)中,我决定尝试更高级别的“假”通过用单个字符替换表情符号字符串并在替换的字符上绘制情感。 这当然有很多限制,但优点是实施起来相当快,并且无需付出过多的努力就可以达到相当稳定的状态。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

旧人哭 2024-07-13 07:22:29
  1. 创建新字体。 这留给读者作为练习
  2. 字符串转换为字符集
    你的新字体。
  3. 绘制:
  • 重复调用操作环境函数来计算文本度量 - 定位表情符号的位置。
  • 在文本之前(如果您使用字体来增强背景图像 - 比如说一张脸,使用字体字形在脸上绘制黑色)或在文本之后绘制表情符号(在这种情况下,每个表情符号的字形为没有实际意义,只有字形的大小很重要)。
    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).
  • 迷离° 2024-07-13 07:22:29

    建议您考虑不转换表情符号是一个可以接受的答案吗? 文本表情符号的全部要点是它们可以以文本形式被识别。

    [编辑]请不要让这个意见/建议阻止任何人帮助回答这个问题。 有时你无法与客户对抗,尽管可能值得多尝试几次。

    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.

    中性美 2024-07-13 07:22:29

    这里有一个想法:不要以任何方式转换它们,而是旋转 90 度。

    例如,您可以渲染表情符号的图像,然后将该图像顺时针旋转 90 度并显示。

    Here's an idea: don't convert them in any way, but rotate by 90 degrees.

    For example, you can render the image of the emoticon and then rotate that image 90 degrees clockwise and display it.

    ~没有更多了~
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文