<?php
/**
 * Customizer settings: typography
 *
 * @package Multi
 */

if ( ! defined( 'ABSPATH' ) ) {
	die;
}

/**
 * Customizer settings for typography
 */
class Multimagazine_Customize_Typography {

	/**
	 * Returns font choices.
	 *
	 * @return array
	 */
	private static function font_choices() {
		return array(
			'primary'   => __( 'Primary font', 'multimagazine' ),
			'secondary' => __( 'Secondary font', 'multimagazine' ),
		);
	}

	/**
	 * Returns font weight choices.
	 *
	 * @return array
	 */
	private static function font_weight_choices() {
		return array(
			'100'     => __( '100', 'multimagazine' ),
			'200'     => __( '200', 'multimagazine' ),
			'300'     => __( '300 (light)', 'multimagazine' ),
			'400'     => __( '400 (normal)', 'multimagazine' ),
			'500'     => __( '500', 'multimagazine' ),
			'600'     => __( '600 (semibold)', 'multimagazine' ),
			'700'     => __( '700 (bold)', 'multimagazine' ),
			'800'     => __( '800', 'multimagazine' ),
			'900'     => __( '900', 'multimagazine' ),
			'lighter' => __( 'lighter', 'multimagazine' ),
			'bolder'  => __( 'bolder', 'multimagazine' ),
		);
	}

	/**
	 * Registers the section and fires the extension hook.
	 *
	 * @param WP_Customize_Manager $wp_customize Customizer manager instance.
	 */
	public static function register_section( $wp_customize ) {
		$wp_customize->add_panel(
			'typography',
			array(
				'title'    => __( 'Typography', 'multimagazine' ),
				'priority' => 58,
			)
		);

		$wp_customize->add_section(
			'typo_primary',
			array(
				'title' => __( 'Primary font', 'multimagazine' ),
				'panel' => 'typography',
			)
		);
		do_action( 'multimagazine_customize_typo_primary', $wp_customize );

		$wp_customize->add_section(
			'typo_secondary',
			array(
				'title' => __( 'Secondary font', 'multimagazine' ),
				'panel' => 'typography',
			)
		);
		do_action( 'multimagazine_customize_typo_secondary', $wp_customize );

		$wp_customize->add_section(
			'typo_font_size',
			array(
				'title' => __( 'Font sizes and weights', 'multimagazine' ),
				'panel' => 'typography',
			)
		);
		do_action( 'multimagazine_customize_typo_font_size', $wp_customize );

		$wp_customize->add_section(
			'typo_header_menu',
			array(
				'title' => __( 'Header menu', 'multimagazine' ),
				'panel' => 'typography',
			)
		);
		do_action( 'multimagazine_customize_typo_header_menu', $wp_customize );

		$wp_customize->add_section(
			'typo_headings',
			array(
				'title' => __( 'Headings', 'multimagazine' ),
				'panel' => 'typography',
			)
		);
		do_action( 'multimagazine_customize_typo_headings', $wp_customize );

		$wp_customize->add_section(
			'typo_other',
			array(
				'title' => __( 'Other typography settings', 'multimagazine' ),
				'panel' => 'typography',
			)
		);
		do_action( 'multimagazine_customize_typo_other', $wp_customize );

		$wp_customize->add_section(
			'typo_footer',
			array(
				'title' => __( 'Footer', 'multimagazine' ),
				'panel' => 'typography',
			)
		);
		do_action( 'multimagazine_customize_typo_footer', $wp_customize );
	}

	/* Primary font section */

	/**
	 * Registers the primary font setting.
	 */
	public static function register_primary_font() {
		global $multimagazine_customize;
		$choices = array(
			'google'                                             => __( 'Google Fonts', 'multimagazine' ),
			/* The 'typekit' entry is injected here by Multi Pro via 'multimagazine_primary_font_source_choices'. */
			'Helvetica, sans-serif'                             => 'Helvetica',
			'Arial, sans-serif'                                 => 'Arial',
			'Arial Black, Gadget, sans-serif'                   => 'Arial Black',
			'Comic Sans MS, cursive'                            => 'Comic Sans MS',
			'Courier New, monospace'                            => 'Courier New',
			'Georgia, serif'                                    => 'Georgia',
			'Impact, Charcoal, sans-serif'                      => 'Impact',
			'Lucida Console, Monaco, monospace'                 => 'Lucida Console',
			'Lucida Sans Unicode, Lucida Grande, sans-serif'    => 'Lucida Sans Unicode',
			'Palatino Linotype, Book Antiqua, Palatino, serif'  => 'Palatino Linotype',
			'Tahoma, Geneva, sans-serif'                        => 'Tahoma',
			'Times New Roman, Times, serif'                     => 'Times New Roman',
			'Trebuchet MS, sans-serif'                          => 'Trebuchet MS',
			'Verdana, Geneva, sans-serif'                       => 'Verdana',
			'MS Sans Serif, Geneva, sans-serif'                 => 'MS Sans Serif',
			'MS Serif, New York, serif'                         => 'MS Serif',
		);
		$choices = apply_filters( 'multimagazine_primary_font_source_choices', $choices );
		$multimagazine_customize->select_setting( 'multi_primary_font', 'typo_primary', $choices, __( 'Primary font', 'multimagazine' ) );
	}

