Twenty Fourteen: Bundle Google Fonts locally.

This changeset bundles the Google Fonts used by Twenty Fourteen locally in the theme folder, instead of loading them from Google servers. Existing font stylesheet handles are maintained for backward compatibilily.

Props garrett-eclipse, kjellr, ocean90, SergeyBiryukov, westonruter, luminuu, audrasjb, jhoffmann, jffng, paapst, cbirdsong, webcommsat, kau-boy, MatthiasReinholz, sabernhardt, hellofromTonya, JeffPaul, davidbaumwald, desrosj, bedas, poena, costdev, mukesh27, azaozz, aristath.
See #55985.

Built from https://develop.svn.wordpress.org/trunk@55270


git-svn-id: http://core.svn.wordpress.org/trunk@54803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2023-02-07 15:59:23 +00:00
parent ebef2f74cb
commit f7b69e3d1f
26 changed files with 312 additions and 30 deletions

View File

@ -0,0 +1,174 @@
/*
Lato
Copyright (c) 2010-2011 by tyPoland Lukasz Dziedzic (team@latofonts.com) with Reserved Font Name "Lato".
Licensed under the SIL Open Font License, Version 1.1.
https://opensource.org/licenses/OFL-1.1
*/
/* lato-latin-ext-300-normal */
@font-face {
font-family: 'Lato';
font-style: normal;
font-display: fallback;
font-weight: 300;
src:
url('./lato/lato-latin-ext-300-normal.woff2?ver=23') format('woff2'),
url('./lato/lato-all-300-normal.woff?ver=23') format('woff');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* lato-latin-300-normal */
@font-face {
font-family: 'Lato';
font-style: normal;
font-display: fallback;
font-weight: 300;
src:
url('./lato/lato-latin-300-normal.woff2?ver=23') format('woff2'),
url('./lato/lato-all-300-normal.woff?ver=23') format('woff');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* lato-latin-ext-300-italic */
@font-face {
font-family: 'Lato';
font-style: italic;
font-display: fallback;
font-weight: 300;
src:
url('./lato/lato-latin-ext-300-italic.woff2?ver=23') format('woff2'),
url('./lato/lato-all-300-italic.woff?ver=23') format('woff');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* lato-latin-300-italic */
@font-face {
font-family: 'Lato';
font-style: italic;
font-display: fallback;
font-weight: 300;
src:
url('./lato/lato-latin-300-italic.woff2?ver=23') format('woff2'),
url('./lato/lato-all-300-italic.woff?ver=23') format('woff');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* lato-latin-ext-400-normal */
@font-face {
font-family: 'Lato';
font-style: normal;
font-display: fallback;
font-weight: 400;
src:
url('./lato/lato-latin-ext-400-normal.woff2?ver=23') format('woff2'),
url('./lato/lato-all-400-normal.woff?ver=23') format('woff');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* lato-latin-400-normal */
@font-face {
font-family: 'Lato';
font-style: normal;
font-display: fallback;
font-weight: 400;
src:
url('./lato/lato-latin-400-normal.woff2?ver=23') format('woff2'),
url('./lato/lato-all-400-normal.woff?ver=23') format('woff');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* lato-latin-ext-400-italic */
@font-face {
font-family: 'Lato';
font-style: italic;
font-display: fallback;
font-weight: 400;
src:
url('./lato/lato-latin-ext-400-italic.woff2?ver=23') format('woff2'),
url('./lato/lato-all-400-italic.woff?ver=23') format('woff');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* lato-latin-400-italic */
@font-face {
font-family: 'Lato';
font-style: italic;
font-display: fallback;
font-weight: 400;
src:
url('./lato/lato-latin-400-italic.woff2?ver=23') format('woff2'),
url('./lato/lato-all-400-italic.woff?ver=23') format('woff');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* lato-latin-ext-700-normal */
@font-face {
font-family: 'Lato';
font-style: normal;
font-display: fallback;
font-weight: 700;
src:
url('./lato/lato-latin-ext-700-normal.woff2?ver=23') format('woff2'),
url('./lato/lato-all-700-normal.woff?ver=23') format('woff');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* lato-latin-700-normal */
@font-face {
font-family: 'Lato';
font-style: normal;
font-display: fallback;
font-weight: 700;
src:
url('./lato/lato-latin-700-normal.woff2?ver=23') format('woff2'),
url('./lato/lato-all-700-normal.woff?ver=23') format('woff');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* lato-latin-ext-700-italic */
@font-face {
font-family: 'Lato';
font-style: italic;
font-display: fallback;
font-weight: 700;
src:
url('./lato/lato-latin-ext-700-italic.woff2?ver=23') format('woff2'),
url('./lato/lato-all-700-italic.woff?ver=23') format('woff');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* lato-latin-700-italic */
@font-face {
font-family: 'Lato';
font-style: italic;
font-display: fallback;
font-weight: 700;
src:
url('./lato/lato-latin-700-italic.woff2?ver=23') format('woff2'),
url('./lato/lato-all-700-italic.woff?ver=23') format('woff');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* lato-latin-ext-900-normal */
@font-face {
font-family: 'Lato';
font-style: normal;
font-display: fallback;
font-weight: 900;
src:
url('./lato/lato-latin-ext-900-normal.woff2?ver=23') format('woff2'),
url('./lato/lato-all-900-normal.woff?ver=23') format('woff');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* lato-latin-900-normal */
@font-face {
font-family: 'Lato';
font-style: normal;
font-display: fallback;
font-weight: 900;
src:
url('./lato/lato-latin-900-normal.woff2?ver=23') format('woff2'),
url('./lato/lato-all-900-normal.woff?ver=23') format('woff');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

View File

@ -0,0 +1,93 @@
Copyright (c) 2010-2011 by tyPoland Lukasz Dziedzic (team@latofonts.com) with Reserved Font Name "Lato".
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

View File

@ -67,8 +67,16 @@ if ( ! function_exists( 'twentyfourteen_setup' ) ) :
*/
load_theme_textdomain( 'twentyfourteen' );
// This theme styles the visual editor to resemble the theme style.
add_editor_style( array( 'css/editor-style.css', twentyfourteen_font_url(), 'genericons/genericons.css' ) );
/*
* This theme styles the visual editor to resemble the theme style.
* When fonts are self-hosted, the theme directory needs to be removed first.
*/
$font_stylesheet = str_replace(
array( get_template_directory_uri() . '/', get_stylesheet_directory_uri() . '/' ),
'',
twentyfourteen_font_url()
);
add_editor_style( array( 'css/editor-style.css', $font_stylesheet, 'genericons/genericons.css' ) );
// Load regular editor styles into the new block-based editor.
add_theme_support( 'editor-styles' );
@ -293,30 +301,28 @@ function twentyfourteen_widgets_init() {
}
add_action( 'widgets_init', 'twentyfourteen_widgets_init' );
/**
* Register Lato Google font for Twenty Fourteen.
*
* @since Twenty Fourteen 1.0
*
* @return string
*/
function twentyfourteen_font_url() {
$font_url = '';
/*
* translators: If there are characters in your language that are not supported
* by Lato, translate this to 'off'. Do not translate into your own language.
if ( ! function_exists( 'twentyfourteen_font_url' ) ) :
/**
* Register Lato font for Twenty Fourteen.
*
* @since Twenty Fourteen 1.0
* @since Twenty Fourteen 3.6 Replaced Google URL with self-hosted fonts.
*
* @return string
*/
if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) ) {
$query_args = array(
'family' => urlencode( 'Lato:300,400,700,900,300italic,400italic,700italic' ),
'subset' => urlencode( 'latin,latin-ext' ),
'display' => urlencode( 'fallback' ),
);
$font_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
}
function twentyfourteen_font_url() {
$font_url = '';
/*
* translators: If there are characters in your language that are not supported
* by Lato, translate this to 'off'. Do not translate into your own language.
*/
if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) ) {
$font_url = get_template_directory_uri() . '/fonts/font-lato.css';
}
return $font_url;
}
return $font_url;
}
endif;
/**
* Enqueue scripts and styles for the front end.
@ -325,7 +331,8 @@ function twentyfourteen_font_url() {
*/
function twentyfourteen_scripts() {
// Add Lato font, used in the main stylesheet.
wp_enqueue_style( 'twentyfourteen-lato', twentyfourteen_font_url(), array(), null );
$font_version = ( 0 === strpos( (string) twentyfourteen_font_url(), get_template_directory_uri() . '/' ) ) ? '20230328' : null;
wp_enqueue_style( 'twentyfourteen-lato', twentyfourteen_font_url(), array(), $font_version );
// Add Genericons font, used in the main stylesheet.
wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.0.3' );
@ -369,12 +376,13 @@ function twentyfourteen_scripts() {
add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' );
/**
* Enqueue Google fonts style to admin screen for custom header display.
* Enqueue font stylesheet to admin screen for custom header display.
*
* @since Twenty Fourteen 1.0
*/
function twentyfourteen_admin_fonts() {
wp_enqueue_style( 'twentyfourteen-lato', twentyfourteen_font_url(), array(), null );
$font_version = ( 0 === strpos( (string) twentyfourteen_font_url(), get_template_directory_uri() . '/' ) ) ? '20230328' : null;
wp_enqueue_style( 'twentyfourteen-lato', twentyfourteen_font_url(), array(), $font_version );
}
add_action( 'admin_print_scripts-appearance_page_custom-header', 'twentyfourteen_admin_fonts' );
@ -382,6 +390,7 @@ add_action( 'admin_print_scripts-appearance_page_custom-header', 'twentyfourteen
* Add preconnect for Google Fonts.
*
* @since Twenty Fourteen 1.9
* @deprecated Twenty Fourteen 3.6 Disabled filter because, by default, fonts are self-hosted.
*
* @param array $urls URLs to print for resource hints.
* @param string $relation_type The relation type the URLs are printed.
@ -401,7 +410,7 @@ function twentyfourteen_resource_hints( $urls, $relation_type ) {
return $urls;
}
add_filter( 'wp_resource_hints', 'twentyfourteen_resource_hints', 10, 2 );
// add_filter( 'wp_resource_hints', 'twentyfourteen_resource_hints', 10, 2 );
/**
* Enqueue styles for the block-based editor.
@ -412,7 +421,8 @@ function twentyfourteen_block_editor_styles() {
// Block styles.
wp_enqueue_style( 'twentyfourteen-block-editor-style', get_template_directory_uri() . '/css/editor-blocks.css', array(), '20210216' );
// Add custom fonts.
wp_enqueue_style( 'twentyfourteen-fonts', twentyfourteen_font_url(), array(), null );
$font_version = ( 0 === strpos( (string) twentyfourteen_font_url(), get_template_directory_uri() . '/' ) ) ? '20230328' : null;
wp_enqueue_style( 'twentyfourteen-fonts', twentyfourteen_font_url(), array(), $font_version );
}
add_action( 'enqueue_block_editor_assets', 'twentyfourteen_block_editor_styles' );

View File

@ -48,6 +48,11 @@ Genericons icon font, Copyright 2013-2017 Automattic.com
License: GNU GPL, Version 2 (or later)
Source: http://www.genericons.com
Lato Font
Copyright (c) 2010-2011 by tyPoland Lukasz Dziedzic (team@latofonts.com) with Reserved Font Name "Lato".
License: SIL Open Font License, 1.1, https://opensource.org/licenses/OFL-1.1
Source: https://fontsource.org/fonts/lato
Photos from Stocksnap, used in block patterns.
License: CC0
Source: https://stocksnap.io/photo/fog-mountain-ZKN6UKFKEO

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.2-alpha-55269';
$wp_version = '6.2-alpha-55270';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.