Search Unity

Uneven letters in a text box

Discussion in 'UGUI & TextMesh Pro' started by LeRan, Jul 28, 2016.

  1. LeRan

    LeRan

    Joined:
    Nov 24, 2015
    Posts:
    118
    Hello forum, here's what's happening to me today...

    I've created a text box in my UI (typical Text (Script) on a Rect Transform). The font is Unity's default Arial, size 18, normal, line spacing 1, no material applied. Here is how it looks like (magnified 4 times with the Gimp, red lines added for emphasis).



    Notice how the O, T, E and S characters are lower, while the U, I, L and N are upper. I have no reason why this is happening, but it's rather ugly in a low res UI like the one I'm using. Anyone knows what's happening?
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    could you file a bug report with the project so we can take a look. Thanks
     
  3. LeRan

    LeRan

    Joined:
    Nov 24, 2015
    Posts:
    118
    All right, I was trying to strip my project of anything unnecessary to fill in a bug report, and I incidentaly found the origin of the problem (by not the solution though). Since I need a somewhat pixellated look, I switch all my text fields to FilterMode.Point with a dedicated script. Here is the script that I was using :

    Code (CSharp):
    1. [ExecuteInEditMode]
    2. public class ResolutionFonte : MonoBehaviour {
    3.  
    4.     public int résolutionInitiale;
    5.     public Vector2 dimensionsInitiales;
    6.  
    7.     void Awake () {
    8.         Text leTexte = this.GetComponent<Text> ();
    9.         leTexte.font.material.mainTexture.filterMode = FilterMode.Point;
    10.         résolutionInitiale=leTexte.fontSize;
    11.         dimensionsInitiales=leTexte.rectTransform.sizeDelta;
    12.     }
    13. }
    The line ending with FilterMode.Point is the one that causes the problem. See example below:
    - up, with Unity's default filtermomde (bilinear I think)
    - down, with FilterMode.Point. Notice the irregular letter vertical alignment.



    Is there a way to solve the problem or is it inherent to Unity's Arial font in Filtermode point?

    (note, I've also got a weird artifact on the right side af the frame that's distorted in game mode but straight in editor mode, I don't think it's related to the previous problem but who knows)
     
  4. LeRan

    LeRan

    Joined:
    Nov 24, 2015
    Posts:
    118
    @karl_jones Is this enough info, or do I still have to fill in a bug report? I fear I won't be able to say anything more than what is stated in the previous post...

    (note, the graphic artefact is not related to the text filter mode problem)
     
  5. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    Yes please just say this all again in a bug report. Otherwise you a relying on me not forgetting about it and getting around to it at some point....what was i doing again...:confused:
     
  6. iZenny

    iZenny

    Joined:
    Jun 26, 2017
    Posts:
    2
    For anyone else having this issue, I fixed this by setting the "root" canvas (The one holding absolutely everything) to "Pixel Perfect"