Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Feature Request Support for text-shadow / font border?

Discussion in 'UI Toolkit' started by b4gn0, Feb 17, 2020.

  1. b4gn0

    b4gn0

    Joined:
    Jul 26, 2019
    Posts:
    85
    Hello,

    We are having troubles printing values on screen with UI Elements because we couldn't add text-shadows to labels.
    I tried manually setting the uss / element style with the text-shadow property, but it gets ignored.

    Is there a suggested way we can add a border to letters inside a label?

    Thank you
     
    RealMTG likes this.
  2. VOTRUBEC

    VOTRUBEC

    Joined:
    Dec 17, 2014
    Posts:
    70
    If I'm not mistaken, uGUI simply added a second item for the "shadow". You could do exactly the same by duplicating your element, with a given pixel offset?
     
  3. b4gn0

    b4gn0

    Joined:
    Jul 26, 2019
    Posts:
    85
    In order to create a believable shadow I need to duplicate it 8 times (once for each corner), like explained here: https://stackoverflow.com/a/8712442

    Doing so with a font instead of a shadow produces this effect (they are offsetted by 1px, can't do half pixels):
    upload_2020-2-17_14-47-59.png

    I don't know the performance of updating 9 labels each time the value changes, I will need to code the shadow creation and update.

    In TextMeshPro it's 1 simple checkbox :)
     
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,965
    UIElements currently has access to two text systems. The Legacy text system and TextCore which is the new text engine I have been working on which will provide even more functionality and eventually be used by TMP for parsing and layout of the text.

    Although an early version of TextCore is currently available in UIElements, there is no UI / method to define material properties such as Dilation, Outline, Shadow, etc. for text labels. This is something that we are still working on but will be coming.
     
    Ofx360 likes this.
  5. b4gn0

    b4gn0

    Joined:
    Jul 26, 2019
    Posts:
    85
    Is there a way to switch between them, just for testing sake?

    I'm thinking about making a custom component with 9 labels (1 center + 8 around shifted by 1px as shadow), do you think it might be a performance issue to render 30+ labels simultaneously?
     
  6. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,965
    Increasing the geometry count by 8x will definitely have an impact on performance both on the rendering side and processing side of the text as I don't think you can grab the underlying geometry in UIE and paste it around.

    Not at this time but once UIElements is available as a package, it will be easy to switch between the two text renderers. But just in case there is another shorter term way, I'll ask / check around.
     
  7. esi-jeremy

    esi-jeremy

    Joined:
    Jul 24, 2015
    Posts:
    1
    Any update on the progress of this feature? Are there any other solutions for outlined fonts in UI Elements/Toolkit?
    Is there anyway to use TMP inside a visual element?
     
  8. mrSaig

    mrSaig

    Joined:
    Jan 14, 2010
    Posts:
    48
    any updates yet? stumbled upon the missing outlines just now
     
    Last edited: Aug 9, 2020
  9. b4gn0

    b4gn0

    Joined:
    Jul 26, 2019
    Posts:
    85
    Next major version of UI Toolkit should have feature parity with text mesh pro.
    That should include outlining.
     
  10. mrSaig

    mrSaig

    Joined:
    Jan 14, 2010
    Posts:
    48
    nice thx! but there isnt a time schedule yet right? just asking!
     
  11. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    952
    We don't have exact release dates, no.
     
    mrSaig likes this.
unityunity