within the current development sandbox, there exists no functionality to create unicode symbols or images to be embedded in strings of text.
it would make the most logical sense to turn to the utf8 library, which deals with unicode characters and even has its own private-use-area for application (Roblox) -specific characters.
unfortunately, the current utf8 library and other text-related roblox services (textservice, etc) do not have any functionality to create developer-defined characters.
Case 1: Counters and visual quantifiers
in its most simple form, “embedding” an image into text consists of appending an ImageLabel
to a TextLabel
, similar to this image below:
Case 2: Dynamically-set interfaces
(Gamepad accessibility, input displays, killfeeds)
for dynamically-set ui (or anything remotely complex), such as displaying platform-specific controls or kill-feeds in combat games, this becomes much more of a chore as unnecessary operations and instancing need to be performed to achieve something that would ideally be as simple as setting the .Text of a single TextLabel to:
"\u{E000}: Action"
for action/keybind displays
"Player0 \u{E000} Player1"
for kill-feeds
"\u{E000}" 99,999
for counters
wow! a lot easier than doing something akin to:
TextLabel.Text = "Action"
ImageLabel.Image = "rbxassetid://"
ImageLabel.Position = UDim2.fromOffset(TextLabel.TextBounds.X, 0)
...
Case 3: Language barriers
developer-defined unicode symbols would also open up a lot of avenues for player-to-player communication, where a unified, easily-recognizable symbol/icon/emoji would replace normal text, such as situations where players with different language backgrounds are trying to communicate:
Proof of concept
case #3, which stemmed from a reply from the linked release note, and is the acutal basis of this entire feature request, is the most feasible case to make a proof-of-concept for as provided below:
…it uses TextChatService
’s OnIncomingMessage
callback function to :gsub() the message text with a conversion table that most closely shows what developer-defined utf8 symbols can be used for in regard to cross-language communication:
Feature request
i propose a single function to be added to the utf8 library, which would cover all bases of this feature request:
utf8.new(imageId: string, rectSize: Vector2?, rectOffset: Vector2?): string
…which indexes imageId
in the unicode pua range, then returns string Codepoint
(something like "\u{E000}"
) to be stored/cached for developer usage in runtime
rectSize
and rectOffset
are for when imageId is passed as a spritesheet, for example:
…this behaves like ImageLabel.ImageRectSize/ImageRectOffset to reduce rbxasset:// bloat brought on by uploading/loading assets one-by-one
--src/Library/EmojiConsortium.luau
local imageId = "rbxasset://ilovecats.png" -- 2x2, 128x128 sprite sheet
local imageRes = Vector2.new(64, 64) -- resolution per-sprite
return {
cats_i = utf8.new(imageId, imageRes, Vector2.new(0, 0));
cats_love = utf8.new(imageId, imageRes, Vector2.new(1, 0));
cats_cats = utf8.new(imageId, imageRes, Vector2.new(0, 1));
cats_face = utf8.new(imageId, imageRes, Vector2.new(1, 1));
}
this is a revised, more concise & simple version of a previous post