Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different CSS (Font-weight) in Mac OSX and Windows. Why does the font-weight render differently?

I came across an issue in which the "font-weight" appears differently in different operating systems, in my case Windows and Mac OSX. These are some examples of how the font gets rendered:

  • Windows :

enter image description here

  • Max OSX :

enter image description here

Same text, same browser, but different operating systems. On the Mac device, I checked every browser including Firefox, Opera, Google Chrome, Safari and the website gets displayed the same. Once I open the website on a Windows device, the font gets displayed in a "boldish" way, its to say, the text appears bold although I have no such CSS code with this attribute. My custom CSS is as follows:

html,
body,
div,
applet,
object,
iframe,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
font,
ins,
kbd,
q,
s,
samp,
small,
strike,
sub,
sup,
tt,
var,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
td,
input,
textarea {
  font-weight: 300 !important;
}
h1,
h2,
h5,
h6 {
  font-weight: 300 !important;
}
h3 {
  font-weight: 400 !important;
}
h4 {
  font-weight: 400 !important;
}
span,
strong,
th {
  font-weight: 500 !important;
}

This code works fine, and with this I refer to the fact the CSS code gets executed correctly. My font family is "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; if this is of any help. After a lot of research, I tried using the following CSS code which helped many users get around similar problems to mine:

-webkit-font-smoothing: antialiased;

Sadly, the result is still the same and looks like follows:

  • Windows :

enter image description here

  • Mac OSX :

enter image description here

How can I display the text on a Windows device with the same thickness as on a Mac OSX device? I want the text to be thinner on Windows.

Best Regards!!

like image 537
Ava Barbilla Avatar asked Feb 24 '16 15:02

Ava Barbilla


People also ask

Why are fonts different on Windows and Mac?

Well, Windows and Mac each have their own specification for the ascent and descent values. On a Mac, a font looks for the ascent and descent in something called the HHead table, whereas on Windows, a font looks for these values in the Win table.

Why do fonts look different on Macs and PCs?

Usually this indicates one computer doesn't have the font installed correctly, but it can also be tripped up by force-font settings and programming errors. Most problems can be resolved by installing the correct version of the font or adjusting the overriding system setting.

Why is Macos font rendering so good?

It's called Cleartype, and was made with LCD displays in mind. Quite simply, Windows renders fonts with the intent of making the letters more clear. OSX renders the fonts to be more true to how they would print in a book.

Why does a font-weight in Figma seem lighter than the same weight in the browser?

Figma uses its own font rendering because each device renders fonts differently depending on the device, OS type and version, browser and its version, system settings, browser settings, display and maybe some other factors.


1 Answers

My guess is that on Windows, the font being rendered is Arial and on Mac OS X, the font being rendered Helvetica Neue. IIRC Windows doesn't include Helvetica fonts by default, so it is falling back to Arial.

However, Arial is VERY similar to Helvetica. I'm making this guess based on the cross bar of the capital Q. If you made an example with a capital R or G you might be able to confirm my suspicion.

Since Arial doesn't have the additional weight classes that Helvetica does, it is being rendered with the next closest weight class. Thus, you are getting differences between the two OSes.

If you want consistency, I would recommend using a web font like Roboto or Open Sans or something.

Arial VS Helvetica

like image 151
Jeff Jenkins Avatar answered Oct 05 '22 12:10

Jeff Jenkins