I ran into a bug with my application that I was looking for before inconsistent text rendering between Chrome and Firefox 4.
Chrome tells me that a certain line of text has a width of 215 pixels, while Firefox 4 tells me a width of 218 pixels:

A little search indicates that the problem is with Firefox 4 and not with Chrome.
The following code displays the text in the canvas element, as well as through HTML and displays the width:
<html>
<head>
<title>Firefox 4 Text Rendering Bug</title>
<script type="text/javascript">
function draw(){
var canvas = document.getElementById('tutorial');
if (canvas.getContext){
var ctx = canvas.getContext('2d');
ctx.font = "bold 16pt Helvetica"
ctx.fillText("MORE INFORMATION", 0, 16)
alert(ctx.measureText("MORE INFORMATION").width);
}
}
</script>
<style type="text/css">
canvas { border: 1px solid black; }
h2 {font-size: 16pt; font-family: Helvetica; font-weight: bold }
</style>
</head>
<body onload="draw();">
<canvas id="tutorial" width="220" height="20"></canvas>
<h2>MORE INFORMATION</h2>
</body>
</html>
Is there a way to visually convert text between browsers?
source
share