From 2453278d5677c4b8ab43deb46e52562c8a10bc47 Mon Sep 17 00:00:00 2001 From: Aristeides Stathopoulos Date: Thu, 6 Jul 2017 00:49:46 +0300 Subject: [PATCH] Fixes #1443 --- field/class-kirki-field-typography.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/field/class-kirki-field-typography.php b/field/class-kirki-field-typography.php index 0976a129a..14e6364e0 100644 --- a/field/class-kirki-field-typography.php +++ b/field/class-kirki-field-typography.php @@ -25,6 +25,30 @@ protected function set_type() { } + /** + * Sets the default value. + * + * @access protected + */ + protected function set_default() { + + // Accomodate the use of font-weight and convert to variant. + if ( isset( $this->default['font-weight'] ) ) { + $this->default['variant'] = ( 'regular' === $this->default['font-weight'] ) ? 400 : (string) intval( $this->default['font-weight' ] ); + } + + // Make sure letter-spacing has units. + if ( isset( $this->default['letter-spacing'] ) && is_numeric( $this->default['letter-spacing'] ) && $this->default['letter-spacing'] ) { + $this->default['letter-spacing'] .= 'px'; + } + + // Make sure we use "subsets" instead of "subset". + if ( isset( $this->default['subset'] ) && ! empty( $this->default['subset'] ) && ( ! isset( $this->default['subsets'] ) || empty( $this->default['subsets'] ) ) ) { + $this->default['subsets'] = $this->default['subset']; + } + // var_dump( $this->default ); + } + /** * Sets the $sanitize_callback *