@@ -65,7 +65,7 @@ public static function get_instance() {
6565 public function __construct () {
6666
6767 add_action ( 'wp_enqueue_scripts ' , array ( $ this , 'typekit_embed_css ' ) );
68- // add Custom Font list into Astra customizer.
68+ // Add Custom Font list into Astra customizer.
6969 add_action ( 'astra_customizer_font_list ' , array ( $ this , 'add_customizer_font_list ' ) );
7070 add_action ( 'astra_render_fonts ' , array ( $ this , 'render_fonts ' ) );
7171 add_filter ( 'astra_custom_fonts ' , array ( $ this , 'add_typekit_fonts ' ) );
@@ -77,6 +77,8 @@ public function __construct() {
7777 add_filter ( 'elementor/fonts/additional_fonts ' , array ( $ this , 'add_elementor_fonts ' ) );
7878
7979 add_action ( 'enqueue_block_editor_assets ' , array ( $ this , 'typekit_embed_css ' ) );
80+ // Astra filter before creating google fonts URL.
81+ add_filter ( 'astra_google_fonts ' , array ( $ this , 'remove_typekit_font_google_url ' ) );
8082 }
8183
8284 /**
@@ -229,6 +231,27 @@ function bb_custom_fonts( $bb_fonts ) {
229231
230232 return array_merge ( $ bb_fonts , $ custom_fonts );
231233 }
234+
235+ /**
236+ * Remove Typekit Font from Google Font URL.
237+ *
238+ * @since 1.1.0
239+ * @param array $fonts font families selected.
240+ */
241+ function remove_typekit_font_google_url ( $ fonts ) {
242+
243+ $ kit_list = get_option ( 'custom-typekit-fonts ' , array () );
244+ if ( ! empty ( $ kit_list ['custom-typekit-font-details ' ] ) ) {
245+ foreach ( $ kit_list ['custom-typekit-font-details ' ] as $ key => $ value ) {
246+ $ font_key = "' " . $ value ['family ' ] . "' " . ', ' . $ value ['fallback ' ];
247+ if ( array_key_exists ( $ font_key , $ fonts ) ) {
248+ unset( $ fonts [ $ font_key ] );
249+ }
250+ }
251+ }
252+
253+ return $ fonts ;
254+ }
232255 }
233256
234257 /**
0 commit comments