A significant challenge in global game development is rendering complex scripts – languages where characters change form based on their context within a word, not limited to some Right-to-Left (RTL) languages but also including others like Kannada. Unity, by default, struggles with these scripts due to the way it handles glyph tables in fonts. Let’s explore this challenge and the solutions that help overcome it.
The Challenge with Complex Script Rendering
The primary hurdle lies in Unity’s handling of glyph tables. Unity cannot replace the glyphs and letters of a font that include this table. For example if we write “ab” and this should be replaced by “c” based on the font table, Unity does not understand this and will not do the replacement. An example in persian language would be the word “سلام” where the letters “س” ,”ل” ,”ا” ,”م” are not the same when they are used in a word and therefore the system replaces them with another letter, which in Unity, is not the case.
Understanding Glyph Tables: Glyph tables in fonts map characters to their visual representations. They are essential for scripts where a character’s appearance can change based on its position in a word or surrounding characters.
Unity’s Limitation: Unity’s standard text rendering system isn’t fully equipped to interpret the glyph tables required for complex scripts. For instance, in languages like Kannada or Arabic, characters often connect differently depending on their placement. Unity, without additional support, cannot process these contextual changes, leading to incorrect rendering.
Solutions and Plugins
To address this, the Unity community and third-party developers have crafted plugins that enhance Unity’s ability to handle complex scripts.
Key Plugins and Extensions: These tools modify the text string, applying necessary transformations for correct character rendering.
Complex Script Support Plugins: These plugins preprocess text data to analyze and transform scripts, ensuring characters are reordered and shaped correctly before being rendered.
TextMeshPro Enhancements: TextMeshPro, a powerful text rendering solution in Unity, has been extended by the community to better support complex scripts, although it may require additional configuration or extensions.
How These Plugins Function
The plugins work by pre-processing the text. They analyze the complex script, apply contextual transformations (like character reordering and shaping), and then present the correctly formatted text to Unity’s rendering system. This ensures accurate on-screen representation.
Understanding and implementing support for complex scripts is crucial for truly global and inclusive game development. By utilizing these specialized plugins, developers can ensure their games are accessible and correctly presented to a diverse player base, respecting the intricacies of various world scripts.