模板工程升级修改
This commit is contained in:
@@ -337,35 +337,35 @@ Logic.AppStart=function(){
|
||||
// 解决:覆盖全局字体渲染函数,统一使用更粗的中文友好字体
|
||||
|
||||
// 保存原始的 Canvas fillText 方法
|
||||
var originalFillText = CanvasRenderingContext2D.prototype.fillText;
|
||||
var originalStrokeText = CanvasRenderingContext2D.prototype.strokeText;
|
||||
// var originalFillText = CanvasRenderingContext2D.prototype.fillText;
|
||||
// var originalStrokeText = CanvasRenderingContext2D.prototype.strokeText;
|
||||
|
||||
// 覆盖 fillText 方法,在绘制前统一字体设置
|
||||
CanvasRenderingContext2D.prototype.fillText = function() {
|
||||
// 如果当前字体包含 'lighter' 或只有 'Arial',替换为更适合中文的字体
|
||||
if (this.font && (this.font.includes('lighter') || this.font.includes('Arial'))) {
|
||||
// 提取字体大小
|
||||
var sizeMatch = this.font.match(/(\d+)px/);
|
||||
if (sizeMatch) {
|
||||
var size = sizeMatch[1];
|
||||
// 使用 500 字重(中等粗细)+ 中文友好字体
|
||||
this.font = '500 ' + size + 'px "Microsoft YaHei", "PingFang SC", Arial, sans-serif';
|
||||
}
|
||||
}
|
||||
return originalFillText.apply(this, arguments);
|
||||
};
|
||||
// // 覆盖 fillText 方法,在绘制前统一字体设置
|
||||
// CanvasRenderingContext2D.prototype.fillText = function() {
|
||||
// // 如果当前字体包含 'lighter' 或只有 'Arial',替换为更适合中文的字体
|
||||
// if (this.font && (this.font.includes('lighter') || this.font.includes('Arial'))) {
|
||||
// // 提取字体大小
|
||||
// var sizeMatch = this.font.match(/(\d+)px/);
|
||||
// if (sizeMatch) {
|
||||
// var size = sizeMatch[1];
|
||||
// // 使用 500 字重(中等粗细)+ 中文友好字体
|
||||
// this.font = '500 ' + size + 'px "Microsoft YaHei", "PingFang SC", Arial, sans-serif';
|
||||
// }
|
||||
// }
|
||||
// return originalFillText.apply(this, arguments);
|
||||
// };
|
||||
|
||||
// 同样覆盖 strokeText 方法
|
||||
CanvasRenderingContext2D.prototype.strokeText = function() {
|
||||
if (this.font && (this.font.includes('lighter') || this.font.includes('Arial'))) {
|
||||
var sizeMatch = this.font.match(/(\d+)px/);
|
||||
if (sizeMatch) {
|
||||
var size = sizeMatch[1];
|
||||
this.font = '500 ' + size + 'px "Microsoft YaHei", "PingFang SC", Arial, sans-serif';
|
||||
}
|
||||
}
|
||||
return originalStrokeText.apply(this, arguments);
|
||||
};
|
||||
// // 同样覆盖 strokeText 方法
|
||||
// CanvasRenderingContext2D.prototype.strokeText = function() {
|
||||
// if (this.font && (this.font.includes('lighter') || this.font.includes('Arial'))) {
|
||||
// var sizeMatch = this.font.match(/(\d+)px/);
|
||||
// if (sizeMatch) {
|
||||
// var size = sizeMatch[1];
|
||||
// this.font = '500 ' + size + 'px "Microsoft YaHei", "PingFang SC", Arial, sans-serif';
|
||||
// }
|
||||
// }
|
||||
// return originalStrokeText.apply(this, arguments);
|
||||
// };
|
||||
|
||||
// console.log('[字体优化] Canvas 文字渲染已优化,中英文粗细统一');
|
||||
// ============================================================================
|
||||
@@ -1796,6 +1796,7 @@ Logic.setConfigInfo = function(){
|
||||
}
|
||||
for(var i=0;i<GameData.hallConfigName.length;i++){
|
||||
var val = get_paravalue(GameData.serverConfig,GameData.hallConfigName[i]);
|
||||
// console.log(GameData.hallConfigName[i] + val);
|
||||
if(val != null){
|
||||
GameData.hallConfig[GameData.hallConfigName[i]] = val;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user