Prerequisites
What problem is your feature request going to solve? Please describe.
Minimize Google fonts's request by decreasing the font weights/variants list. Currently it loads everything, which does cover 99% of use cases, however it's a general forced (and most likely temporary) solution.
It's really frustrating to load all these variants (maybe hundred of kb), when i'm only using regular and bold.
Describe the solution you'd like
Would like to filter the font weight list eg: https://github.com/elementor/elementor/blob/master/includes/frontend.php#L651 . eg:
foreach ( $google_fonts['google'] as &$font ) {
$font_weights = apply_filters('elementor/frontend/google_fonts_weights', '100,100italic,200,200italic,300,300italic,400,400italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic', $font, $google_fonts_index);
$font = str_replace( ' ', '+', $font ) . ':' . $font_weights;
}
.. or instead of a comma separated list, an array. Afterwards I would condition it with !is_admin() to only trim the rest publicly.
Describe alternatives you've considered
I did thought about using elementor/frontend/print_google_fonts filter to disable and continue "my way", but i couldn't find any hook or public list of fonts in Frontend class.
Additional context
Refs: #2088 #4624
PS: if i'd have a green light i could pull request that in no time :)
Prerequisites
What problem is your feature request going to solve? Please describe.
Minimize Google fonts's request by decreasing the font weights/variants list. Currently it loads everything, which does cover 99% of use cases, however it's a general forced (and most likely temporary) solution.
It's really frustrating to load all these variants (maybe hundred of kb), when i'm only using regular and bold.
Describe the solution you'd like
Would like to filter the font weight list eg: https://github.com/elementor/elementor/blob/master/includes/frontend.php#L651 . eg:
.. or instead of a comma separated list, an array. Afterwards I would condition it with
!is_admin()to only trim the rest publicly.Describe alternatives you've considered
I did thought about using
elementor/frontend/print_google_fontsfilter to disable and continue "my way", but i couldn't find any hook or public list of fonts inFrontendclass.Additional context
Refs: #2088 #4624
PS: if i'd have a green light i could pull request that in no time :)