I just added the Google Anton font regular:
wp-content/themes/cafejp/resources/fonts/anton-v25-latin-regular.woff2
And it is loaded with
/* anton-regular - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Anton';
font-style: normal;
font-weight: 400;
src: url('@fonts/anton-v25-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
in
wp-content/themes/cafejp/resources/styles/common/fonts.css
and then in app.css
and editor.css
with
/*---------------------------------------------------
* Fonts
----------------------------------------------------*/
@import 'common/fonts';
And for tailwind.conf.js I have
/** @type {import('tailwindcss').Config} config */
const config = {
content: ['./app/**/*.php', './resources/**/*.{php,vue,js}'],
theme: {
extend: {
colors: {}, // Extend Tailwind's default colors
fontFamily: {
'anton': ['Anton', 'sans-serif'],
'orbitron': ['Orbitron', 'sans-serif'],
'asap-condensed': ['Asap Condensed', 'sans-serif'],
},
fontWeight: {
'anton': {
normal: '400', // Only load the regular weight for Anton
},
},
},
},
plugins: [],
};
export default config;
which is adding font data to theme.json using bud.conf.js:
...
"typography": {
"customFontSize": false,
"fontFamilies": [
{
"fontFamily": "ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\"",
"name": "Ui-sans-serif",
"slug": "sans"
},
{
"fontFamily": "ui-serif,Georgia,Cambria,\"Times New Roman\",Times,serif",
"name": "Ui-serif",
"slug": "serif"
},
{
"fontFamily": "ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace",
"name": "Ui-monospace",
"slug": "mono"
},
{
"fontFamily": "Anton,sans-serif",
"name": "Anton",
"slug": "anton"
},
{
"fontFamily": "Orbitron,sans-serif",
"name": "Orbitron",
"slug": "orbitron"
},
{
"fontFamily": "Asap Condensed,sans-serif",
"name": "Asap Condensed",
"slug": "asap-condensed"
}
],
...
When I choose the Font under Typography in the editor I somehow can choose any appearance so also thin, semi-bold, bold and so on.
Should WordPress not just show regular and not the other fonts weights ?