mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-27 23:08:35 +01:00
Compare commits
2 commits
62ef75441a
...
23103613cd
Author | SHA1 | Date | |
---|---|---|---|
23103613cd | |||
0c5369e687 |
4 changed files with 12 additions and 1 deletions
|
@ -26,11 +26,13 @@ Improvements
|
||||||
- Stopped the text formatter throwing if a color can't be parsed
|
- Stopped the text formatter throwing if a color can't be parsed
|
||||||
- Improved text formatter tokenization performance
|
- Improved text formatter tokenization performance
|
||||||
- Allow using control and arrow keys to move the visible area of a text input
|
- Allow using control and arrow keys to move the visible area of a text input
|
||||||
|
- Allow formatting codes applied later to override settings of earlier ones
|
||||||
|
|
||||||
Fixes
|
Fixes
|
||||||
- Fixed TextInput not working correctly when using surrogate pairs
|
- Fixed TextInput not working correctly when using surrogate pairs
|
||||||
- Fixed InputHandler touch states being initialized incorrectly when touch handling is disabled
|
- Fixed InputHandler touch states being initialized incorrectly when touch handling is disabled
|
||||||
- Fixed empty NinePatch regions stalling when using tile mode
|
- Fixed empty NinePatch regions stalling when using tile mode
|
||||||
|
- Fixed bold and italic formatting code closing tags working on each other
|
||||||
|
|
||||||
### MLEM.Ui
|
### MLEM.Ui
|
||||||
Additions
|
Additions
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace Demos {
|
||||||
|
|
||||||
private const string Text =
|
private const string Text =
|
||||||
"MLEM's text formatting system allows for various <b>formatting codes</b> to be applied in the middle of a string. Here's a demonstration of some of them.\n\n" +
|
"MLEM's text formatting system allows for various <b>formatting codes</b> to be applied in the middle of a string. Here's a demonstration of some of them.\n\n" +
|
||||||
"You can write in <b>bold</i>, <i>italics</i>, <u>with an underline</u>, <st>strikethrough</st>, with a <s>drop shadow</s> whose <s #ff0000 4>color</s> and <s #000000 10>offset</s> you can modify in each application of the code, with an <o>outline</o> that you can also <o #ff0000 4>modify</o> <o #ff00ff 2>dynamically</o>, or with various types of <b>combined <c Pink>formatting</c> codes</b>.\n\n" +
|
"You can write in <b>bold</b>, <i>italics</i>, <u>with an underline</u>, <st>strikethrough</st>, with a <s>drop shadow</s> whose <s #ff0000 4>color</s> and <s #000000 10>offset</s> you can modify in each application of the code, with an <o>outline</o> that you can also <o #ff0000 4>modify</o> <o #ff00ff 2>dynamically</o>, or with various types of <b>combined <c Pink>formatting</c> codes</b>.\n\n" +
|
||||||
"You can apply <c CornflowerBlue>custom</c> <c Yellow>colors</c> to text, including all default <c Orange>MonoGame colors</c> and <c #aabb00>inline custom colors</c>.\n\n" +
|
"You can apply <c CornflowerBlue>custom</c> <c Yellow>colors</c> to text, including all default <c Orange>MonoGame colors</c> and <c #aabb00>inline custom colors</c>.\n\n" +
|
||||||
"You can also use animations like <a wobbly>a wobbly one</a>, as well as create custom ones using the <a wobbly>Code class</a>.\n\n" +
|
"You can also use animations like <a wobbly>a wobbly one</a>, as well as create custom ones using the <a wobbly>Code class</a>.\n\n" +
|
||||||
"You can also display <i grass> icons in your text, and use super<sup>script</sup> or sub<sub>script</sub> formatting!\n\n" +
|
"You can also display <i grass> icons in your text, and use super<sup>script</sup> or sub<sub>script</sub> formatting!\n\n" +
|
||||||
|
|
|
@ -18,5 +18,11 @@ namespace MLEM.Formatting.Codes {
|
||||||
return this.font?.Invoke(defaultPick);
|
return this.font?.Invoke(defaultPick);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool EndsHere(Code other) {
|
||||||
|
// turning a string bold/italic should only end when that specific code is ended using SimpleEndCode
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
@ -14,6 +15,7 @@ namespace MLEM.Formatting {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The formatting codes that are applied on this token.
|
/// The formatting codes that are applied on this token.
|
||||||
|
/// Codes are stored application order, with the first entry in the array being the code that was most recently applied.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly Code[] AppliedCodes;
|
public readonly Code[] AppliedCodes;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -45,6 +47,7 @@ namespace MLEM.Formatting {
|
||||||
internal float[] InnerOffsets;
|
internal float[] InnerOffsets;
|
||||||
|
|
||||||
internal Token(Code[] appliedCodes, int index, int rawIndex, string substring, string rawSubstring) {
|
internal Token(Code[] appliedCodes, int index, int rawIndex, string substring, string rawSubstring) {
|
||||||
|
Array.Reverse(appliedCodes);
|
||||||
this.AppliedCodes = appliedCodes;
|
this.AppliedCodes = appliedCodes;
|
||||||
this.Index = index;
|
this.Index = index;
|
||||||
this.RawIndex = rawIndex;
|
this.RawIndex = rawIndex;
|
||||||
|
|
Loading…
Reference in a new issue