Drawing font error in HTML5

Discussion in 'Programming' started by Nathan Archer, Jul 2, 2019.

  1. Nathan Archer

    Nathan Archer Member

    Joined:
    Jun 27, 2016
    Posts:
    198
    Hey, I'm having an error with drawing in my HTML5 game. It seems like once I have a string that's long enough, or it uses a certain font or is drawn with a certain font color, there's some kind of data leak and it becomes a garbled mess.

    [​IMG]
    It has an outline by drawing the same text 8 times. This is what it looks like in a different font:

    [​IMG]

    It's supposed to draw the same font twice, but is instead drawing some cursive font as the background font, and it is only looking at the characters partially. The type of secondary font seems to be something random, not a font that I have added.

    Really weird. Any idea how to fix this?
     
  2. Nocturne

    Nocturne Friendly Tyrant Forum Staff Admin

    Joined:
    Apr 13, 2016
    Posts:
    6,901
    Do you clear the compiler cache between builds after changing the font resource? You should ALWAYS clear the cache when you change a resource and test on HTML5.
     
  3. Nathan Archer

    Nathan Archer Member

    Joined:
    Jun 27, 2016
    Posts:
    198
    Is this the same thing as "Build clean"?
     
  4. Nocturne

    Nocturne Friendly Tyrant Forum Staff Admin

    Joined:
    Apr 13, 2016
    Posts:
    6,901
    It's the button at the top of the IDE that looks like a broom, beside the play/debug/etc... buttons
     
  5. chamaeleon

    chamaeleon Member

    Joined:
    Jun 21, 2016
    Posts:
    976
    I have seen an issue that isn't quite the same as yours (I think, hard to tell).. But have you played around with webgl on or off in the HTML5 settings, and if not, what happens if you turn it off?
     
  6. Nathan Archer

    Nathan Archer Member

    Joined:
    Jun 27, 2016
    Posts:
    198
    I have the same error with it disabled. Well to be more correct, there are different graphical artifacts. Not necessarily an identifiable font. I can't find a consistent rule as to what causes this. It seems random but it becomes more often with longer text messages and fonts that differ from the main impact font.

    [​IMG]
     
    Last edited: Jul 7, 2019
  7. chamaeleon

    chamaeleon Member

    Joined:
    Jun 21, 2016
    Posts:
    976
    Out of curiosity, if you use a rotation of 0, what does it look like? I realize it doesn't match what you're trying to do in connection with the picture..
     
  8. Nathan Archer

    Nathan Archer Member

    Joined:
    Jun 27, 2016
    Posts:
    198
    Same problem happens. There isn't a consistent digital artifact. Seems like there's three forms, failing to draw a few characters, sometimes just one in the whole text. Sometimes jumbled text of a different font, and sometimes blocks of mess.

    [​IMG]

    [​IMG]
     
  9. Nathan Archer

    Nathan Archer Member

    Joined:
    Jun 27, 2016
    Posts:
    198
  10. Nathan Archer

    Nathan Archer Member

    Joined:
    Jun 27, 2016
    Posts:
    198
    I think I'm getting somewhere figuring out where the error comes from. It seems like there's a limited amount of characters HTML5 can handle, and once you surpass that amount everything becomes garbled. Like if I have half the amount of total characters allowed, and I draw them all in Font A and Font B, then Font C becomes garbled. If I draw the full amount in Font A, then Font B and Font C become garbled if I switch to them.

    Any way I can clear this font/character cache?
     
  11. Nathan Archer

    Nathan Archer Member

    Joined:
    Jun 27, 2016
    Posts:
    198
  12. Nathan Archer

    Nathan Archer Member

    Joined:
    Jun 27, 2016
    Posts:
    198
  13. Nathan Archer

    Nathan Archer Member

    Joined:
    Jun 27, 2016
    Posts:
    198

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice