Cocos2d js text alignment in Chrome and Firefox

This is how it looks in chrome and mozilla

I am using cocos2dx-3.10

I used this code

var TestLayer = cc.LayerColor.extend({ ctor: function () { this._super(cc.color(255, 255, 255)); var lineUp = new cc.DrawNode(); lineUp.drawSegment(cc.p(0, 0), cc.p(200, 0), 0.5, cc.color(80, 80, 80)); lineUp.setPosition(cc.p(this.width / 2 - 100, this.height / 2 + 13)); this.addChild(lineUp); var lineDown = new cc.DrawNode(); lineDown.drawSegment(cc.p(0, 0), cc.p(200, 0), 0.5, cc.color(80, 80, 80)); lineDown.setPosition(cc.p(this.width / 2 - 100, this.height / 2 - 17)); this.addChild(lineDown); var label = new cc.LabelTTF("Lorem Ipsum", "Arial", 30); label.setColor(cc.color(0, 0, 0)); label.setPosition(cc.p(this.width / 2, this.height / 2)); this.addChild(label); } }); 

Click here to view a screenshot - Left Side Image In - Chrome Version 55.0.2883.87 m (64-bit) and Right Side Image In - Mozilla Firefox Version 50.1.0

+5
source share

Source: https://habr.com/ru/post/1262514/


All Articles