Jump to content

SystemText Class Bug?


Recommended Posts

Hi @enpu

I'm using the SystemText class to speed up some dev and came across a bug I think when I'm using the 'hires' feature of the engine.  In my game config I have...

game.config = {
    name: 'Slide',

    system: {
        width: 640,
        height: 960,
        scale: true,
        center: true,
        resize: false,
        hidpi: true,
        hires: 4
    scene: {
        backgroundColor: '#ffffff'

    mobile: {
        system: {
            resize: true


...so 'hires' is set to four.  When I test on my phone its fine, hires scale is 1 which I can see in the debug panel, everything looks fine.  I test on my iPad and the hires scale ups to 2, which is great, sprites look good still BUT font size of the SystemText jumps a size.  So I had a little dig in the engine sourcecode (I'm using 2.7.1dev) in the '/engine/renderer/text.js' file I see this line in the SystemText class (line 483):

context.font = this.size * game.scale * game.scale + 'px ' + this.font;

...I changed it to...

context.font = this.size * game.scale + 'px ' + this.font;

...and it seems to render better (removed the duplicate scaling).  If you could confirm this is ok please and if so roll into the GitHub engine that would be great please.  I really need to learn how to perform pull requests lol

Link to comment
Share on other sites

Awesome, when I get some time I'll put some effort into learning some Git basics.  I'd like to help with the engine side of things where I can and understand it more also.

Quick question in fact regarding the 'Text' class please and asset management when I get a little further forward.  I see I can load *.fnt files, whats the preferred software to produce these files (and the matching atlas bitmaps of the font) please?  I know in theory any software that handles the format should be ok but for now I'd like to keep with the 'path of least resistance' and go what you know is working great.

Thanks as always.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...