gpt4 book ai didi

windows - Html5 Canvas : Rotated text looks distorted on Google Chrome

转载 作者:可可西里 更新时间:2023-11-01 14:15:03 29 4
gpt4 key购买 nike

我在 HTML5 canvas 中旋转了一个文本。除了谷歌浏览器,它在所有浏览器上看起来都很好。它在 Windows 上的 chrome 上看起来失真。另外,它在 MAC 上看起来不错。为什么会这样?我使用的是 Chrome beta 20。是 HTML 5 问题还是 Google Chrome 或 Windows 错误?我该如何解决这个失真问题?

<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
#myCanvas {
border: 1px solid #9C9898;
}
</style>
<script>
window.onload = function() {
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");

context.font = "12pt Calibri";
context.rotate(Math.PI/2.5);
context.fillText("Competitive Landcaping!", 450, 100);
};

</script>
</head>
<body>
<canvas id="myCanvas" width="878" height="2000"></canvas>
</body>
</html>

最佳答案

我最近也经历了同样的事。简短的回答是 Chrome 在 Windows 上呈现的字体很差,而且转换后的字体只会变得更糟。

要获得更长、更技术性的答案,请查看此帖子:

http://www.smashingmagazine.com/2012/04/24/a-closer-look-at-font-rendering/

除了尝试选择在 Chrome 中看起来“最差”的字体之外,没有什么可以做的。

关于windows - Html5 Canvas : Rotated text looks distorted on Google Chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11576708/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com