The condensed font I'm using (mango grotesque, variable) appears fine on desktop and the responsive viewer but when I visit the site on mobile it appears that the font-weight is too bold (not responsive?).
I want it to behave the way it does when I view it through the inspect element. I've tested this on Chrome ios and Safari ios and the issue persists on both. My font CSS is attached below.
@font-face {
font-family: "Hubot Sans";
src: url("../fonts/HubotSans[slnt\,wdth\,wght].woff2") format("woff2");
}
@font-face {
font-family: "Mango-Grotesque";
src: url('../fonts/Mango Grotesque-VF.woff2') format('woff2');
}
body {
font-family: "Hubot Sans", Arial, Helvetica, sans-serif;
}
h1,
h2,
h3,
h4,
h5,
h6,
p,
ul,
ol {
margin-top: 0;
}
p,
ul,
code,
ol {
max-width: 40rem;
line-height: 1.5;
margin-bottom: var(--sp-3xl);
}
.large-title {
font-size: 6.25rem;
}
.title-1 {
font-size: 4.9375rem;
font-weight: 600;
}
.title-2 {
font-size: 3.8125rem;
margin-bottom: var(--sp-lg);
font-weight: 600;
}
.title-3 {
font-size: 2.875rem;
font-weight: 600;
}
.title-4 {
font-size: 2.125rem;
font-weight: 600;
}
.headline {
font-size: 1.175rem;
margin-bottom: var(--sp-sm);
font-weight: 500;
}
p {
line-height: 140%;
max-width: 32rem;
}
p:not(p:last-of-type) {
margin-bottom: var(--sp-sm);
}
p.label.orange {
color: var(--primary-500);
}
small {
font-size: 0.875rem;
color: var(--text-tertiary);
line-height: 1.0625rem;
margin-bottom: var(--sp-base);
}
.hubot-sans {
font-family: "Hubot Sans", Arial, Helvetica, sans-serif;
}
.hubot-sans-condensed {
font-family: "Hubot Sans", Arial, Helvetica, sans-serif;
font-stretch: condensed;
}
.mango-grotesque {
font-family: "Mango-Grotesque", Arial, Helvetica, sans-serif;
font-size: 1.5rem;
text-rendering: optimizeLegibility;
}
em {
font-style: italic;
font-weight: bold;
}
.text-lg {
font-size: 1.125rem;
}
.text-base {
font-size: 1rem;
}
.text-sm {
font-size: 0.9rem;
}
code {
display: block;
padding: var(--sp-sm);
background-color: var(--zinc-900);
border: 1px solid var(--zinc-700);
margin-bottom: var(--sp-xl);
}
.large-title,
.title-1,
.title-2,
.title-3,
.title-4 {
font-family: "Mango-Grotesque", Arial, Helvetica, sans-serif;
text-transform: uppercase;
margin-bottom: var(--sp-xs);
line-height: 90%;
text-rendering: optimizeLegibility;
}
.headline,
label,
.subtitle,
.caption-text {
font-family: "Hubot Sans", Arial, Helvetica, sans-serif;
}
.subtitle {
font-size: 1.125rem;
margin-bottom: var(--sp-xs);
font-weight: 600;
}
.callout {
font-family: "Hubot Sans", Arial, Helvetica, sans-serif;
font-stretch: condensed;
font-size: 1.125rem;
line-height: 0.9375rem;
margin-bottom: var(--sp-sm);
font-weight: 600;
letter-spacing: 0.0125rem;
text-transform: uppercase;
}
strong {
font-weight: 600;
}
.strikethrough {
text-decoration: line-through;
}
.caption-text {
font-size: 0.875rem;
color: var(--text-secondary);
}
.text-secondary {
color: var(--text-secondary);
}
.text-tertiary {
color: var(--text-tertiary);
}
.text-orange {
color: var(--primary-500);
}
I've tried using media queries to change the font weight at mobile levels but this does not seem like an ideal solution. I'm also not convinced on that solution as viewing the font through the desktop inspect element responsive viewer the font seems to respond properly.
Variable font weight ranges may not be auto-detected
Some browsers can actually automatically recognise a font file as a variable font and also read the default weight axis values - but others can't.
iOS safari tends to be less "forgiving" with regards to less specific
@font-face
rules.BTW. every browser on iOS takes the safari/webkit engine – so you'll encounter the exact same rendering issues. However there are some "efforts" (... running lawsuits) trying to change this (state 2024).
1. Add a font-weight property value specifying a range
Ideally you should check the font documentation to find the correct min and max values – these are not standardized. Some VF fonts may use a range between 100–1000 others 300–800.
Example: variable font weights
Missing font-weight property values may also introduce "faux bolds" rendering.
"faux bolds" means the browser tries to bolden a font synthetically – the result is ... yikes!
You can also control variable font-weights via font-variation-settings property like so:
2. Make sure variable design axes are not stripped during conversion
Unfortunately a lot of great converters still (2024) don't support variable fonts perfectly. So when converting a variable font
ttf/truetype
file towoff2
you might get a "static"/one-weight font missing the axes data for seamless weight interpolation.For the above example I used the cloudconvert ttf-to-woff2 converter