Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support Noto CJK(思源宋体) and add fonts to mono #123

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions _site/heti.css
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@
font-weight: 800;
src: local("Kaiti SC Black"), local("Kaiti TC Black"), local("STKaiti"), local("Kaiti");
}
@font-face {
font-family: "JetBrains Mono";
src: local("JetBrains Mono"), local("JetBrainsMono");
}
@font-face {
font-family: "Ubuntu Mono";
src: local("Ubuntu Mono"), local("UbuntuMono");
}
.heti {
max-width: 42em;
font-size: 16px;
Expand Down Expand Up @@ -254,7 +262,7 @@
padding-inline-start: 16px;
padding-inline-end: 16px;
overflow: auto;
font-family: "SFMono-Regular", consolas, "Liberation Mono", menlo, courier, monospace, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-family: "JetBrains Mono", "Ubuntu Mono", "SFMono-Regular", consolas, "Liberation Mono", menlo, courier, monospace, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
white-space: pre;
word-wrap: normal;
border-radius: 4px;
Expand Down Expand Up @@ -447,7 +455,7 @@
.heti code {
margin-inline-start: 0.25em;
margin-inline-end: 0.25em;
font-family: "SFMono-Regular", consolas, "Liberation Mono", menlo, courier, monospace, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-family: "JetBrains Mono", "Ubuntu Mono", "SFMono-Regular", consolas, "Liberation Mono", menlo, courier, monospace, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 0.875em;
}
.heti dfn {
Expand Down Expand Up @@ -626,6 +634,12 @@
.heti--kai {
font-family: "Times New Roman", times, "Heti Kai", serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
.heti--noto-sans {
font-family: "Helvetica Neue", helvetica, arial, "Noto Sans CJK SC", "Noto Sans CJK TC", "Noto Sans CJK HK", "Noto Sans CJK JP", "Noto Sans CJK KR", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
.heti--noto-serif {
font-family: "Times New Roman", times, "Noto Serif CJK SC", "Noto Serif CJK TC", "Noto Serif CJK HK", "Noto Serif CJK JP", "Noto Serif CJK KR", serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
.heti--columns-1, .heti--columns-2, .heti--columns-3, .heti--columns-4, .heti--columns-16em, .heti--columns-20em, .heti--columns-24em, .heti--columns-28em, .heti--columns-32em, .heti--columns-36em, .heti--columns-40em, .heti--columns-44em, .heti--columns-48em, .heti comma {
max-width: none;
column-gap: 2em;
Expand Down Expand Up @@ -894,6 +908,17 @@
.heti .heti-adjacent-half {
margin-inline-end: -0.5em;
}
.heti--noto-sans .heti-adjacent-half, .heti--noto-serif .heti-adjacent-half {
margin-inline-end: 0;
}
@-moz-document url-prefix() {
.heti--noto-sans .heti-adjacent-half, .heti--noto-serif .heti-adjacent-half {
margin-inline-end: -0.5em;
}
}
.heti--noto-sans .heti-adjacent-half _::-webkit-full-page-media, .heti--noto-sans .heti-adjacent-half _:future, .heti--noto-sans .heti-adjacent-half :root .safari_only, .heti--noto-serif .heti-adjacent-half _::-webkit-full-page-media, .heti--noto-serif .heti-adjacent-half _:future, .heti--noto-serif .heti-adjacent-half :root .safari_only {
margin-inline-end: -0.5em;
}
.heti .heti-adjacent-quarter {
margin-inline-end: -0.25em;
}
1 change: 1 addition & 0 deletions _site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ <h3 id="license">开源协议<a class="anchor" href="#tags">#</a></h3>
<li><input type="radio" class="J_fontStack" value="heti--classic" name="font" id="font-classic" checked><label for="font-classic">传统</label></li>
<li><input type="radio" class="J_fontStack" value="heti--sans" name="font" id="font-sans"><label for="font-sans">黑体</label></li>
<li><input type="radio" class="J_fontStack" value="heti--serif" name="font" id="font-serif"><label for="font-serif">宋体</label></li>
<li><input type="radio" class="J_fontStack" value="heti--noto-serif" name="font" id="font-noto-serif"><label for="font-noto-serif">思源宋体</label></li>
</ul>
<ul class="panel-list panel-list--gray">
<li><input type="radio" class="J_radioGrid" value="" name="grid" id="grid-disable" checked><label for="grid-disable">网格:关</label></li>
Expand Down
2 changes: 2 additions & 0 deletions lib/_font.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
@import "fonts/hei";
@import "fonts/song";
@import "fonts/kai";
@import "fonts/jetbrains";
@import "fonts/ubuntu";
4 changes: 3 additions & 1 deletion lib/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ $manualmode-dark-selector: '[data-darkmode="dark"] &' !default;
// 字体栈 Font Stacks
$_font-stack-sans: "Helvetica Neue", helvetica, arial !default;
$_font-stack-serif: "Times New Roman", times !default;
$_font-stack-mono: "SFMono-Regular", consolas, "Liberation Mono", menlo, courier !default;
$_font-stack-mono: "JetBrains Mono", "Ubuntu Mono", "SFMono-Regular", consolas, "Liberation Mono", menlo, courier !default;
$_font-stack-symbol: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol" !default;

// 字体族 Font Families
$font-family-hei: $_font-stack-sans, "Heti Hei", sans-serif, $_font-stack-symbol !default;
$font-family-song: $_font-stack-serif, "Heti Song", serif, $_font-stack-symbol !default;
$font-family-kai: $_font-stack-serif, "Heti Kai", serif, $_font-stack-symbol !default;
$font-family-noto-sans: $_font-stack-sans, "Noto Sans CJK SC", "Noto Sans CJK TC", "Noto Sans CJK HK", "Noto Sans CJK JP", "Noto Sans CJK KR", sans-serif, $_font-stack-symbol !default;
$font-family-noto-serif: $_font-stack-serif, "Noto Serif CJK SC", "Noto Serif CJK TC", "Noto Serif CJK HK", "Noto Serif CJK JP", "Noto Serif CJK KR", serif, $_font-stack-symbol !default;
$font-family-hei-black: $_font-stack-sans, "Heti Hei Black", sans-serif, $_font-stack-symbol !default;
$font-family-song-black: $_font-stack-serif, "Heti Song Black", serif, $_font-stack-symbol !default;
$font-family-kai-black: $_font-stack-serif, "Heti Kai Black", serif, $_font-stack-symbol !default;
Expand Down
9 changes: 9 additions & 0 deletions lib/fonts/_jetbrains.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Author: Kika [[email protected]]
// Description: define font-face JetBrains Mono.

@font-face {
font-family: "JetBrains Mono";
src:
local("JetBrains Mono"),
local("JetBrainsMono");
}
9 changes: 9 additions & 0 deletions lib/fonts/_ubuntu.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Author: Kika [[email protected]]
// Description: define font-face Ubuntu Mono.

@font-face {
font-family: "Ubuntu Mono";
src:
local("Ubuntu Mono"),
local("UbuntuMono");
}
17 changes: 16 additions & 1 deletion lib/helpers/_add-on.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Author: Sivan [[email protected]]
// Author: Sivan [[email protected]], Kika [[email protected]]
// Description: define add-ons.
@import "../variables";

Expand Down Expand Up @@ -28,6 +28,21 @@
.heti-adjacent-half {
margin-inline-end: -0.5em;
}

// For Noto CJK font, see issue https://github.com/sivan/heti/issues/124
&--noto-sans, &--noto-serif{
.heti-adjacent-half {
margin-inline-end: 0;
// Firefox
@-moz-document url-prefix(){
margin-inline-end: -0.5em;
}
// Safari
_::-webkit-full-page-media, _:future, :root .safari_only{
margin-inline-end: -0.5em;
}
}
}

.heti-adjacent-quarter {
margin-inline-end: -0.25em;
Expand Down
11 changes: 10 additions & 1 deletion lib/modifiers/font-stack.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Author: Sivan [[email protected]]
// Author: Sivan [[email protected]], Kika [[email protected]]
// Description: define global font stacks.
@import "../variables";

Expand Down Expand Up @@ -59,4 +59,13 @@
&--kai {
font-family: $font-family-kai;
}

&--noto-sans {
font-family: $font-family-noto-sans;
}

&--noto-serif {
font-family: $font-family-noto-serif;
}

}
Loading