Skip to content

Instantly share code, notes, and snippets.

@mako09
Last active November 17, 2018 12:24
Show Gist options
  • Save mako09/bf919903b7e4476279e77d2d0c2d9099 to your computer and use it in GitHub Desktop.
Save mako09/bf919903b7e4476279e77d2d0c2d9099 to your computer and use it in GitHub Desktop.
twentynineteen の非ラテン言語パッチの素の素
diff --git a/sass/blocks/_blocks.scss b/sass/blocks/_blocks.scss
index 9522daa..15d2268 100644
--- a/sass/blocks/_blocks.scss
+++ b/sass/blocks/_blocks.scss
@@ -186,6 +186,12 @@
outline-offset: -4px;
}
}
+ // non-latin
+ @each $lang, $ff_heading in $fonts__heading {
+ .wp-block-button__link:lang(#{$lang}) {
+ font-family: $ff_heading;
+ }
+ }
&:not(.is-style-squared) .wp-block-button__link {
border-radius: 5px;
@@ -230,6 +236,12 @@
text-decoration: none;
}
}
+ // non-latin
+ @each $lang, $ff_heading in $fonts__heading {
+ li:lang(#{$lang}) {
+ font-family: $ff_heading;
+ }
+ }
}
//! Latest categories
@@ -280,6 +292,12 @@
font-size: $font__size_base;
line-height: 1.8;
}
+ // non-latin
+ @each $lang, $ff_body in $fonts__body {
+ .wp-block-verse:lang(#{$lang}) {
+ font-family: unquote($ff_body);
+ }
+ }
//! Paragraphs
.has-drop-cap {
@@ -290,6 +308,12 @@
font-weight: bold;
margin: 0 0.25em 0 0;
}
+ // non-latin
+ @each $lang, $ff_heading in $fonts__heading {
+ &:not(:focus):first-letter:lang(#{$lang}) {
+ font-family: $ff_heading;
+ }
+ }
}
//! Pullquote
@@ -334,6 +358,12 @@
*/
font-size: calc(1rem / (1.25 * #{$font__size-ratio}));
}
+ // non-latin
+ @each $lang, $ff_heading in $fonts__heading {
+ cite:lang(#{$lang}) {
+ font-family: $ff_heading;
+ }
+ }
&.alignleft,
&.alignright {
@@ -507,6 +537,14 @@
max-width: 100%;
}
}
+ // non-latin
+ @each $lang, $ff_heading in $fonts__heading {
+ .wp-block-cover-image-text:lang(#{$lang}),
+ .wp-block-cover-text:lang(#{$lang}),
+ h2:lang(#{$lang}) {
+ font-family: $ff_heading;
+ }
+ }
&.aligncenter {
h2,
@@ -571,6 +609,16 @@
padding: ( $size__spacing-unit * .5 );
text-align: center;
}
+ // non-latin
+ @each $lang, $ff_heading in $fonts__heading {
+ .wp-block-audio figcaption:lang(#{$lang}),
+ .wp-block-video figcaption:lang(#{$lang}),
+ .wp-block-image figcaption:lang(#{$lang}),
+ .wp-block-gallery .blocks-gallery-image figcaption:lang(#{$lang}),
+ .wp-block-gallery .blocks-gallery-item figcaption:lang(#{$lang}) {
+ font-family: $ff_heading;
+ }
+ }
//! Separator
.wp-block-separator,
@@ -666,6 +714,12 @@
}
}
}
+ // non-latin
+ @each $lang, $ff_heading in $fonts__heading {
+ .wp-block-file:lang(#{$lang}) {
+ font-family: $ff_heading;
+ }
+ }
//! Code
.wp-block-code {
@@ -714,6 +768,12 @@
font-weight: normal;
}
}
+ // non-latin
+ @each $lang, $ff_heading in $fonts__heading {
+ .wp-block-latest-comments__comment-meta:lang(#{$lang}) {
+ font-family: $ff_heading;
+ }
+ }
.wp-block-latest-comments__comment,
.wp-block-latest-comments__comment-date,
diff --git a/sass/elements/_tables.scss b/sass/elements/_tables.scss
index 89c75a2..bfe5ebb 100644
--- a/sass/elements/_tables.scss
+++ b/sass/elements/_tables.scss
@@ -11,3 +11,9 @@ table {
word-break: break-all;
}
}
+/* non-latin */
+@each $lang, $ff_heading in $fonts__heading {
+ table:lang(#{$lang}) {
+ font-family: $ff_heading;
+ }
+}
\ No newline at end of file
diff --git a/sass/forms/_buttons.scss b/sass/forms/_buttons.scss
index 2530b92..f5cbed2 100644
--- a/sass/forms/_buttons.scss
+++ b/sass/forms/_buttons.scss
@@ -35,3 +35,13 @@ input[type="submit"] {
outline-offset: -4px;
}
}
+/* non-latin */
+@each $lang, $ff_heading in $fonts__heading {
+ .button:lang(#{$lang}),
+ button:lang(#{$lang}),
+ input[type="button"]:lang(#{$lang}),
+ input[type="reset"]:lang(#{$lang}),
+ input[type="submit"]:lang(#{$lang}) {
+ font-family: $ff_heading;
+ }
+}
\ No newline at end of file
diff --git a/sass/media/_captions.scss b/sass/media/_captions.scss
index 4a9c5c7..f27af72 100644
--- a/sass/media/_captions.scss
+++ b/sass/media/_captions.scss
@@ -30,3 +30,9 @@
padding: ( $size__spacing-unit * .5 );
text-align: center;
}
+/* non-latin */
+@each $lang, $ff_heading in $fonts__heading {
+ .wp-caption-text:lang(#{$lang}) {
+ font-family: $ff_heading;
+ }
+}
diff --git a/sass/media/_galleries.scss b/sass/media/_galleries.scss
index 56ca809..640219b 100644
--- a/sass/media/_galleries.scss
+++ b/sass/media/_galleries.scss
@@ -37,6 +37,12 @@
margin: 0;
padding: ( $size__spacing-unit * .5 );
}
+/* non-latin */
+@each $lang, $ff_heading in $fonts__heading {
+ .gallery-caption:lang(#{$lang}) {
+ font-family: $ff_heading;
+ }
+}
.gallery-item > div > a {
display: block;
diff --git a/sass/mixins/_mixins-master.scss b/sass/mixins/_mixins-master.scss
index 5228ff0..da275a5 100644
--- a/sass/mixins/_mixins-master.scss
+++ b/sass/mixins/_mixins-master.scss
@@ -194,6 +194,12 @@
font-family: $font__body;
font-weight: normal;
}
+ // non-latin
+ @each $lang, $ff_body in $fonts__body {
+ ul li > a:before:lang(#{$lang}) {
+ font-family: unquote($ff_body);
+ }
+ }
ul > li > a:before {
content: "\2013\00a0";
}
diff --git a/sass/navigation/_menu-main-navigation.scss b/sass/navigation/_menu-main-navigation.scss
index 242747f..8f45078 100644
--- a/sass/navigation/_menu-main-navigation.scss
+++ b/sass/navigation/_menu-main-navigation.scss
@@ -272,6 +272,12 @@
font-family: $font__body;
font-weight: normal;
}
+ // non-latin
+ @each $lang, $ff_body in $fonts__body {
+ .sub-menu li > a:before:lang(#{$lang}) {
+ font-family: unquote($ff_body);
+ }
+ }
.sub-menu > li > a:before {
content: "\2013\00a0";
}
@@ -369,6 +375,12 @@
font-family: $font__body;
font-weight: normal;
}
+ // non-latin
+ @each $lang, $ff_body in $fonts__body {
+ .sub-menu li > a:before:lang(#{$lang}) {
+ font-family: unquote($ff_body);
+ }
+ }
.sub-menu > li > a:before {
content: "\2013\00a0";
}
diff --git a/sass/navigation/_next-previous.scss b/sass/navigation/_next-previous.scss
index 28a164d..b50178a 100644
--- a/sass/navigation/_next-previous.scss
+++ b/sass/navigation/_next-previous.scss
@@ -194,6 +194,13 @@
top: -1px;
}
}
+ // non-latin
+ @each $lang, $ff_heading in $fonts__heading {
+ .nav-previous:lang(#{$lang}),
+ .nav-next:lang(#{$lang}) {
+ font-family: $ff_heading;
+ }
+ }
.nav-next {
text-align: right;
diff --git a/sass/site/primary/_comments.scss b/sass/site/primary/_comments.scss
index 03fc4d3..75376d7 100644
--- a/sass/site/primary/_comments.scss
+++ b/sass/site/primary/_comments.scss
@@ -146,6 +146,18 @@
font-family: $font__heading;
font-weight: 500;
}
+ // non-latin
+ @each $lang, $ff_heading in $fonts__heading {
+ .comment-edit-link:lang(#{$lang}) {
+ font-family: $ff_heading;
+ }
+ }
+ }
+ // non-latin
+ @each $lang, $ff_heading in $fonts__heading {
+ .comment-body:lang(#{$lang}) {
+ font-family: $ff_heading;
+ }
}
}
}
@@ -376,6 +388,13 @@
font-size: $font__size-xs;
color: $color__text-light;
}
+ // non-latin
+ @each $lang, $ff_heading in $fonts__heading {
+ .comment-notes:lang(#{$lang}),
+ label:lang(#{$lang}) {
+ font-family: $ff_heading;
+ }
+ }
.comment-form-author,
.comment-form-email {
diff --git a/sass/site/secondary/_widgets.scss b/sass/site/secondary/_widgets.scss
index 6edc3c2..d06e6d8 100644
--- a/sass/site/secondary/_widgets.scss
+++ b/sass/site/secondary/_widgets.scss
@@ -37,6 +37,12 @@
margin-top: #{0.5 * $size__spacing-unit};
margin-bottom: #{0.5 * $size__spacing-unit};
}
+ // non-latin
+ @each $lang, $ff_heading in $fonts__heading {
+ li:lang(#{$lang}) {
+ font-family: $ff_heading;
+ }
+ }
@include nestedSubMenuPadding();
}
@@ -48,6 +54,12 @@
font-family: $font__heading;
font-weight: 700;
}
+ // non-latin
+ @each $lang, $ff_heading in $fonts__heading {
+ .tagcloud:lang(#{$lang}) {
+ font-family: $ff_heading;
+ }
+ }
}
diff --git a/sass/typography/_copy.scss b/sass/typography/_copy.scss
index 10b9d8c..de0b4ac 100644
--- a/sass/typography/_copy.scss
+++ b/sass/typography/_copy.scss
@@ -17,6 +17,12 @@ blockquote {
font-style: normal;
font-family: $font__heading;
}
+ // non-latin
+ @each $lang, $ff_heading in $fonts__heading {
+ cite:lang(#{$lang}) {
+ font-family: $ff_heading;
+ }
+ }
}
pre {
diff --git a/sass/typography/_headings.scss b/sass/typography/_headings.scss
index 620e117..da59ab3 100644
--- a/sass/typography/_headings.scss
+++ b/sass/typography/_headings.scss
@@ -27,6 +27,38 @@ h5,
h6 {
font-family: $font__heading;
}
+// non-latin
+@each $lang, $ff_heading in $fonts__heading {
+ .author-description .author-link:lang(#{$lang}),
+ .comment-metadata:lang(#{$lang}),
+ .comment-reply-link:lang(#{$lang}),
+ .comments-title:lang(#{$lang}),
+ .comment-author .fn:lang(#{$lang}),
+ .discussion-meta-info:lang(#{$lang}),
+ .entry-meta:lang(#{$lang}),
+ .entry-footer:lang(#{$lang}),
+ .main-navigation:lang(#{$lang}),
+ .no-comments:lang(#{$lang}),
+ .not-found .page-title:lang(#{$lang}),
+ .error-404 .page-title:lang(#{$lang}),
+ .post-navigation .post-title:lang(#{$lang}),
+ .page-links:lang(#{$lang}),
+ .page-description:lang(#{$lang}),
+ .pagination .nav-links:lang(#{$lang}),
+ .sticky-post:lang(#{$lang}),
+ .site-title:lang(#{$lang}),
+ .site-info:lang(#{$lang}),
+ #cancel-comment-reply-link:lang(#{$lang}),
+ img:after:lang(#{$lang}),
+ h1:lang(#{$lang}),
+ h2:lang(#{$lang}),
+ h3:lang(#{$lang}),
+ h4:lang(#{$lang}),
+ h5:lang(#{$lang}),
+ h6:lang(#{$lang}) {
+ font-family: $ff_heading;
+ }
+}
.main-navigation,
.page-description,
@@ -55,6 +87,12 @@ h6 {
.page-title {
font-family: $font__body;
}
+// non-latin
+@each $lang, $ff_body in $fonts__body {
+ .page-title:lang(#{$lang}) {
+ font-family: unquote($ff_body);
+ }
+}
.site-branding,
.main-navigation ul.main-menu > li,
diff --git a/sass/typography/_typography.scss b/sass/typography/_typography.scss
index 9763628..3c93444 100644
--- a/sass/typography/_typography.scss
+++ b/sass/typography/_typography.scss
@@ -14,6 +14,12 @@ body {
margin: 0;
text-rendering: optimizeLegibility;
}
+/* non-latin */
+@each $lang, $ff_body in $fonts__body {
+ body:lang(#{$lang}) {
+ font-family: unquote($ff_body);
+ }
+}
button,
input,
@@ -26,9 +32,17 @@ textarea {
line-height: $font__line-height-body;
text-rendering: optimizeLegibility;
}
+/* non-latin */
+@each $lang, $ff_body in $fonts__body {
+ button:lang(#{$lang}),
+ input:lang(#{$lang}),
+ select:lang(#{$lang}),
+ optgroup:lang(#{$lang}),
+ textarea:lang(#{$lang}) {
+ font-family: unquote($ff_body);
+ }
+}
@import "headings";
@import "copy";
-
-@include non-latin-fonts();
diff --git a/sass/variables-site/_fonts.scss b/sass/variables-site/_fonts.scss
index 3d671a3..5ef3e29 100644
--- a/sass/variables-site/_fonts.scss
+++ b/sass/variables-site/_fonts.scss
@@ -15,7 +15,19 @@
// Font and typographic variables
$font__body: "NonBreakingSpaceOverride", "Hoefler Text", "Baskerville Old Face", Garamond, "Times New Roman", serif;
+$fonts__body: (
+ja: '"Noto Serif CJK JP", serif',
+zh-cmn-Hant-HK: '"Noto Serif CJK TC", serif',
+zh-cmn-Hant-TW: '"Noto Serif CJK TC", serif',
+zh-cmn-Hans-CN: '"Noto Serif CJK SC", serif'
+);
$font__heading: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
+$fonts__heading: (
+ja: '"Noto Sans CJK JP", sans-serif',
+zh-cmn-Hant-HK: '"Noto Sans CJK TC", sans-serif',
+zh-cmn-Hant-TW: '"Noto Sans CJK TC", sans-serif',
+zh-cmn-Hans-CN: '"Noto Sans CJK SC", sans-serif'
+);
$font__code: Menlo, monaco, Consolas, Lucida Console, monospace;
$font__pre: "Courier 10 Pitch", Courier, monospace;
diff --git a/style-editor-customizer.scss b/style-editor-customizer.scss
index ac8d9c4..568124a 100644
--- a/style-editor-customizer.scss
+++ b/style-editor-customizer.scss
@@ -5,9 +5,3 @@ NOTE: This file is automatically populated with additional styles if the user se
*/
/** === Includes === */
-
-@import "sass/mixins/mixins-master";
-
-/** === Non-Latin font fallbacks === */
-
-@include non-latin-fonts( '.wp-block' );
\ No newline at end of file

twentynineteen の非ラテン言語パッチの素です。

  • テストなので、言語は ja と zh 3つの、計4つ分しか書いていません。
  • テストなので、中で指定しているフォント名は仮置きです。意味はあまりありません。
  • zh の書き方は変わったという情報が出てきたので、それに合わせました。試していません。
  • 言語の指定は疑似クラス :lang の書式にしました。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment