-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Hi there,
thanks for this useful plugin. I have found a bug when using the Kanit font with the following enqueue:
wp_enqueue_style( 'google-font', 'https://fonts.googleapis.com/css?family=Kanit:100,200,300,400,400,500,700,900&display=swap' );
Basically, there was a mismatch between the file name in the local cache and the URL used as a replacement in the link.
I.e. The file was named kanit-v13-latin_latin-ext_thai_vietnamese-100.woff but the URL was kanit-v12-vietnamese_latin-ext_latin-regular.woff2, resulting in several 404 errors.
There were two different issues:
- The "thai" subset was completely missing
- It seems the order of the subsets in the two cases was not corresponding.
I was able to fix the issue with the following snippet thanks to the available filter:
// Fix to embed Kanit font via Embed Google Fonts plugin.
function bs_fix_embed_google_fonts_get_subsets( $subsets ) {
if ( ! in_array ( 'thai', $subsets ) ) {
$subsets[] = 'thai';
}
sort( $subsets );
return $subsets;
}
add_filter( 'embed_google_fonts_get_subsets', 'bs_fix_embed_google_fonts_get_subsets' );
However, it would be ideal to add 'thai' and reorder the subsets directly in the original plugin.
Thank you.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels