Skip to content

Commit

Permalink
remove font-style validation
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Dec 8, 2021
1 parent 24afc2f commit 7ad9c91
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
6 changes: 0 additions & 6 deletions lib/class-wp-webfonts.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,6 @@ public function validate_font( $font ) {
}
}

// Check the font-style.
$valid_font_styles = array( 'normal', 'italic', 'oblique', 'inherit', 'initial', 'revert', 'unset' );
if ( ! in_array( $font['font-style'], $valid_font_styles, true ) && ! preg_match( '/^oblique\s+(\d+)%/', $font['font-style'] ) ) {
return false;
}

// Check the font-weight.
if ( ! is_string( $font['font-weight'] ) && ! is_int( $font['font-weight'] ) ) {
trigger_error( __( 'Webfont font weight must be a properly formatted string or integer.', 'gutenberg' ) );
Expand Down
7 changes: 0 additions & 7 deletions phpunit/class-wp-webfonts-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,6 @@ public function test_validate_font() {
$font['src'] = '//example.com/SourceSerif4Variable-Roman.ttf.woff2';
$this->assertEquals( wp_webfonts()->validate_font( $font )['src'], $font['src'] );


// Test font-style.
$font['font-style'] = 'invalid';
$this->assertFalse( wp_webfonts()->validate_font( $font ) );
$font['font-style'] = 'italic';
$this->assertNotEmpty( wp_webfonts()->validate_font( $font ) );

// Test font-weight.
$font_weights = array( 100, '100', '100 900', 'normal' );
foreach ( $font_weights as $value ) {
Expand Down

0 comments on commit 7ad9c91

Please sign in to comment.