Skip to content

Text in buttons are not centered vertically in Firefox #3270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ppawlak opened this issue Apr 23, 2016 · 1 comment
Closed

Text in buttons are not centered vertically in Firefox #3270

ppawlak opened this issue Apr 23, 2016 · 1 comment

Comments

@ppawlak
Copy link

ppawlak commented Apr 23, 2016

This happens only with Firefox : texts in all buttons of my game are not centered vertically, they are a little bit too high. The bigger the font is, the more they are not centered. This happens only if I set a custom font, whatever the font is.

I made a little code snippet to demonstrate :

    var TestLayer = cc.Layer.extend({

        ctor: function () {
            this._super();

            var button = new ccui.Button();
            button.setTitleText("CLICK");
            button.setTitleFontSize(36);
            button.setTitleFontName("Cocogoose");
            button.loadTextureNormal("res/images/button_green_normal.png");
            button.x = cc.winSize.width / 2;
            button.y = cc.winSize.height / 2;
            this.addChild(button);
        }
    });

    var TestScene = cc.Scene.extend({
        ctor:function () {
            this._super();
        },
        onEnter:function () {
            this._super();
            var test_layer = new TestLayer();
            this.addChild(test_layer);
        }
    });

I tested with cocos-2d v3.10 and the upcoming v3.11. Same result.
And here what the button looks like in different browsers:

montage

@ppawlak
Copy link
Author

ppawlak commented May 4, 2016

I am not sure if devs look at issues on this repo so I duplicated it on the cocos2d-x issue tracker : cocos2d/cocos2d-x#15565

superlambchops pushed a commit to superlambchops/cocos2d-html5 that referenced this issue Aug 29, 2016
…renderers.

Fixes display in firefox (issue #15565 on cocos2d-x and cocos2d#3270 on cocos2d-html)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants