Web fonts not playing nicely

0 favourites
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • I'm trying to pre-load a web font using a stylesheet. It works, but I get a delay when its trying to set the webfont (which is strange since it's loaded INTO the game...).

    Anyway, I've made a splash screen and put my UI text elements off-screen and set "on start of layout" set web font to stylesheet for each text object. The problem is, when I go to the screen that has the actual UI, it still has a delay loading the web font.

    What am I doing wrong here?

  • better try spritefonts, and use blackhornet's font generator.

  • ghost - I can't afford more sprites on screen, the performance is already terrible using canvas2d. Do the UI elements on the splash screen need to be the EXACT instances in the ui?

  • how many sprites?

    terrible performance? (btw are you using sine?)

    do you have a capx?

    have you read the performance tips?

    if you use spritefonts, you can select if you want:

    a) all the sprites (a-z,A-Z,0-9,etc) or

    b) just some text (like "START") in the spritesheet.

    try blackhornet's tool.

  • I'm using an incredible amount - probably around 400 objects (mostly instances of the same objects) or so per layout, maybe 20 on-screen at a time. I have read the performance tips and followed them very closly. This is unfortunately a webgl/canvas2d flaw more than coding or game design.

    And yes, for an object or two I am using sine.

    I'll be releasing the demo shortly.

    This still doesn't explain why I'm having this issue with webfonts.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Bump - any word on this? I'm half tempted to just try spritefonts, but I'd really like to use standard text (assuming it takes way less processing/ram?)

  • First of all: Your assumption is right.

    Now to your issue. Your description sounds like the webfont gets loaded from a server each time you actually use it? That's indeed strange as it should be cached once loaded. So, maybe the download wasn't completed.

    Have you followed Ashleys advices exactly? From the manual:

    "However, you can work around this by loading all web fonts on startup. For each web font you use in a project, add a text object to your first layout and use the Set web font action to load it. Make the text hidden so it's never seen - it's just loading the web font. Splash screens or title screens are ideal for this. If your splash or title screens use a web font, you might want to use an image there instead, or introduce a second or two delay to give the fonts a chance to load. Then, nobody should ever see the text before the fonts have loaded."

  • tulamide - I'm following that exactly. I'm even giving the splash screen FIVE seconds to catch up. I have every single text object on said splash screen and moved it outside the canvas.

    Basically what I'm doing is going to the splash screen for 4-5 seconds, then going to the "ui" screen (a layout of all UI & menu objects set to global so I can keep these for each level) which has 1 event that goes straight to the main titles and sets the ui layers invisible. Upon starting a level, the ONLY thing that happens is the layer is set visible - the text was technically on the screen the whole time.

    On top of all of this, I have an event on the splashscreen that sets the font of all text objects to my css file.

  • I could never fix that waiting time on load, saved myself countless headaches using spritefonts.

  • ghost - I tried using a sprite font. I think this would work, but my time counter should read 00:00:00 and it's treating the : with the width of an entire character which not only looks odd, but makes it so the art would need to be changed. Is there a way around this?

  • ignore that - figured out you can set the width for specific characters in the conditions. Thanks ghost!

  • tulamide cc: ome6a1717

    Just to be sure, how do I "introduce a second or two delay to give the fonts a chance to load"?

    Like this?: In Start of Layout > Wait 2.0 seconds

  • notnsane - honestly, the display time is so inconsistent, I switched to spritefonts. It's a bit more work, but worth it imo.

    However, you can try creating a splashscreen or menu that has all text objects on them that will hopefully load on that layout.

  • I'll try my best. It's driving me nuts, I hope it works...

  • Well, no. Nothing I did made Web Fonts useful - I'm using them online, still.

    Will try offline Web Fonts and see if I have luck with this, else I'll default to SpriteFonts.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)