Skip to content

Latest commit

 

History

History
39 lines (26 loc) · 2.98 KB

DEVELOPER-NOTES.md

File metadata and controls

39 lines (26 loc) · 2.98 KB

Developer Notes

Emoji font support information

Possible Phaser 3.50 bugs

Font parsing bug

Noticed

So the 'font-family' cannot be three words long to work eg. "my named font" will fail, but "my_named font" will work!

Investigation

Nothing stopping this in the definition, they even have an example "New Century Schoolbook" which they have quoted, but it didn't need to be...

So this is a bug in the setFont function of the TextStyle object in Phaser3, the else section. It only accepts the 2nd or 3rd token (' ' delimited) as the font family.

Speculation

But how does this work for "my_named font" then?

So for a string such as '123px "my_named font"' we would get a result of { fontStyle='123px', fontSize='"my_named', fontFamily='font"' }. I suspect these get recombined as a string to form '123px "my_named font"' before being passed to render, so it gets correctly interpreted downstream. Whereas '123px "my named font"' would become { fontStyle='123px', fontSize='"my', fontFamily='named' } which would be recombined as '123px "my named' and so fail. I didn't check the render code but I imagine it is something like this.

Text canvas size if 0 bug?

Noticed

When creating sea life, sporadically I would get a DOMException

Investigation

Some digging found that the canvas size was 0 when the text was going to be written to it. However, since using a workaround and then taking it out to investigate further I've not been able to reproduce it.

So it may be my initial weaker use of Phaser that I've since corrected and didn't realise it fixed this too. Sadly it wasn't under source control in those early stages, so can't go back. A lesson in this. I've removed the workaround (a try-catch for DOMException in a while loop checking for a defined text object)