From af637c7a6df3bb5a5d43d767339530640b940e8e Mon Sep 17 00:00:00 2001 From: xiaolai Date: Fri, 9 Dec 2022 00:11:17 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=B8=AD=E8=8B=B1=E6=96=87=E6=B7=B7?= =?UTF-8?q?=E6=8E=92=E4=B9=8B=E6=97=B6=EF=BC=8C=E4=B8=AD=E6=96=87=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B9=8B=E9=97=B4=E6=9C=89=E5=AD=97=E9=97=B4=E8=B7=9D?= =?UTF-8?q?=EF=BC=8C=E8=8B=B1=E6=96=87=E5=AD=97=E7=AC=A6=E4=B9=8B=E9=97=B4?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=AD=97=E9=97=B4=E8=B7=9D=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _site/heti.css | 7 ++++++- lib/_base.scss | 7 +++++++ lib/_variables.scss | 6 ++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/_site/heti.css b/_site/heti.css index d8727b8..f13afed 100644 --- a/_site/heti.css +++ b/_site/heti.css @@ -131,7 +131,7 @@ src: local("Source Han Sans KR Heavy"), local("Noto Sans CJK KR Heavy"); } -font-face { +@font-face { font-family: "Heti Hei SC Black Fallback"; font-weight: 800; src: local("Microsoft YaHei"), local("Droid Sans Fallback"); @@ -204,6 +204,7 @@ font-face { overflow-wrap: break-word; word-wrap: break-word; hyphens: auto; + letter-spacing: 0.02em; } .heti::before, .heti::after { @@ -215,6 +216,10 @@ font-face { clear: both; } +.heti:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)), .heti:not(:lang(zh)) { + letter-spacing: 0; +} + .heti > *:first-child, .heti section > *:first-child, .heti td > *:first-child { diff --git a/lib/_base.scss b/lib/_base.scss index 3fe91d0..ff8e979 100644 --- a/lib/_base.scss +++ b/lib/_base.scss @@ -6,6 +6,13 @@ // 清容器浮动 @include clear-float(); + // 非中文时不加间距 + letter-spacing: $letter-spacing-medium; + @include non-cjk-block { + letter-spacing: $letter-spacing-normal; + + } + // 清容器内首尾元素外边距 &, section, diff --git a/lib/_variables.scss b/lib/_variables.scss index 507d77e..fe086c6 100644 --- a/lib/_variables.scss +++ b/lib/_variables.scss @@ -54,6 +54,12 @@ $line-height-expanded-ultra: 2.25 !default; //$line-height-condensed: 1.25 !default; //$line-height-condensed-ultra: 1 !default; +// 字符间距 +$letter-spacing-normal: 0 !default; +$letter-spacing-small: 0.01em !default; +$letter-spacing-medium: 0.02em !default; +$letter-spacing-large: 0.05em !default; + $line-height-size-normal: $font-size-normal * $line-height-normal !default; $line-height-size-large: $line-height-size-normal !default; $line-height-size-x-large: $font-size-x-large * $line-height-normal !default; From 9e6ac7777c48a3c017389f5240c568fa0eb56473 Mon Sep 17 00:00:00 2001 From: xiaolai Date: Fri, 9 Dec 2022 00:45:42 +0800 Subject: [PATCH 2/2] ugly modification --- _site/heti-addon.js | 6 ++++-- _site/heti.css | 20 ++++++++++++++++---- lib/_base.scss | 26 +++++++++++++++++++------- 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/_site/heti-addon.js b/_site/heti-addon.js index dc7d84c..03d53bf 100644 --- a/_site/heti-addon.js +++ b/_site/heti-addon.js @@ -767,13 +767,15 @@ } autoSpacing () { - document.addEventListener('DOMContentLoaded', () => { + const callback = () => { const $$rootList = document.querySelectorAll(this.rootSelector); for (let $$root of $$rootList) { this.spacingElement($$root); } - }); + }; + if (document.readyState === 'complete') setTimeout(callback); + else document.addEventListener('DOMContentLoaded', callback); } } diff --git a/_site/heti.css b/_site/heti.css index f13afed..b237809 100644 --- a/_site/heti.css +++ b/_site/heti.css @@ -216,10 +216,6 @@ clear: both; } -.heti:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)), .heti:not(:lang(zh)) { - letter-spacing: 0; -} - .heti > *:first-child, .heti section > *:first-child, .heti td > *:first-child { @@ -332,6 +328,22 @@ color: inherit; } +.heti:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)), .heti:not(:lang(zh)) { + letter-spacing: 0; +} + +.heti a, +.heti abbr, +.heti code, +.heti heti-spacing, +.heti [lang="en-US"] { + /* + There should be no leeter-spacing between + English characters. + */ + letter-spacing: normal; +} + .heti h1, .heti h2, .heti h3, diff --git a/lib/_base.scss b/lib/_base.scss index ff8e979..e70ada0 100644 --- a/lib/_base.scss +++ b/lib/_base.scss @@ -6,13 +6,6 @@ // 清容器浮动 @include clear-float(); - // 非中文时不加间距 - letter-spacing: $letter-spacing-medium; - @include non-cjk-block { - letter-spacing: $letter-spacing-normal; - - } - // 清容器内首尾元素外边距 &, section, @@ -113,4 +106,23 @@ } } } + + // 非中文时不加间距 + letter-spacing: $letter-spacing-medium; + @include non-cjk-block { + letter-spacing: $letter-spacing-normal; + + } + + a, + abbr, + code, + heti-spacing, + [lang="en-US"] { + /* + There should be no leeter-spacing between + English characters. + */ + letter-spacing: normal; + } }