Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5976339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:12:51+00:00 2026-05-22T21:12:51+00:00

I’ve run into a bug with my app that I traced down to inconsistent

  • 0

I’ve run into a bug with my app that I traced down to inconsistent text rendering between Chrome and Firefox 4.

Chrome tells me that a certain string of text is 215px wide whereas Firefox 4 tells me its 218px wide:

Chrome vs Firefox Text Rendering

A bit of searching indicates that the issue is with Firefox 4, not Chrome.

The following code renders the text on the canvas element as well as via HTML and outputs 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 render text consistently between the browsers?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T21:12:52+00:00Added an answer on May 22, 2026 at 9:12 pm

    Is there a way to render text consistently between the browsers?

    Short answer: No. Not with fillText.

    Long answer: In fact it will be different on different operating systems and on different OS settings too. And it’s not a bug with Firefox, per se. If anything, FF4 is the most consistent.

    For Chrome 13.0.782.1, Safari 5 and Opera 11 I get 211

    For IE9 I get 220

    For FF4 I get 218

    This is especially the case with a font like Helvetica, which not every user has. Most windows users will have Arial instead, etc etc.

    See the post yesterday here talking about some of the current problems with fillText. The best you will get with fillText is to use a web-safe font and no italics or bold, and to test to make sure it is consistent enough for your liking across the browsers you are targetting.

    Technically correct but lame answer: Yes there is a way to render text consistently. Make a PNG and render the image across browsers instead. Otherwise you gotta simply find the font that seems to work the closest on all browsers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
I am writing an app with both english and french support. The app requests
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an XML file, the creators of it stuck in a bunch social

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.