Detect custom font size

While you can not use CSS to detect Custom font sizes they can be disabled using this code:

add_theme_support( 'disable-custom-font-sizes' );

Then, to have more control over how the look of font sizes are, we can use:

    add_theme_support( 'editor-font-sizes', array(
        array(
            'name'  => 'Small',
            'slug'  => 'small',
            'size'  => '14px'
        ),
        array(
            'name'  => 'Normal',
            'slug'  => 'normal',
            'size'  => '18px'
        ),
        // etc.
    ) );

Then, where size is small here, we make a CSS rule like:

    .has-medium-font-size {
        font-size: 14px;
    }

Using the classes we can make logical breakpoints for the sizes.

Might help someone with a similar issue…