Custom Font Problem

Get help using Construct 2

Post » Wed Apr 03, 2013 9:07 am

[QUOTE=Joannesalfa]
There an issue if you enable WebGL, it won't show custom font.
Otherwise disable WebGL, it would work.
[/QUOTE]

Ah OK thanks. Although that means if I want effects and performance improvements then I'm stuck with using horrible standard fonts. Does anyone know if this is a C2 issue or a problem elsewhere? No way at all to use custom fonts and WebGL together?
B
13
S
4
Posts: 127
Reputation: 1,479

Post » Wed Apr 03, 2013 11:09 am

@SecondDimension They ignored me about this issue, please spread this bug reportJoannesalfa2013-04-03 11:09:22
B
96
S
25
G
20
Posts: 3,053
Reputation: 22,640

Post » Mon Jun 03, 2013 12:46 pm

Ive found that, its not like that at all.

If you have webGL enables, you dont see custom webfont at the beginning, but try resizing the browser windows a couple of times and voil, text boxes get their custom webfont.

So, Im not sure if this is a bug related to the webGL plugin or something else, but its really anoying not to be able to use custom webfonts with webGL enables.

Maybe we can find a fix or at least, a patch.
B
14
S
4
G
3
Posts: 106
Reputation: 4,792

Post » Mon Jun 03, 2013 1:12 pm

add the custom font to your index.html aswel.
It is because the layout is loaded but the body uses another font. This is a small CSS thing of inheritance. So it will use the standard font untill you change your canvas size by expanding or minimizing your browser window. Or you put it on the body so it get's auto loaded.

I just did it for my game. www.undesign.be/X3


open your html file when exported.

add this line to your <head>
----------------------------------------------------------------
<link rel="stylesheet" href="stylesheet.css" type="text/css" charset="utf-8" />
----------------------------------------------------------------

Then add this to your Body{ } style
----------------------------------------------------------------
     font-family: <name of your font>;
----------------------------------------------------------------

boom your font is there from the start of your gamemrPeanut2013-06-03 13:18:18
B
9
S
3
G
3
Posts: 70
Reputation: 1,990

Post » Mon Jun 03, 2013 2:18 pm

Its a quite clever workaround @mrPeanut, thanks :).

I didnt think about the exported game, my problem is in the preview, but at least, we have a solution for the exported one :) (not sure what will happen when we export to exe for example).
B
14
S
4
G
3
Posts: 106
Reputation: 4,792

Post » Mon Jun 03, 2013 2:22 pm

thanks @sirLobito.

Also a .exe is not realy conform with the rules of web css. So it will probably use the predeterment font.

As for preview do not set the font yet just type al lthe test in the font you want. And @ export implement the font. So you can set it right.
B
9
S
3
G
3
Posts: 70
Reputation: 1,990

Post » Mon Jun 03, 2013 8:41 pm

A way to force the webfont is to adjust the fontsize or make the text object turn invisible/visible.

Perfect example that works with webfonts in node-webkit is:

Start of Layout
> Set Web Font "NAME" from "CSS FILE"
> Set TEXT invisble
> Wait 0.01 Seconds
> Set TEXT visible

Make sure you import the CSS file and font(s) into the project files.

Doing this on the loader layout should pre-load the font for the rest of the game as it's already downloaded and such.Thndr2013-06-03 20:41:56
B
15
S
4
G
4
Posts: 294
Reputation: 3,225

Post » Tue Jun 04, 2013 7:18 am

As @Thndr said, this is a possible fix, yeah.

Yesterday, I did some experiments with custom fonts and their loadings, and I gain to something similar:

- Set Web Font "xxx" from "xxx.css"
- Type some text into a textbox (you can have it colored with the same color as the background os something similar not to be shown at this point)
- Remove the string (Set text to "") (and change the color of the textbox if you need).

Anyway, seems like there are lot of workarounds depending on each project, so, nice :).
Thanks everybody.
B
14
S
4
G
3
Posts: 106
Reputation: 4,792

Previous

Return to How do I....?

Who is online

Users browsing this forum: Zakeru and 22 guests