I am currently developing an app using Ionic and I have chosen to include the custom font 'Rubik'. Despite importing both 'lighter' and 'bolder' font weights, they do not seem to apply - whenever I set the style, it defaults to the normal weight. Below is the code snippet:
@font-face {
font-family: 'Rubik';
src: url('#{$font-path}/Rubik-Light.otf') format('opentype');
font-weight: lighter;
font-style: normal;
}
@font-face {
font-family: 'Rubik';
src: url('#{$font-path}/Rubik-Regular.otf') format('opentype');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'Rubik';
src: url('#{$font-path}/Rubik-Bold.otf') format('opentype');
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: 'Rubik';
src: url('#{$font-path}/Rubik-Black.otf') format('opentype');
font-weight: bolder;
font-style: normal;
}
I have also experimented with:
@import url('https://fonts.googleapis.com/css?family=Rubik');
These adjustments were made in the variables.scss file. Currently, the only workaround I have found is by creating a new font family for lighter/bolder instead of utilizing it as normal. Lighter and bolder weights function correctly with default fonts like roboto and noto-sans that are pre-installed in Ionic. Any suggestions on how to resolve this issue?