@@ -25,17 +25,8 @@ Details
2525 - [ Returns] ( #returns-3 )
2626 - [ 3. Multi-Line Support] ( #3-multi-line-support )
2727 - [ Example:] ( #example )
28- - [ CJK TextBakerProMax] ( #cjk-textbakerpromax )
29- - [ Why Use This Tool?] ( #why-use-this-tool )
30- - [ Atlas Settings] ( #atlas-settings )
31- - [ Why 100 Points and 10% Padding?] ( #why-100-points-and-10-padding )
32- - [ Options] ( #options )
33- - [ Language Options] ( #language-options )
34- - [ CJK Options] ( #cjk-options )
35- - [ Detailed Options and Usage] ( #detailed-options-and-usage )
36- - [ ** Korean** ] ( #korean )
37- - [ ** Japanese** ] ( #japanese )
38- - [ ** CJK Options** ] ( #cjk-options-1 )
28+ - [ Example Usage] ( #example-usage )
29+ - [ Standard TMP_Text Example] ( #standard-tmp_text-example )
3930 - [ RubyTextMeshPro Example] ( #rubytextmeshpro-example )
4031- [ Contributing] ( #contributing )
4132 - [ Requesting New Features] ( #requesting-new-features )
@@ -46,10 +37,10 @@ Details
4637## How to Install
4738
48391 . Open package manager from ** Unity Editor**
49- - ` Widnow ` -> ` Package Manager ` -> ` + ` button on top left -> ` Add package from git URL `
40+ - ` Widnow ` -> ` Package Manager ` -> ` + ` button on top left -> ` Add package from git URL `
50412 . Copy paste this url
51- - ``` https://github.com/kwan3854/TextMeshProMax.git ```
52- - If you need specific version, you can specify like this ``` https://github.com/kwan3854/TextMeshProMax.git#v0.2.0 ```
42+ - ``` https://github.com/kwan3854/TextMeshProMax.git ```
43+ - If you need specific version, you can specify like this ``` https://github.com/kwan3854/TextMeshProMax.git#v0.2.0 ```
5344
5445> [ !TIP]
5546> You can see inline comments in the code editor by enabling this option in the Unity Editor: ` Edit ` -> ` Preferences ` -> ` External Tools ` -> ` Generate .csproj files `
@@ -169,6 +160,41 @@ If the target string is `"Hello very long text that wraps!"`, the result will in
169160- One for ` "Hello very long" `
170161- One for ` "text that wraps!" `
171162
163+ ------
164+
165+ ## Example Usage
166+
167+ ### Standard TMP_Text Example
168+
169+ ``` csharp
170+ using Runtime .Helper ;
171+ using TMPro ;
172+ using UnityEngine ;
173+
174+ public class TMPExample : MonoBehaviour
175+ {
176+ private TMP_Text _text ;
177+
178+ void Start ()
179+ {
180+ // Initialize TMP_Text
181+ _text = GetComponent <TMP_Text >();
182+ _text .text = " Hello World\n Hello Universe" ;
183+
184+ // Retrieve Rect information for all occurrences of "Hello"
185+ var rects = _text .GetStringRects (" Hello" , TextFindMode .All );
186+
187+ foreach (var rectInfo in rects )
188+ {
189+ foreach (var rect in rectInfo .Rects )
190+ {
191+ Debug .Log ($" BottomLeft: {rect .min }, TopRight: {rect .max }, String: {rectInfo .TargetString }" );
192+ }
193+ }
194+ }
195+ }
196+ ```
197+
172198``` csharp
173199// Works on any tmp: TMP_Text, TextMeshPro, TextMeshProUGUI
174200TMP_Text text ;
@@ -179,6 +205,68 @@ text.text = "Hello World\nHello Universe";
179205var rects = text .GetStringRects (rubyString , TextFindMode .All );
180206```
181207
208+
209+
210+ ------
211+
212+ ### RubyTextMeshPro Example
213+
214+ > [ !NOTE]
215+ > Requires [ RubyTextMeshPro] ( https://github.com/jp-netsis/RubyTextMeshPro )
216+
217+ > [ !TIP]
218+ > RubyText-specific features require the ** RubyTextMeshPro** package, while all other features of this library work independently of whether RubyTextMeshPro is installed.
219+
220+ ``` csharp
221+ using Runtime .Helper ;
222+ using TMPro ;
223+ using UnityEngine ;
224+
225+ public class RubyTMPExample : MonoBehaviour
226+ {
227+ private RubyTextMeshProUGUI _text ;
228+
229+ void Start ()
230+ {
231+ // Initialize RubyTextMeshProUGUI
232+ _text = GetComponent <RubyTextMeshProUGUI >();
233+ _text .uneditedText = " <r=domo>Hello</r> <r=sekai>World</r> This is normal text!" ;
234+
235+ // Parse RubyTextMeshPro's plain text
236+ Debug .Log ($" PlainText: {_text .GetParsedText ()}" );
237+
238+ // Create RubyString
239+ var rubyString = new RubyString (new List <RubyElement >
240+ {
241+ new RubyElement (" Hello" , " domo" ),
242+ new RubyElement (" " ), // Space
243+ new RubyElement (" World" , " sekai" ),
244+ new RubyElement (" This is normal text!" ) // Plain text
245+ });
246+
247+ // Retrieve Rect information
248+ var rects = _text .GetRubyStringRects (rubyString , TextFindMode .All );
249+
250+ foreach (var rectInfo in rects )
251+ {
252+ foreach (var rect in rectInfo .Rects )
253+ {
254+ Debug .Log ($" BottomLeft: {rect .min }, TopRight: {rect .max }, String: {rectInfo .TargetString }" );
255+ }
256+ }
257+ }
258+ }
259+ ```
260+
261+ ``` csharp
262+ // Works on both RubyTextMeshPro(3D text) and RubyTextMeshProUGUI(2D UI text)
263+ RubyTextMeshProUGUI text ;
264+ RubyTextMeshPro text ;
265+
266+ text .uneditedText = " <r=domo>Hello</r> <r=sekai>World</r> This is normal text!" ;
267+ var rects = text .GetRubyStringRects (rubyString , TextFindMode .All );
268+ ```
269+
182270------
183271
184272## CJK TextBakerProMax
@@ -221,167 +309,105 @@ These options are shared across all three languages. They cover additional chara
221309
222310#### ** Korean**
2233111 . ** KS-1001 (B0A0-C8FF)**
224- - ** Description** :
225- KS X 1001 is the South Korean character encoding standard. It includes 2,350 commonly used Hangul syllables, Hanja, and symbols.
226- [ Learn more about KS X 1001] ( https://en.wikipedia.org/wiki/KS_X_1001 )
227- - ** When to Enable** :
228- Use this option if your project targets South Korean audiences and focuses on frequently used characters (e.g., educational apps, simple interfaces).
312+ - ** Description** :
313+ KS X 1001 is the South Korean character encoding standard. It includes 2,350 commonly used Hangul syllables, Hanja, and symbols.
314+ [ Learn more about KS X 1001] ( https://en.wikipedia.org/wiki/KS_X_1001 )
315+ - ** When to Enable** :
316+ Use this option if your project targets South Korean audiences and focuses on frequently used characters (e.g., educational apps, simple interfaces).
229317
2303182 . ** Full Hangul (AC00-D7A3)**
231- - ** Description** :
232- This range includes all 11,172 possible Hangul syllables, covering every valid combination of Korean Jamo.
233- - ** When to Enable** :
234- Use for applications that involve extensive Korean text or unpredictable user input, such as chat apps or text-heavy games.
319+ - ** Description** :
320+ This range includes all 11,172 possible Hangul syllables, covering every valid combination of Korean Jamo.
321+ - ** When to Enable** :
322+ Use for applications that involve extensive Korean text or unpredictable user input, such as chat apps or text-heavy games.
235323
2363243 . ** Hangul Jamo (1100-11FF)**
237- - ** Description** :
238- Includes the individual components (consonants and vowels) used to form Hangul syllables.
239- - ** When to Enable** :
240- Choose this if your project involves advanced Korean typography or phonetic analysis, where Jamo might be displayed independently.
325+ - ** Description** :
326+ Includes the individual components (consonants and vowels) used to form Hangul syllables.
327+ - ** When to Enable** :
328+ Choose this if your project involves advanced Korean typography or phonetic analysis, where Jamo might be displayed independently.
241329
2423304 . ** Hangul Compatibility Jamo (3130-318F)**
243- - ** Description** :
244- Contains pre-composed Hangul Jamo blocks for backward compatibility.
245- - ** When to Enable** :
246- Use only if your application needs to support legacy Korean text encoding.
331+ - ** Description** :
332+ Contains pre-composed Hangul Jamo blocks for backward compatibility.
333+ - ** When to Enable** :
334+ Use only if your application needs to support legacy Korean text encoding.
247335
2483365 . ** Hangul Jamo Extended-A (A960-A97F)**
249- - ** Description** :
250- Additional Jamo blocks introduced in Unicode 5.2.
251- - ** When to Enable** :
252- Enable for specialized linguistic tools or projects requiring modern Korean typographic features.
337+ - ** Description** :
338+ Additional Jamo blocks introduced in Unicode 5.2.
339+ - ** When to Enable** :
340+ Enable for specialized linguistic tools or projects requiring modern Korean typographic features.
253341
2543426 . ** Hangul Jamo Extended-B (D7B0-D7FF)**
255- - ** Description** :
256- A further extension of Hangul Jamo for rare or historic Korean text.
257- - ** When to Enable** :
258- Enable only if you are working on historic Korean text or rare linguistic projects.
343+ - ** Description** :
344+ A further extension of Hangul Jamo for rare or historic Korean text.
345+ - ** When to Enable** :
346+ Enable only if you are working on historic Korean text or rare linguistic projects.
259347
260348---
261349
262350#### ** Japanese**
2633511 . ** Hiragana (3040-309F)**
264- - ** Description** :
265- The basic phonetic script used in Japanese. Includes 83 characters.
266- [ Learn more about Hiragana] ( https://en.wikipedia.org/wiki/Hiragana )
267- - ** When to Enable** :
268- Use for any Japanese text rendering, as Hiragana is fundamental to the language.
352+ - ** Description** :
353+ The basic phonetic script used in Japanese. Includes 83 characters.
354+ [ Learn more about Hiragana] ( https://en.wikipedia.org/wiki/Hiragana )
355+ - ** When to Enable** :
356+ Use for any Japanese text rendering, as Hiragana is fundamental to the language.
269357
2703582 . ** Katakana (30A0-30FF)**
271- - ** Description** :
272- The second phonetic script in Japanese, used for foreign words and emphasis. Includes 96 characters.
273- [ Learn more about Katakana] ( https://en.wikipedia.org/wiki/Katakana )
274- - ** When to Enable** :
275- Essential for Japanese text, especially in games or apps with foreign word integration or stylized text.
359+ - ** Description** :
360+ The second phonetic script in Japanese, used for foreign words and emphasis. Includes 96 characters.
361+ [ Learn more about Katakana] ( https://en.wikipedia.org/wiki/Katakana )
362+ - ** When to Enable** :
363+ Essential for Japanese text, especially in games or apps with foreign word integration or stylized text.
276364
2773653 . ** Katakana Phonetic Extensions (31F0-31FF)**
278- - ** Description** :
279- Extensions to Katakana, mainly for Ainu language support.
280- - ** When to Enable** :
281- Use for projects involving Ainu language support or specialized Japanese typographic needs.
366+ - ** Description** :
367+ Extensions to Katakana, mainly for Ainu language support.
368+ - ** When to Enable** :
369+ Use for projects involving Ainu language support or specialized Japanese typographic needs.
282370
283371---
284372
285373#### ** CJK Options**
2863741 . ** CJK Unified Ideographs (4E00-9FBF)**
287- - ** Description** :
288- The core block of 20,976 Chinese, Japanese, and Korean ideographs.
289- [ Learn more about CJK Unified Ideographs] ( https://en.wikipedia.org/wiki/CJK_Unified_Ideographs )
290- - ** When to Enable** :
291- Use this for general-purpose support of Chinese, Japanese, or Korean text. Essential for any CJK-focused application.
375+ - ** Description** :
376+ The core block of 20,976 Chinese, Japanese, and Korean ideographs.
377+ [ Learn more about CJK Unified Ideographs] ( https://en.wikipedia.org/wiki/CJK_Unified_Ideographs )
378+ - ** When to Enable** :
379+ Use this for general-purpose support of Chinese, Japanese, or Korean text. Essential for any CJK-focused application.
292380
2933812 . ** CJK Unified Ideographs Extension B (20000-2A6DF)**
294- - ** Description** :
295- Includes 42,711 additional ideographs.
296- [ Learn more about Extension B] ( https://en.wikipedia.org/wiki/CJK_Unified_Ideographs_Extension_B )
297- - ** When to Enable** :
298- Use for scholarly or historic texts requiring rare or ancient characters.
382+ - ** Description** :
383+ Includes 42,711 additional ideographs.
384+ [ Learn more about Extension B] ( https://en.wikipedia.org/wiki/CJK_Unified_Ideographs_Extension_B )
385+ - ** When to Enable** :
386+ Use for scholarly or historic texts requiring rare or ancient characters.
299387
3003883 . ** CJK Compatibility Ideographs (F900-FAFF)**
301- - ** Description** :
302- A set of characters for compatibility with legacy encodings.
303- [ Learn more about CJK Compatibility Ideographs] ( https://en.wikipedia.org/wiki/CJK_Compatibility_Ideographs )
304- - ** When to Enable** :
305- Use only for backward compatibility or applications handling legacy text files.
389+ - ** Description** :
390+ A set of characters for compatibility with legacy encodings.
391+ [ Learn more about CJK Compatibility Ideographs] ( https://en.wikipedia.org/wiki/CJK_Compatibility_Ideographs )
392+ - ** When to Enable** :
393+ Use only for backward compatibility or applications handling legacy text files.
306394
3073954 . ** CJK Compatibility Ideographs Supplement (2F800-2FA1F)**
308- - ** Description** :
309- Supplements the compatibility ideographs for specialized needs.
310- [ Learn more about the Supplement] ( https://en.wikipedia.org/wiki/CJK_Compatibility_Ideographs_Supplement )
311- - ** When to Enable** :
312- Enable for rare cases involving historic or specialized text processing.
396+ - ** Description** :
397+ Supplements the compatibility ideographs for specialized needs.
398+ [ Learn more about the Supplement] ( https://en.wikipedia.org/wiki/CJK_Compatibility_Ideographs_Supplement )
399+ - ** When to Enable** :
400+ Enable for rare cases involving historic or specialized text processing.
313401
3144025 . ** CJK Radicals Supplement (2E80-2EFF)**
315- - ** Description** :
316- Contains radicals used in East Asian scripts for dictionaries or indexing.
317- [ Learn more about CJK Radicals Supplement] ( https://en.wikipedia.org/wiki/CJK_Radicals_Supplement )
318- - ** When to Enable** :
319- Use for dictionary applications or tools involving radical-based text analysis.
403+ - ** Description** :
404+ Contains radicals used in East Asian scripts for dictionaries or indexing.
405+ [ Learn more about CJK Radicals Supplement] ( https://en.wikipedia.org/wiki/CJK_Radicals_Supplement )
406+ - ** When to Enable** :
407+ Use for dictionary applications or tools involving radical-based text analysis.
320408
321409---
322410
323- ------
324-
325- ### RubyTextMeshPro Example
326-
327- > [ !NOTE]
328- > Requires [ RubyTextMeshPro] ( https://github.com/jp-netsis/RubyTextMeshPro )
329-
330- > [ !TIP]
331- > RubyText-specific features require the ** RubyTextMeshPro** package, while all other features of this library work independently of whether RubyTextMeshPro is installed.
332-
333- ``` csharp
334- using Runtime .Helper ;
335- using TMPro ;
336- using UnityEngine ;
337-
338- public class RubyTMPExample : MonoBehaviour
339- {
340- private RubyTextMeshProUGUI _text ;
341-
342- void Start ()
343- {
344- // Initialize RubyTextMeshProUGUI
345- _text = GetComponent <RubyTextMeshProUGUI >();
346- _text .uneditedText = " <r=domo>Hello</r> <r=sekai>World</r> This is normal text!" ;
347-
348- // Parse RubyTextMeshPro's plain text
349- Debug .Log ($" PlainText: {_text .GetParsedText ()}" );
350-
351- // Create RubyString
352- var rubyString = new RubyString (new List <RubyElement >
353- {
354- new RubyElement (" Hello" , " domo" ),
355- new RubyElement (" " ), // Space
356- new RubyElement (" World" , " sekai" ),
357- new RubyElement (" This is normal text!" ) // Plain text
358- });
359-
360- // Retrieve Rect information
361- var rects = _text .GetRubyStringRects (rubyString , TextFindMode .All );
362-
363- foreach (var rectInfo in rects )
364- {
365- foreach (var rect in rectInfo .Rects )
366- {
367- Debug .Log ($" BottomLeft: {rect .min }, TopRight: {rect .max }, String: {rectInfo .TargetString }" );
368- }
369- }
370- }
371- }
372- ```
373-
374- ``` csharp
375- // Works on both RubyTextMeshPro(3D text) and RubyTextMeshProUGUI(2D UI text)
376- RubyTextMeshProUGUI text ;
377- RubyTextMeshPro text ;
378-
379- text .uneditedText = " <r=domo>Hello</r> <r=sekai>World</r> This is normal text!" ;
380- var rects = text .GetRubyStringRects (rubyString , TextFindMode .All );
381- ```
382-
383- ------
384-
385411## Contributing
386412
387413We welcome contributions to this project. If you have ideas for new features or improvements, feel free to open an issue or submit a pull request.
0 commit comments