/**
 * Fonts used in tinymce editor.
 */
function tamatebako_fonts_mce_fonts()
{
    /* Var */
    $settings = tamatebako_fonts_mce_setting();
    $config = tamatebako_fonts_config();
    $fonts = array();
    foreach ($settings as $setting) {
        $font = get_theme_mod($setting, $config[$setting]['default']);
        $fonts[$font] = tamatebako_get_font_weight($font);
    }
    return $fonts;
}
/**
 * Return Google Font URL containing all fonts used.
 */
function tamatebako_fonts_all_google_url()
{
    /* Get fonts config */
    $config = tamatebako_fonts_config();
    /* Vars: List of all fonts used */
    $fonts = array();
    $fonts_subsets = array();
    /* Foreach setting */
    foreach ($config as $section => $section_data) {
        /* Get font saved. */
        $font = tamatebako_fonts_remove_websafe(get_theme_mod($section, $section_data['default']));
        if (!empty($font)) {
            $fonts[$font] = tamatebako_get_font_weight($font);
            /* subsets. */
            $get_font_subsets = tamatebako_get_font_subsets($font);
            if (!empty($get_font_subsets)) {
                foreach ($get_font_subsets as $subset) {
                    $fonts_subsets[] = $subset;
                }
            }
        }
    }
    if (!empty($fonts)) {
        /* get available subset. */
        $subsets_settings = tamatebako_fonts_subsets();
        $subsets = array_intersect($subsets_settings, $fonts_subsets);
        /* return url */
        return tamatebako_google_fonts_url($fonts, $subsets);
    }
    return '';
}