赞 | 39 |
VIP | 0 |
好人卡 | 0 |
积分 | 35 |
经验 | 0 |
最后登录 | 2024-10-30 |
在线时间 | 293 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 3476
- 在线时间
- 293 小时
- 注册时间
- 2020-1-27
- 帖子
- 190
|
- function fixGameFont(fontStyle) {
- if (CanvasRenderingContext2D.prototype.measureTextBkx === undefined) {
- CanvasRenderingContext2D.prototype.measureTextBkx = CanvasRenderingContext2D.prototype.measureText;
- }
- CanvasRenderingContext2D.prototype.measureText = function () {
- this.font = fontStyle;
- return this.measureTextBkx.apply(this, arguments);
- }
- if (CanvasRenderingContext2D.prototype.strokeTextBkx === undefined) {
- CanvasRenderingContext2D.prototype.strokeTextBkx = CanvasRenderingContext2D.prototype.strokeText;
- }
- CanvasRenderingContext2D.prototype.strokeText = function () {
- this.font = fontStyle;
- return this.strokeTextBkx.apply(this, arguments);
- }
- if (CanvasRenderingContext2D.prototype.fillTextBkx === undefined) {
- CanvasRenderingContext2D.prototype.fillTextBkx = CanvasRenderingContext2D.prototype.fillText;
- }
- CanvasRenderingContext2D.prototype.fillText = function () {
- this.font = fontStyle;
- return this.fillTextBkx.apply(this, arguments);
- }
- }
- fixGameFont("20px Arial, sans-serif")
- //https://developer.mozilla.org/zh-CN/docs/Web/CSS/font
复制代码
保证改掉字体. |
|