Web fonts not playing nicely

Get help using Construct 2

Post » Wed Sep 11, 2013 7:20 pm

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?
B
40
S
12
G
1
Posts: 532
Reputation: 4,147

Post » Wed Sep 11, 2013 10:36 pm

better try spritefonts, and use blackhornet's font generator.
B
12
S
3
G
1
Posts: 347
Reputation: 2,866

Post » Wed Sep 11, 2013 11:27 pm

@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?
B
40
S
12
G
1
Posts: 532
Reputation: 4,147

Post » Thu Sep 12, 2013 12:34 am

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.
B
12
S
3
G
1
Posts: 347
Reputation: 2,866

Post » Thu Sep 12, 2013 1:06 am

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.
B
40
S
12
G
1
Posts: 532
Reputation: 4,147

Post » Fri Sep 13, 2013 12:12 am

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?)
B
40
S
12
G
1
Posts: 532
Reputation: 4,147

Post » Fri Sep 13, 2013 12:35 am

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."
Image
B
24
S
8
G
10
Posts: 1,821
Reputation: 8,279

Post » Fri Sep 13, 2013 1:37 am

@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.ome6a17172013-09-13 01:38:53
B
40
S
12
G
1
Posts: 532
Reputation: 4,147

Post » Fri Sep 13, 2013 4:50 pm

I could never fix that waiting time on load, saved myself countless headaches using spritefonts.
B
12
S
3
G
1
Posts: 347
Reputation: 2,866

Post » Sat Sep 14, 2013 6:04 am

@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?
B
40
S
12
G
1
Posts: 532
Reputation: 4,147

Next

Return to How do I....?

Who is online

Users browsing this forum: evillair, Fenix18 and 62 guests