	/**
	 * Registers the primary google font setting.
	 */
	public static function register_primary_google_font() {
		global $multimagazine_customize;
		$multimagazine_customize->text_setting( 'multi_primary_google_font', 'typo_primary', __( 'Primary font name', 'multimagazine' ), __( 'Enter font name if Google Fonts is chosen above. Default: Open Sans', 'multimagazine' ) );
	}

	/**
	 * Adds the primary font subsetting heading.
	 */
	public static function register_primary_font_subsetting_heading() {
		multimagazine_add_heading( 'multi_primary_font_subsetting', 'typo_primary', __( 'Subsetting', 'multimagazine' ) );
	}

	/**
	 * Registers the primary subset latin setting.
	 */
	public static function register_primary_subset_latin() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_primary_subset_latin', 'typo_primary', __( 'latin (latin, latin-ext)', 'multimagazine' ) );
	}

	/**
	 * Registers the primary subset greek setting.
	 */
	public static function register_primary_subset_greek() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_primary_subset_greek', 'typo_primary', __( 'greek (greek, greek-ext)', 'multimagazine' ) );
	}

	/**
	 * Registers the primary subset vietnamese setting.
	 */
	public static function register_primary_subset_vietnamese() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_primary_subset_vietnamese', 'typo_primary', __( 'vietnamese (vietnamese )', 'multimagazine' ) );
	}

	/**
	 * Registers the primary subset cyryllic setting.
	 */
	public static function register_primary_subset_cyryllic() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_primary_subset_cyryllic', 'typo_primary', __( 'cyrillic (cyrillic, cyrillic-ext)', 'multimagazine' ) );
	}

	/**
	 * Adds the primary font weights heading.
	 */
	public static function register_primary_font_weights_heading() {
		multimagazine_add_heading( 'multi_primary_font_weights', 'typo_primary', __( 'Available weights', 'multimagazine' ), 4 );
	}

	/**
	 * Registers the primary font weight 300 setting.
	 */
	public static function register_primary_font_weight_300() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_primary_font_weight_300', 'typo_primary', __( 'Light', 'multimagazine' ) );
	}

	/**
	 * Registers the primary font weight 400 setting.
	 */
	public static function register_primary_font_weight_400() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_primary_font_weight_400', 'typo_primary', __( 'Normal', 'multimagazine' ) );
	}

	/**
	 * Registers the primary font weight 600 setting.
	 */
	public static function register_primary_font_weight_600() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_primary_font_weight_600', 'typo_primary', __( 'Semibold', 'multimagazine' ) );
	}

	/**
	 * Registers the primary font weight 700 setting.
	 */
	public static function register_primary_font_weight_700() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_primary_font_weight_700', 'typo_primary', __( 'Bold', 'multimagazine' ) );
	}

	/* Secondary font section */

	/**
	 * Registers the secondary font setting.
	 */
	public static function register_secondary_font() {
		global $multimagazine_customize;
		$choices = array(
			''                                                   => __( 'As set in Primary Font', 'multimagazine' ),
			'google'                                             => __( 'Google Font', 'multimagazine' ),
			/* The 'typekit' entry is injected here by Multi Pro via 'multimagazine_secondary_font_source_choices'. */
			'Helvetica, sans-serif'                             => 'Helvetica',
			'Arial, sans-serif'                                 => 'Arial',
			'Arial Black, Gadget, sans-serif'                   => 'Arial Black',
			'Comic Sans MS, cursive'                            => 'Comic Sans MS',
			'Courier New, monospace'                            => 'Courier New',
			'Georgia, serif'                                    => 'Georgia',
			'Impact, Charcoal, sans-serif'                      => 'Impact',
			'Lucida Console, Monaco, monospace'                 => 'Lucida Console',
			'Lucida Sans Unicode, Lucida Grande, sans-serif'    => 'Lucida Sans Unicode',
			'Palatino Linotype, Book Antiqua, Palatino, serif'  => 'Palatino Linotype',
			'Tahoma, Geneva, sans-serif'                        => 'Tahoma',
			'Times New Roman, Times, serif'                     => 'Times New Roman',
			'Trebuchet MS, sans-serif'                          => 'Trebuchet MS',
			'Verdana, Geneva, sans-serif'                       => 'Verdana',
			'MS Sans Serif, Geneva, sans-serif'                 => 'MS Sans Serif',
			'MS Serif, New York, serif'                         => 'MS Serif',
		);
		$choices = apply_filters( 'multimagazine_secondary_font_source_choices', $choices );
		$multimagazine_customize->select_setting( 'multi_secondary_font', 'typo_secondary', $choices, __( 'Secondary font', 'multimagazine' ) );
	}

	/**
	 * Registers the secondary google font setting.
	 */
	public static function register_secondary_google_font() {
		global $multimagazine_customize;
		$multimagazine_customize->text_setting( 'multi_secondary_google_font', 'typo_secondary', __( 'Secondary font name', 'multimagazine' ), __( 'Enter font name if Google Fonts is chosen above. Default: Open Sans', 'multimagazine' ) );
	}

	/**
	 * Adds the secondary font subsetting heading.
	 */
	public static function register_secondary_font_subsetting_heading() {
		multimagazine_add_heading( 'multi_secondary_font_subsetting', 'typo_secondary', __( 'Subsetting', 'multimagazine' ), 4 );
	}

	/**
	 * Registers the secondary subset latin setting.
	 */
	public static function register_secondary_subset_latin() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_secondary_subset_latin', 'typo_secondary', __( 'latin (latin, latin-ext)', 'multimagazine' ) );
	}

	/**
	 * Registers the secondary subset greek setting.
	 */
	public static function register_secondary_subset_greek() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_secondary_subset_greek', 'typo_secondary', __( 'greek (greek, greek-ext)', 'multimagazine' ) );
	}

	/**
	 * Registers the secondary subset vietnamese setting.
	 */
	public static function register_secondary_subset_vietnamese() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_secondary_subset_vietnamese', 'typo_secondary', __( 'vietnamese (vietnamese )', 'multimagazine' ) );
	}

	/**
	 * Registers the secondary subset cyryllic setting.
	 */
	public static function register_secondary_subset_cyryllic() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_secondary_subset_cyryllic', 'typo_secondary', __( 'cyrillic (cyrillic, cyrillic-ext)', 'multimagazine' ) );
	}

	/**
	 * Adds the secondary font weights heading.
	 */
	public static function register_secondary_font_weights_heading() {
		multimagazine_add_heading( 'multi_secondary_font_weights', 'typo_secondary', __( 'Available weights', 'multimagazine' ), 4 );
	}

	/**
	 * Registers the secondary font weight 300 setting.
	 */
	public static function register_secondary_font_weight_300() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_secondary_font_weight_300', 'typo_secondary', __( 'Light', 'multimagazine' ) );
	}

	/**
	 * Registers the secondary font weight 400 setting.
	 */
	public static function register_secondary_font_weight_400() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_secondary_font_weight_400', 'typo_secondary', __( 'Normal', 'multimagazine' ) );
	}

	/**
	 * Registers the secondary font weight 600 setting.
	 */
	public static function register_secondary_font_weight_600() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_secondary_font_weight_600', 'typo_secondary', __( 'Semibold', 'multimagazine' ) );
	}

	/**
	 * Registers the secondary font weight 700 setting.
	 */
	public static function register_secondary_font_weight_700() {
		global $multimagazine_customize;
		$multimagazine_customize->checkbox_setting( 'multi_secondary_font_weight_700', 'typo_secondary', __( 'Bold', 'multimagazine' ) );
	}

	/* Font size section */

	/**
	 * Registers the body font size setting.
	 */
	public static function register_body_font_size() {
		multimagazine_register_range_setting( 'typo_font_size', 'multi_body_font_size', __( 'Body font size', 'multimagazine' ), MULTIMAGAZINE_BODY_FONT_SIZE, 10, 30, __( 'Number of pixels.', 'multimagazine' ), 1, 'postMessage' );
	}

	/**
	 * Registers the body letter spacing setting.
	 */
	public static function register_body_letter_spacing() {
		global $multimagazine_customize;
		$multimagazine_customize->text_setting( 'multi_body_letter_spacing', 'typo_font_size', __( 'Body letter spacing', 'multimagazine' ), __( 'Number of pixels. Default is 0.', 'multimagazine' ) );
	}

	/**
	 * Registers the body line height setting.
	 */
	public static function register_body_line_height() {
		global $multimagazine_customize;
		$multimagazine_customize->number_setting( 'multi_body_line_height', 'typo_font_size', __( 'Body line height', 'multimagazine' ), '' );
	}

	/**
	 * Registers the body line height unit setting.
	 */
	public static function register_body_line_height_unit() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting(
			'multi_body_line_height_unit',
			'typo_font_size',
			array(
				'px' => __( 'px', 'multimagazine' ),
				'em' => __( 'em', 'multimagazine' ),
				'%'  => __( '%', 'multimagazine' ),
				''   => __( 'none', 'multimagazine' ),
			),
			__( 'Body line height unit', 'multimagazine' )
		);
	}

	/**
	 * Registers the body font weight setting.
	 */
	public static function register_body_font_weight() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting(
			'multi_body_font_weight',
			'typo_font_size',
			self::font_weight_choices(),
			__( 'Body font weight', 'multimagazine' ),
			'',
			'postMessage'
		);
	}

	/**
	 * Registers the post content font size setting.
	 */
	public static function register_post_content_font_size() {
		multimagazine_register_range_setting( 'typo_font_size', 'multi_post_content_font_size', __( 'Post content font size', 'multimagazine' ), MULTIMAGAZINE_POST_CONTENT_FONT_SIZE, 10, 30, __( 'Number of pixels.', 'multimagazine' ), 1, 'postMessage' );
	}

	/**
	 * Registers the post content line height setting.
	 */
	public static function register_post_content_line_height() {
		global $multimagazine_customize;
		$multimagazine_customize->number_setting( 'multi_post_content_line_height', 'typo_font_size', __( 'Post content line height', 'multimagazine' ), '' );
	}

	/**
	 * Registers the post content line height unit setting.
	 */
	public static function register_post_content_line_height_unit() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting(
			'multi_post_content_line_height_unit',
			'typo_font_size',
			array(
				'px' => __( 'px', 'multimagazine' ),
				'em' => __( 'em', 'multimagazine' ),
				'%'  => __( '%', 'multimagazine' ),
				''   => __( 'none', 'multimagazine' ),
			),
			__( 'Post content line height unit', 'multimagazine' )
		);
	}

	/**
	 * Registers the submenu font size setting.
	 */
	public static function register_submenu_font_size() {
		multimagazine_register_range_setting( 'typo_font_size', 'multi_submenu_font_size', __( 'Drop-down menu font size', 'multimagazine' ), MULTIMAGAZINE_SUBMENU_FONT_SIZE, 10, 30, __( 'Number of pixels.', 'multimagazine' ), 1, 'postMessage' );
	}

	/* Header menu section */

	/**
	 * Registers the header menu font setting.
	 */
	public static function register_header_menu_font() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting(
			'multi_header_menu_font',
			'typo_header_menu',
			self::font_choices(),
			__( 'Header menu font', 'multimagazine' ),
			'',
			'postMessage'
		);
	}

	/**
	 * Registers the header menu font weight setting.
	 */
	public static function register_header_menu_font_weight() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting(
			'multi_header_menu_font_weight',
			'typo_header_menu',
			self::font_weight_choices(),
			__( 'Header menu font weight', 'multimagazine' ),
			'',
			'postMessage'
		);
	}

	/**
	 * Registers the header menu font size setting.
	 */
	public static function register_header_menu_font_size() {
		multimagazine_register_range_setting( 'typo_header_menu', 'multi_header_menu_font_size', __( 'Header menu font size', 'multimagazine' ), MULTIMAGAZINE_HEADER_MENU_FONT_SIZE, 10, 30, __( 'Number of pixels.', 'multimagazine' ), 1, 'postMessage' );
	}

	/* Headings section */

	/**
	 * Registers the h1 font setting.
	 */
	public static function register_h1_font() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting( 'multi_h1_font', 'typo_headings', self::font_choices(), __( 'H1 font', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the h1 font size setting.
	 */
	public static function register_h1_font_size() {
		multimagazine_register_range_setting( 'typo_headings', 'multi_h1_font_size', __( 'Default H1 font size', 'multimagazine' ), MULTIMAGAZINE_H1_FONT_SIZE, 10, 70, __( 'Number of pixels.', 'multimagazine' ), 1, 'postMessage' );
	}

	/**
	 * Registers the h2 font setting.
	 */
	public static function register_h2_font() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting( 'multi_h2_font', 'typo_headings', self::font_choices(), __( 'H2 font', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the h2 font size setting.
	 */
	public static function register_h2_font_size() {
		multimagazine_register_range_setting( 'typo_headings', 'multi_h2_font_size', __( 'Default H2 font size', 'multimagazine' ), MULTIMAGAZINE_H2_FONT_SIZE, 10, 70, __( 'Number of pixels.', 'multimagazine' ), 1, 'postMessage' );
	}

	/**
	 * Registers the h3 font setting.
	 */
	public static function register_h3_font() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting( 'multi_h3_font', 'typo_headings', self::font_choices(), __( 'H3 font', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the h3 font size setting.
	 */
	public static function register_h3_font_size() {
		multimagazine_register_range_setting( 'typo_headings', 'multi_h3_font_size', __( 'Default H3 font size', 'multimagazine' ), MULTIMAGAZINE_H3_FONT_SIZE, 10, 70, __( 'Number of pixels.', 'multimagazine' ), 1, 'postMessage' );
	}

	/**
	 * Registers the h4 font setting.
	 */
	public static function register_h4_font() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting( 'multi_h4_font', 'typo_headings', self::font_choices(), __( 'H4 font', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the h4 font size setting.
	 */
	public static function register_h4_font_size() {
		multimagazine_register_range_setting( 'typo_headings', 'multi_h4_font_size', __( 'Default H4 font size', 'multimagazine' ), MULTIMAGAZINE_H4_FONT_SIZE, 10, 70, __( 'Number of pixels.', 'multimagazine' ), 1, 'postMessage' );
	}

	/**
	 * Registers the h5 font setting.
	 */
	public static function register_h5_font() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting( 'multi_h5_font', 'typo_headings', self::font_choices(), __( 'H5 font', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the h5 font size setting.
	 */
	public static function register_h5_font_size() {
		multimagazine_register_range_setting( 'typo_headings', 'multi_h5_font_size', __( 'Default H5 font size', 'multimagazine' ), MULTIMAGAZINE_H5_FONT_SIZE, 10, 70, __( 'Number of pixels.', 'multimagazine' ), 1, 'postMessage' );
	}

	/**
	 * Registers the h6 font setting.
	 */
	public static function register_h6_font() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting( 'multi_h6_font', 'typo_headings', self::font_choices(), __( 'H6 font', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the h6 font size setting.
	 */
	public static function register_h6_font_size() {
		multimagazine_register_range_setting( 'typo_headings', 'multi_h6_font_size', __( 'Default H6 font size', 'multimagazine' ), MULTIMAGAZINE_H6_FONT_SIZE, 10, 70, __( 'Number of pixels.', 'multimagazine' ), 1, 'postMessage' );
	}

	/**
	 * Registers the headings font weight setting.
	 */
	public static function register_headings_font_weight() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting(
			'multi_headings_font_weight',
			'typo_headings',
			self::font_weight_choices(),
			__( 'Heading font weight', 'multimagazine' ),
			__( 'Does not apply to special headings', 'multimagazine' ),
			'postMessage'
		);
	}

	/**
	 * Registers the special headings font setting.
	 */
	public static function register_special_headings_font() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting( 'multi_special_headings_font', 'typo_headings', self::font_choices(), __( 'Special headings font', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the special headings font size setting.
	 */
	public static function register_special_headings_font_size() {
		multimagazine_register_range_setting( 'typo_headings', 'multi_special_headings_font_size', __( 'Special headings font size', 'multimagazine' ), MULTIMAGAZINE_SPECIAL_HEADINGS_FONT_SIZE, 10, 30, __( 'Number of pixels.', 'multimagazine' ), 1, 'postMessage' );
	}

	/* Other section */

	/**
	 * Registers the font display setting.
	 */
	public static function register_font_display() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting(
			'multi_font_display',
			'typo_other',
			array(
				'swap'  => __( 'Swap', 'multimagazine' ),
				'block' => __( 'Block', 'multimagazine' ),
			),
			__( 'Font display', 'multimagazine' )
		);
	}

	/**
	 * Registers the blockquote font size setting.
	 */
	public static function register_blockquote_font_size() {
		multimagazine_register_range_setting( 'typo_other', 'multi_blockquote_font_size', __( 'Default blockquote font size', 'multimagazine' ), MULTIMAGAZINE_BLOCKQUOTE_FONT_SIZE, 10, 30, __( 'Number of pixels.', 'multimagazine' ), 1, 'postMessage' );
	}

	/**
	 * Registers the widget title font setting.
	 */
	public static function register_widget_title_font() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting( 'multi_widget_title_font', 'typo_other', self::font_choices(), __( 'Widget title font', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the widget title font size setting.
	 */
	public static function register_widget_title_font_size() {
		multimagazine_register_range_setting( 'typo_other', 'multi_widget_title_font_size', __( 'Widget title font size', 'multimagazine' ), MULTIMAGAZINE_WIDGET_TITLE_FONT_SIZE, 10, 30, __( 'Number of pixels.', 'multimagazine' ), 1, 'postMessage' );
	}

	/**
	 * Registers the widget text font size setting.
	 */
	public static function register_widget_text_font_size() {
		multimagazine_register_range_setting( 'typo_other', 'multi_widget_text_font_size', __( 'Widget text font size', 'multimagazine' ), MULTIMAGAZINE_WIDGET_TEXT_FONT_SIZE, 10, 30, __( 'Number of pixels.', 'multimagazine' ), 1, 'postMessage' );
	}

	/**
	 * Registers the button font setting.
	 */
	public static function register_button_font() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting( 'multi_button_font', 'typo_other', self::font_choices(), __( 'Button font', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the quote font setting.
	 */
	public static function register_quote_font() {
		global $multimagazine_customize;
		$multimagazine_customize->select_setting( 'multi_quote_font', 'typo_other', self::font_choices(), __( 'Blockquote', 'multimagazine' ), '', 'postMessage' );
	}

	/**
	 * Registers the related post title font size setting.
	 */
	public static function register_related_post_title_font_size() {
		multimagazine_register_range_setting( 'typo_other', 'multi_related_post_title_font_size', __( 'Latest/related/featured post title font size', 'multimagazine' ), MULTIMAGAZINE_RELATED_POST_TITLE_FONT_SIZE, 10, 30, __( 'Number of pixels.', 'multimagazine' ), 1, 'postMessage' );
	}

	/* Footer section */

	/**
	 * Registers the footer menu font size setting.
	 */
	public static function register_footer_menu_font_size() {
		multimagazine_register_range_setting( 'typo_footer', 'multi_footer_menu_font_size', __( 'Footer menu font size', 'multimagazine' ), MULTIMAGAZINE_FOOTER_MENU_FONT_SIZE, 10, 30, __( 'Number of pixels.', 'multimagazine' ), 1, 'postMessage' );
	}

	/**
	 * Registers the footer content font size setting.
	 */
	public static function register_footer_content_font_size() {
		multimagazine_register_range_setting( 'typo_footer', 'multi_footer_content_font_size', __( 'Footer content font size', 'multimagazine' ), MULTIMAGAZINE_FOOTER_CONTENT_FONT_SIZE, 10, 30, __( 'Number of pixels.', 'multimagazine' ), 1, 'postMessage' );
	}
}

add_action( 'customize_register', array( 'Multimagazine_Customize_Typography', 'register_section' ) );
/* typo_primary */
add_action( 'multimagazine_customize_typo_primary', array( 'Multimagazine_Customize_Typography', 'register_primary_font' ), 10 );
add_action( 'multimagazine_customize_typo_primary', array( 'Multimagazine_Customize_Typography', 'register_primary_google_font' ), 15 );
/* Priority 20 is reserved for Pro to inject the Typekit project ID field via multi_customize_typo_primary. */
add_action( 'multimagazine_customize_typo_primary', array( 'Multimagazine_Customize_Typography', 'register_primary_font_subsetting_heading' ), 25 );
add_action( 'multimagazine_customize_typo_primary', array( 'Multimagazine_Customize_Typography', 'register_primary_subset_latin' ), 30 );
add_action( 'multimagazine_customize_typo_primary', array( 'Multimagazine_Customize_Typography', 'register_primary_subset_greek' ), 35 );
add_action( 'multimagazine_customize_typo_primary', array( 'Multimagazine_Customize_Typography', 'register_primary_subset_vietnamese' ), 40 );
add_action( 'multimagazine_customize_typo_primary', array( 'Multimagazine_Customize_Typography', 'register_primary_subset_cyryllic' ), 45 );
add_action( 'multimagazine_customize_typo_primary', array( 'Multimagazine_Customize_Typography', 'register_primary_font_weights_heading' ), 50 );
add_action( 'multimagazine_customize_typo_primary', array( 'Multimagazine_Customize_Typography', 'register_primary_font_weight_300' ), 55 );
add_action( 'multimagazine_customize_typo_primary', array( 'Multimagazine_Customize_Typography', 'register_primary_font_weight_400' ), 60 );
add_action( 'multimagazine_customize_typo_primary', array( 'Multimagazine_Customize_Typography', 'register_primary_font_weight_600' ), 65 );
add_action( 'multimagazine_customize_typo_primary', array( 'Multimagazine_Customize_Typography', 'register_primary_font_weight_700' ), 70 );
/* typo_secondary */
add_action( 'multimagazine_customize_typo_secondary', array( 'Multimagazine_Customize_Typography', 'register_secondary_font' ), 10 );
add_action( 'multimagazine_customize_typo_secondary', array( 'Multimagazine_Customize_Typography', 'register_secondary_google_font' ), 15 );
/* Priority 20 is reserved for Pro to inject the Typekit project ID field via multi_customize_typo_secondary. */
add_action( 'multimagazine_customize_typo_secondary', array( 'Multimagazine_Customize_Typography', 'register_secondary_font_subsetting_heading' ), 25 );
add_action( 'multimagazine_customize_typo_secondary', array( 'Multimagazine_Customize_Typography', 'register_secondary_subset_latin' ), 30 );
add_action( 'multimagazine_customize_typo_secondary', array( 'Multimagazine_Customize_Typography', 'register_secondary_subset_greek' ), 35 );
add_action( 'multimagazine_customize_typo_secondary', array( 'Multimagazine_Customize_Typography', 'register_secondary_subset_vietnamese' ), 40 );
add_action( 'multimagazine_customize_typo_secondary', array( 'Multimagazine_Customize_Typography', 'register_secondary_subset_cyryllic' ), 45 );
add_action( 'multimagazine_customize_typo_secondary', array( 'Multimagazine_Customize_Typography', 'register_secondary_font_weights_heading' ), 50 );
add_action( 'multimagazine_customize_typo_secondary', array( 'Multimagazine_Customize_Typography', 'register_secondary_font_weight_300' ), 55 );
add_action( 'multimagazine_customize_typo_secondary', array( 'Multimagazine_Customize_Typography', 'register_secondary_font_weight_400' ), 60 );
add_action( 'multimagazine_customize_typo_secondary', array( 'Multimagazine_Customize_Typography', 'register_secondary_font_weight_600' ), 65 );
add_action( 'multimagazine_customize_typo_secondary', array( 'Multimagazine_Customize_Typography', 'register_secondary_font_weight_700' ), 70 );
/* typo_font_size */
add_action( 'multimagazine_customize_typo_font_size', array( 'Multimagazine_Customize_Typography', 'register_body_font_size' ), 10 );
add_action( 'multimagazine_customize_typo_font_size', array( 'Multimagazine_Customize_Typography', 'register_body_letter_spacing' ), 15 );
add_action( 'multimagazine_customize_typo_font_size', array( 'Multimagazine_Customize_Typography', 'register_body_line_height' ), 20 );
add_action( 'multimagazine_customize_typo_font_size', array( 'Multimagazine_Customize_Typography', 'register_body_line_height_unit' ), 25 );
add_action( 'multimagazine_customize_typo_font_size', array( 'Multimagazine_Customize_Typography', 'register_body_font_weight' ), 30 );
add_action( 'multimagazine_customize_typo_font_size', array( 'Multimagazine_Customize_Typography', 'register_post_content_font_size' ), 35 );
add_action( 'multimagazine_customize_typo_font_size', array( 'Multimagazine_Customize_Typography', 'register_post_content_line_height' ), 40 );
add_action( 'multimagazine_customize_typo_font_size', array( 'Multimagazine_Customize_Typography', 'register_post_content_line_height_unit' ), 45 );
add_action( 'multimagazine_customize_typo_font_size', array( 'Multimagazine_Customize_Typography', 'register_submenu_font_size' ), 50 );
/* typo_header_menu */
add_action( 'multimagazine_customize_typo_header_menu', array( 'Multimagazine_Customize_Typography', 'register_header_menu_font' ), 10 );
add_action( 'multimagazine_customize_typo_header_menu', array( 'Multimagazine_Customize_Typography', 'register_header_menu_font_weight' ), 15 );
add_action( 'multimagazine_customize_typo_header_menu', array( 'Multimagazine_Customize_Typography', 'register_header_menu_font_size' ), 20 );
/* typo_headings */
add_action( 'multimagazine_customize_typo_headings', array( 'Multimagazine_Customize_Typography', 'register_h1_font' ), 10 );
add_action( 'multimagazine_customize_typo_headings', array( 'Multimagazine_Customize_Typography', 'register_h1_font_size' ), 15 );
add_action( 'multimagazine_customize_typo_headings', array( 'Multimagazine_Customize_Typography', 'register_h2_font' ), 20 );
add_action( 'multimagazine_customize_typo_headings', array( 'Multimagazine_Customize_Typography', 'register_h2_font_size' ), 25 );
add_action( 'multimagazine_customize_typo_headings', array( 'Multimagazine_Customize_Typography', 'register_h3_font' ), 30 );
add_action( 'multimagazine_customize_typo_headings', array( 'Multimagazine_Customize_Typography', 'register_h3_font_size' ), 35 );
add_action( 'multimagazine_customize_typo_headings', array( 'Multimagazine_Customize_Typography', 'register_h4_font' ), 40 );
add_action( 'multimagazine_customize_typo_headings', array( 'Multimagazine_Customize_Typography', 'register_h4_font_size' ), 45 );
add_action( 'multimagazine_customize_typo_headings', array( 'Multimagazine_Customize_Typography', 'register_h5_font' ), 50 );
add_action( 'multimagazine_customize_typo_headings', array( 'Multimagazine_Customize_Typography', 'register_h5_font_size' ), 55 );
add_action( 'multimagazine_customize_typo_headings', array( 'Multimagazine_Customize_Typography', 'register_h6_font' ), 60 );
add_action( 'multimagazine_customize_typo_headings', array( 'Multimagazine_Customize_Typography', 'register_h6_font_size' ), 65 );
add_action( 'multimagazine_customize_typo_headings', array( 'Multimagazine_Customize_Typography', 'register_headings_font_weight' ), 70 );
add_action( 'multimagazine_customize_typo_headings', array( 'Multimagazine_Customize_Typography', 'register_special_headings_font' ), 75 );
add_action( 'multimagazine_customize_typo_headings', array( 'Multimagazine_Customize_Typography', 'register_special_headings_font_size' ), 80 );
/* typo_other */
add_action( 'multimagazine_customize_typo_other', array( 'Multimagazine_Customize_Typography', 'register_font_display' ), 10 );
add_action( 'multimagazine_customize_typo_other', array( 'Multimagazine_Customize_Typography', 'register_blockquote_font_size' ), 15 );
add_action( 'multimagazine_customize_typo_other', array( 'Multimagazine_Customize_Typography', 'register_widget_title_font' ), 20 );
add_action( 'multimagazine_customize_typo_other', array( 'Multimagazine_Customize_Typography', 'register_widget_title_font_size' ), 25 );
add_action( 'multimagazine_customize_typo_other', array( 'Multimagazine_Customize_Typography', 'register_widget_text_font_size' ), 30 );
add_action( 'multimagazine_customize_typo_other', array( 'Multimagazine_Customize_Typography', 'register_button_font' ), 35 );
add_action( 'multimagazine_customize_typo_other', array( 'Multimagazine_Customize_Typography', 'register_quote_font' ), 40 );
add_action( 'multimagazine_customize_typo_other', array( 'Multimagazine_Customize_Typography', 'register_related_post_title_font_size' ), 45 );
/* typo_footer */
add_action( 'multimagazine_customize_typo_footer', array( 'Multimagazine_Customize_Typography', 'register_footer_menu_font_size' ), 10 );
add_action( 'multimagazine_customize_typo_footer', array( 'Multimagazine_Customize_Typography', 'register_footer_content_font_size' ), 15 );
