redbluegames / unity-text-typer

Text typing effect for Unity uGUI Text components
MIT License
307 stars 28 forks source link

problem with UTF-32 characters, like: ๐Ÿ€ or ๐Ÿ’• #19

Open fpv999 opened 5 years ago

fpv999 commented 5 years ago

those UTF-32 characters ( like U+1F340) are stored in 4-bytes sequences, starting with 0xD8xx ... thus in one moment Unity Text components receives only a first-half of the UTF-32 character, which leads to crash like this:

ArgumentException: invalid utf-16 sequence at -1819518832 (missing surrogate tail) Parameter name: string

UnityEngine.TextGenerator.Populate_Internal (System.String str, UnityEngine.Font font, Color color, Int32 fontSize, Single scaleFactor, Single lineSpacing, FontStyle style, Boolean richText, Boolean resizeTextForBestFit, Int32 resizeTextMinSize, Int32 resizeTextMaxSize, Int32 verticalOverFlow, Int32 horizontalOverflow, Boolean updateBounds, TextAnchor anchor, Single extentsX, Single extentsY, Single pivotX, Single pivotY, Boolean generateOutOfBounds, Boolean alignByGeometry, System.UInt32& error) UnityEngine.TextGenerator.Populate_Internal (System.String str, UnityEngine.Font font, Color color, Int32 fontSize, Single scaleFactor, Single lineSpacing, FontStyle style, Boolean richText, Boolean resizeTextForBestFit, Int32 resizeTextMinSize, Int32 resizeTextMaxSize, VerticalWrapMode verticalOverFlow, HorizontalWrapMode horizontalOverflow, Boolean updateBounds, TextAnchor anchor, Vector2 extents, Vector2 pivot, Boolean generateOutOfBounds, Boolean alignByGeometry, UnityEngine.TextGenerationError& error) UnityEngine.TextGenerator.PopulateAlways (System.String str, TextGenerationSettings settings) UnityEngine.TextGenerator.PopulateWithError (System.String str, TextGenerationSettings settings) UnityEngine.TextGenerator.Populate (System.String str, TextGenerationSettings settings) UnityEngine.TextGenerator.GetPreferredWidth (System.String str, TextGenerationSettings settings) UnityEngine.UI.Text.get_preferredWidth () UnityEngine.UI.LayoutUtility.m2 (ILayoutElement e) UnityEngine.UI.LayoutUtility.GetLayoutProperty (UnityEngine.RectTransform rect, System.Func2 property, Single defaultValue, ILayoutElement& source) UnityEngine.UI.LayoutUtility.GetLayoutProperty (UnityEngine.RectTransform rect, System.Func2 property, Single defaultValue) UnityEngine.UI.LayoutUtility.GetPreferredWidth (UnityEngine.RectTransform rect) UnityEngine.UI.LayoutUtility.GetPreferredSize (UnityEngine.RectTransform rect, Int32 axis) UnityEngine.UI.HorizontalOrVerticalLayoutGroup.GetChildSizes (UnityEngine.RectTransform child, Int32 axis, Boolean controlSize, Boolean childForceExpand, System.Single& min, System.Single& preferred, System.Single& flexible) UnityEngine.UI.HorizontalOrVerticalLayoutGroup.CalcAlongAxis (Int32 axis, Boolean isVertical) UnityEngine.UI.VerticalLayoutGroup.CalculateLayoutInputHorizontal () UnityEngine.UI.LayoutRebuilder.m2 (UnityEngine.Component e) UnityEngine.UI.LayoutRebuilder.PerformLayoutCalculation (UnityEngine.RectTransform rect, UnityEngine.Events.UnityAction`1 action) UnityEngine.UI.LayoutRebuilder.Rebuild (CanvasUpdate executing) UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () UnityEngine.Canvas:SendWillRenderCanvases()

edwardrowe commented 5 years ago

Thanks for the issue report! Unfortunately we are just maxed out with how many projects we can support actively. I do hope to get back to TextTyper in the next few months, at which time I'll add more improvements and bugfixes. But right now I'm not gonna be able to look into this.

On Sun, Feb 24, 2019 at 9:56 AM fpv999 notifications@github.com wrote:

those UTF-32 characters ( like U+1F340) are stored in 4-bytes sequences, starting with 0xD8xx ... thus in one moment Unity Text components receives only a first-half of the UTF-32 character, which leads to crash like this:

ArgumentException: invalid utf-16 sequence at -1819518832 (missing surrogate tail) Parameter name: string

UnityEngine.TextGenerator.Populate_Internal (System.String str, UnityEngine.Font font, Color color, Int32 fontSize, Single scaleFactor, Single lineSpacing, FontStyle style, Boolean richText, Boolean resizeTextForBestFit, Int32 resizeTextMinSize, Int32 resizeTextMaxSize, Int32 verticalOverFlow, Int32 horizontalOverflow, Boolean updateBounds, TextAnchor anchor, Single extentsX, Single extentsY, Single pivotX, Single pivotY, Boolean generateOutOfBounds, Boolean alignByGeometry, System.UInt32& error) UnityEngine.TextGenerator.Populate_Internal (System.String str, UnityEngine.Font font, Color color, Int32 fontSize, Single scaleFactor, Single lineSpacing, FontStyle style, Boolean richText, Boolean resizeTextForBestFit, Int32 resizeTextMinSize, Int32 resizeTextMaxSize, VerticalWrapMode verticalOverFlow, HorizontalWrapMode horizontalOverflow, Boolean updateBounds, TextAnchor anchor, Vector2 extents, Vector2 pivot, Boolean generateOutOfBounds, Boolean alignByGeometry, UnityEngine.TextGenerationError& error) UnityEngine.TextGenerator.PopulateAlways (System.String str, TextGenerationSettings settings) UnityEngine.TextGenerator.PopulateWithError (System.String str, TextGenerationSettings settings) UnityEngine.TextGenerator.Populate (System.String str, TextGenerationSettings settings) UnityEngine.TextGenerator.GetPreferredWidth (System.String str, TextGenerationSettings settings) UnityEngine.UI.Text.get_preferredWidth () UnityEngine.UI.LayoutUtility.m2 (ILayoutElement e) UnityEngine.UI.LayoutUtility.GetLayoutProperty (UnityEngine.RectTransform rect, System.Func2 property, Single defaultValue, ILayoutElement& source) UnityEngine.UI.LayoutUtility.GetLayoutProperty (UnityEngine.RectTransform rect, System.Func2 property, Single defaultValue) UnityEngine.UI.LayoutUtility.GetPreferredWidth (UnityEngine.RectTransform rect) UnityEngine.UI.LayoutUtility.GetPreferredSize (UnityEngine.RectTransform rect, Int32 axis) UnityEngine.UI.HorizontalOrVerticalLayoutGroup.GetChildSizes (UnityEngine.RectTransform child, Int32 axis, Boolean controlSize, Boolean childForceExpand, System.Single& min, System.Single& preferred, System.Single& flexible) UnityEngine.UI.HorizontalOrVerticalLayoutGroup.CalcAlongAxis (Int32 axis, Boolean isVertical) UnityEngine.UI.VerticalLayoutGroup.CalculateLayoutInputHorizontal () UnityEngine.UI.LayoutRebuilder.m2 (UnityEngine.Component e) UnityEngine.UI.LayoutRebuilder.PerformLayoutCalculation (UnityEngine.RectTransform rect, UnityEngine.Events.UnityAction`1 action) UnityEngine.UI.LayoutRebuilder.Rebuild (CanvasUpdate executing) UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () UnityEngine.Canvas:SendWillRenderCanvases()

โ€” You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/redbluegames/unity-text-typer/issues/19, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYUKRgYOShx58pd_IcZnvkyRU9hTVn3ks5vQqgagaJpZM4bOk1x .