themeum / kirki

Extending the customizer
https://kirki.org
MIT License
1.26k stars 327 forks source link

Font subset are added multiple times in Google Fonts URL #797

Closed rahulv3a closed 8 years ago

rahulv3a commented 8 years ago

Issue description:

I'm using a bunch of typography fields in Customizer. Everything is working pretty well except font subset is added to Google fonts URL multiple times.

My Google Fonts link looks like:

<link rel='stylesheet' id='kirki_google_fonts-css'  href='https://fonts.googleapis.com/css?family=Open+Sans:regular,italic|Playfair+Display:regular|Raleway:regular&#038;subset=latin-ext,latin-ext,latin-ext,latin-ext,latin-ext,latin-ext,latin-ext,latin-ext,latin-ext,latin-ext,latin-ext,latin-ext,latin-ext,latin-ext,latin-ext,latin-ext,latin-ext,latin-ext,latin-ext,latin-ext,latin-ext' type='text/css' media='all' />

Version used:

Develop Branch, v2.2.7 Commit 5cf3f98

Using theme_mods or options?

theme_mods

Code to reproduce the issue (config + field(s))

Kirki::add_config( 'my_config', array(
  'capability'  => 'edit_theme_options',
  'option_type' => 'theme_mod',
) );

I have 5-6 typography fields similar to the following:

Kirki::add_field( 'my_config', array(
  'settings' => 'typography_field',
  'section'  => 'section',
  'label'    => esc_html__( 'Font', 'example' ),
  'type'     => 'typography',
  'default'  => array(
    'font-family'    => 'Open Sans',
    'variant'        => 'regular',
    'subset'         => array( 'latin-ext' ),
    'font-size'      => '11px',
    'letter-spacing' => '0',
  ),
  'output'   => array(
    array(
      'element'  => '.element',
    ),
  ),
) );
Vishal-Deshpande commented 8 years ago

Yes I can confirm the issue https://fonts.googleapis.com/css?family=Dancing+Script:regular|Roboto:regular|Oswald:regular&#038;subset=latin,latin,latin-ext,latin-ext,latin,latin-ext,latin-ext

aristath commented 8 years ago

Good catch! Fixed. :+1: