Search Unity

Font size and style overrides [SOLVED]

Discussion in '5.4 Beta' started by MrEsquire, Jul 15, 2016.

  1. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Just tried latest RC1 on game and get the below error:

    Font size and style overrides are only supported for dynamic fonts.
    UnityEngine.Canvas:SendWillRenderCanvases()

    Not sure if already talked about, but has something changed?
    Why the change - if things working fine in previous builds?
     
  2. Alex-Lian

    Alex-Lian

    Guest

    Yeah, it was a regression while fixing a different bug.
    Fix for this is in-bound. Will be trying to get it to rc2.
     
    majman and MrEsquire like this.
  3. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Cool thanks for letting me know..
     
  4. iperov

    iperov

    Joined:
    Dec 13, 2015
    Posts:
    36
    5.4.0f2 beta notes:
    • [688005] UI: Fix to add unsupported fonts in '<font name> only supported in dynamic fonts.' warning.
    but still not fixed in 5.4.0f2 beta.

     
    Last edited: Jul 26, 2016
  5. Alex-Lian

    Alex-Lian

    Guest

    We converted from errors to warnings, but also added an extra check.
    Asking the dev to comment further, but I suspect this is exactly the case we wanted to specify warning. I'll let them explain further.
     
  6. iperov

    iperov

    Joined:
    Dec 13, 2015
    Posts:
    36
    Alex-Lian, so how to use bitmap fonts without warning? there is no style overrides.
    zero font size
    default normal font style
    no best fit.
    Still annoying warnings.
     
  7. phil-Unity

    phil-Unity

    Unity UI Lead Developer Unity Technologies

    Joined:
    Nov 23, 2012
    Posts:
    1,207
    @iperov I see in the image that from the project view the font is arial16 (not sure if its truly size 16 or not as i cant see the import settings) but then the Text element has Font size of 0. This is likely the cause of the warnings. You are asking the system to give a representation of the bitmap font at a size it doesnt have. Could you try setting it to the same size the bitmap font is set to and see if the errors go away? If that doesnt work then we need to wait a little longer for the Dev who really knows text.
     
  8. iperov

    iperov

    Joined:
    Dec 13, 2015
    Posts:
    36
    I cannot repeat problem with new project on 5.4.0f2 beta.
    Current problem project upgraded from 5.3.6f1 to 5.4.0f2 beta.
    But when I reinstall 5.3.6f1 and restore 5.3.6f1 project from backup, problem still persist. Looks like 5.3.6f1 installer was updated too.
    So unity forces me to rebuild whole project from scratch ?
     
  9. phil-Unity

    phil-Unity

    Unity UI Lead Developer Unity Technologies

    Joined:
    Nov 23, 2012
    Posts:
    1,207
    I dont think it would be a full project rebuild that would be required. Might be the fonts need re-imported due to some internal serialization change.
     
  10. iperov

    iperov

    Joined:
    Dec 13, 2015
    Posts:
    36
    more debug:
    delete font from UI elements - spam still keep.
    delete font file - no more spam.
    reimport font file and set to UI elements - no spam. But if I reboot unity - spam begins again.
     
  11. Alex-Lian

    Alex-Lian

    Guest

    Even with setting the font size to 16 to match the bitmap?
     
  12. iperov

    iperov

    Joined:
    Dec 13, 2015
    Posts:
    36
    yes.
    But looks like fixed after reimport font to different name 'arial16_xx'
     
  13. iperov

    iperov

    Joined:
    Dec 13, 2015
    Posts:
    36
    I found problem

    using bitmap fonts with 3D text will cause spam.
    Cannot set Font size to zero in Text Mesh component, if value changed from initial zero value.
    Zero value = no spam.
    My old project have several prefabs with Font Size != 0
     
  14. pfreese

    pfreese

    Unity Technologies

    Joined:
    Feb 23, 2015
    Posts:
    85
    You should be able to use bitmap fonts at any size in UI.Text components (as well as be able to specify a font size of 0). The bitmap font will be scaled to match the specified size if it doesn't match the size defined in the font, and if you specify a size of 0, it will simply match the font size.

    For non UI.Text font usage, such as TextMesh, try setting the font size to the same size as specified in the font.
     
  15. pfreese

    pfreese

    Unity Technologies

    Joined:
    Feb 23, 2015
    Posts:
    85
    After some additional testing, I realized that what you are seeing is is a different issue than that reported in the original post. The warning message is the same "Font size and style overrides are only supported for dynamic fonts" but its actually from a different bit of code, and related to not being able to set the font size to 0 for TextMesh and GUIText components. This was actually caused by a breaking change about 12 months ago; I just verified that this problem exists in 5.3.5 as well. We'll get a fix in for this; for now, the only work-around is to avoid modifying the fontsize in the inspector for TextMesh and GUIText, and if necessary, directly change the font size via script or by editing the saved scene file text.
     
    drakfyre likes this.
unityunity