Skip to content

Commit d78bb1d

Browse files
zeripathtechknowlogick
authored andcommitted
Add lang specific font stacks for CJK (#6007)
* Add lang specific font stacks * Force font changes Signed-off-by: Andrew Thornton <[email protected]> * Fix icons Signed-off-by: Andrew Thornton <[email protected]> * Fix octicons and icons Signed-off-by: Andrew Thornton <[email protected]> * Just override the semantic ui fonts only Signed-off-by: Andrew Thornton <[email protected]> * Missed the headers... override them too * Missed some more semantic ui stuff * Fix PT Sans Signed-off-by: Andrew Thornton <[email protected]> * More changes Signed-off-by: Andrew Thornton <[email protected]> * Squashed commit of the following: commit 7d1679e9079541359869c9e677ba7412bfcc59f3 Author: Mike L <[email protected]> Date: Wed Mar 13 13:53:49 2019 +0100 Remove missed YaHei leftover from _home.less commit 0079121ea91860a323ed4e5cc1a9c0d490d9cefd Author: Mike L <[email protected]> Date: Wed Mar 13 12:03:54 2019 +0100 Fix overdone fixes (inherit, :lang) commit 62c919915928ec1db4731d547e95885f91a0618d Author: Mike L <[email protected]> Date: Wed Mar 13 02:29:10 2019 +0100 Fix elements w/ explicit lang (language chooser) commit b3117587aa2eb8570d60bed583a11ee5565418be Author: Mike L <[email protected]> Date: Tue Mar 12 20:17:26 2019 +0100 Fix textarea also (to match body) commit 81cedf2c3012c4dd05a7680782b4a98e1b947f67 Author: Mike L <[email protected]> Date: Tue Mar 12 19:41:39 2019 +0100 Revert css temporarily to fix conflict commit 80ff82797f3203cbeaf866f22e961334e137df89 Author: Mike L <[email protected]> Date: Tue Mar 12 19:15:30 2019 +0100 Tweak CJK, fix Yu Gothic, more monospace inherits commit 581dceb9a869646c2c486dabb925c88c2680d70c Author: Mike L <[email protected]> Date: Mon Mar 11 13:09:26 2019 +0100 Add Lato for latin extd. & cyrillic, improve CJK * update stylesheet
1 parent cd8cdbd commit d78bb1d

24 files changed

+139
-20
lines changed

modules/context/context.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ func Contexter() macaron.Handler {
194194
},
195195
Org: &Organization{},
196196
}
197+
ctx.Data["Language"] = ctx.Locale.Language()
197198
c.Data["Link"] = ctx.Link
198199
ctx.Data["PageStartTime"] = time.Now()
199200
// Quick responses appropriate go-get meta with status 200

public/css/index.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/less/_base.less

Lines changed: 126 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,133 @@
1+
2+
@font-face {
3+
font-family: 'Lato';
4+
src: url('../vendor/assets/lato-fonts/lato-regular.eot');
5+
src: url('../vendor/assets/lato-fonts/lato-regular.eot?#iefix') format('embedded-opentype'), url('../vendor/assets/lato-fonts/lato-regular.woff2') format('woff2'), url('../vendor/assets/lato-fonts/lato-regular.woff') format('woff'), url('../vendor/assets/lato-fonts/lato-regular.ttf') format('truetype');
6+
font-weight: 400;
7+
font-style: normal;
8+
}
9+
10+
@font-face {
11+
font-family: 'Lato';
12+
src: url('../vendor/assets/lato-fonts/lato-italic.eot');
13+
src: url('../vendor/assets/lato-fonts/lato-italic.eot?#iefix') format('embedded-opentype'), url('../vendor/assets/lato-fonts/lato-italic.woff2') format('woff2'), url('../vendor/assets/lato-fonts/lato-italic.woff') format('woff'), url('../vendor/assets/lato-fonts/lato-italic.ttf') format('truetype');
14+
font-weight: 400;
15+
font-style: italic;
16+
}
17+
18+
@font-face {
19+
font-family: 'Lato';
20+
src: url('../vendor/assets/lato-fonts/lato-bold.eot');
21+
src: url('../vendor/assets/lato-fonts/lato-bold.eot?#iefix') format('embedded-opentype'), url('../vendor/assets/lato-fonts/lato-bold.woff2') format('woff2'), url('../vendor/assets/lato-fonts/lato-bold.woff') format('woff'), url('../vendor/assets/lato-fonts/lato-bold.ttf') format('truetype');
22+
font-weight: 700;
23+
font-style: normal;
24+
}
25+
26+
@font-face {
27+
font-family: 'Lato';
28+
src: url('../vendor/assets/lato-fonts/lato-bolditalic.eot');
29+
src: url('../vendor/assets/lato-fonts/lato-bolditalic.eot?#iefix') format('embedded-opentype'), url('../vendor/assets/lato-fonts/lato-bolditalic.woff2') format('woff2'), url('../vendor/assets/lato-fonts/lato-bolditalic.woff') format('woff'), url('../vendor/assets/lato-fonts/lato-bolditalic.ttf') format('truetype');
30+
font-weight: 700;
31+
font-style: italic;
32+
}
33+
34+
@font-face {
35+
font-family: 'Yu Gothic';
36+
src: local('Yu Gothic Medium');
37+
font-weight: 400;
38+
}
39+
40+
@font-face {
41+
font-family: 'Yu Gothic';
42+
src: local('Yu Gothic Bold');
43+
font-weight: 700;
44+
}
45+
46+
@default-fonts: -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', Roboto, Helvetica, Arial;
47+
@monospaced-fonts: 'SF Mono', Consolas, Menlo, 'Liberation Mono', Monaco, 'Lucida Console';
48+
49+
.override-fonts(@fonts) {
50+
textarea {
51+
font-family: @fonts, sans-serif;
52+
}
53+
54+
.markdown:not(code) {
55+
font-family: @fonts, sans-serif;
56+
}
57+
58+
/* We're going to just override the semantic fonts here */
59+
h1, h2, h3, h4, h5 {
60+
font-family: Lato, @fonts, sans-serif;
61+
}
62+
63+
.home .hero h1, .home .hero h2 {
64+
font-family: 'PT Sans Narrow', Lato, @fonts, sans-serif;
65+
}
66+
67+
.ui.accordion .title:not(.ui),
68+
.ui.button,
69+
.ui.card > .content > .header.ui.card > .content > .header,
70+
.ui.category.search > .results .category > .name,
71+
.ui.form input:not([type]), .ui.form input[type=date], .ui.form input[type=datetime-local], .ui.form input[type=email], .ui.form input[type=file], .ui.form input[type=number], .ui.form input[type=password], .ui.form input[type=search], .ui.form input[type=tel], .ui.form input[type=text], .ui.form input[type=time], .ui.form input[type=url],
72+
.ui.header,
73+
.ui.items > .item > .content > .header,
74+
.ui.list .list > .item .header,
75+
.ui.list > .item .header,
76+
.ui.menu,
77+
.ui.message .header,
78+
.ui.modal > .header,
79+
.ui.popup > .header,
80+
.ui.search > .results .result .title,
81+
.ui.search > .results > .message .header,
82+
body,
83+
.ui.input>input, .ui.input input,
84+
.ui.statistics .statistic > .value,
85+
.ui.statistic > .value,
86+
.ui.statistics .statistic > .label,
87+
.ui.statistic > .label,
88+
.ui.steps .step .title,
89+
.ui.text.container,
90+
.ui.language > .menu > .item&
91+
{
92+
font-family: Lato, @fonts, sans-serif;
93+
}
94+
}
95+
96+
.override-fonts(@default-fonts);
97+
198
body {
2-
font-family: "Lato", "Segoe UI", "Microsoft YaHei", Arial, Helvetica, sans-serif !important;
399
background-color: #fff;
4100
overflow-y: auto;
5101
-webkit-font-smoothing: antialiased;
6102
display: flex;
7103
flex-direction: column;
8104
}
105+
106+
@ja-fonts: 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Source Han Sans JP', 'Noto Sans CJK JP', 'Droid Sans Japanese', 'Meiryo', 'MS PGothic';
107+
:lang(ja) {
108+
.override-fonts(@default-fonts, @ja-fonts;);
109+
}
110+
111+
@zh-CN-fonts: 'PingFang SC', 'Hiragino Sans GB', 'Source Han Sans CN', 'Source Han Sans SC', 'Noto Sans CJK SC', 'Microsoft YaHei', 'Heiti SC', SimHei;
112+
:lang(zh-CN) {
113+
.override-fonts(@default-fonts, @zh-CN-fonts;);
114+
}
115+
116+
@zh-TW-fonts: 'PingFang TC', 'Hiragino Sans TC', 'Source Han Sans TW', 'Source Han Sans TC', 'Noto Sans CJK TC', 'Microsoft JhengHei', 'Heiti TC', PMingLiU;
117+
:lang(zh-TW) {
118+
.override-fonts(@default-fonts, @zh-TW-fonts;);
119+
}
120+
121+
@zh-HK-fonts: 'PingFang HK', 'Hiragino Sans TC', 'Source Han Sans HK', 'Source Han Sans TC', 'Noto Sans CJK TC', 'Microsoft JhengHei', 'Heiti TC', PMingLiU_HKSCS, PMingLiU;
122+
:lang(zh-HK) {
123+
.override-fonts(@default-fonts, @zh-HK-fonts;);
124+
}
125+
126+
@ko-fonts: 'Apple SD Gothic Neo', 'NanumBarunGothic', 'Malgun Gothic', 'Gulim', 'Dotum', 'Nanum Gothic', 'Source Han Sans KR', 'Noto Sans CJK KR';
127+
:lang(ko) {
128+
.override-fonts(@default-fonts, @ko-fonts;);
129+
}
130+
9131
img {
10132
border-radius: 3px;
11133
}
@@ -19,7 +141,7 @@ a {
19141
border-radius: .28571429rem !important;
20142
}
21143
pre, code {
22-
font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace;
144+
font: 12px @monospaced-fonts, monospace;
23145
&.raw {
24146
padding: 7px 12px;
25147
margin: 10px 0;
@@ -337,7 +459,7 @@ pre, code {
337459
}
338460

339461
.sha.label {
340-
font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace;
462+
font-family: @monospaced-fonts, monospace;
341463
font-size: 13px;
342464
padding: 6px 10px 4px 10px;
343465
font-weight: normal;
@@ -391,7 +513,7 @@ pre, code {
391513
}
392514

393515
.file-comment {
394-
font: 12px Consolas,"Liberation Mono",Menlo,Courier,monospace;
516+
font: 12px @monospaced-fonts, monospace;
395517
color: rgba(0,0,0,.87);
396518

397519
}

public/less/_dashboard.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
}
100100
}
101101
.commit-id {
102-
font-family: Consolas, monospace;
102+
font-family: @monospaced-fonts, monospace;
103103
}
104104
code {
105105
padding: 1px;

public/less/_editor.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.CodeMirror {
2-
font: 14px Consolas, "Liberation Mono", Menlo, Courier, monospace;
2+
font: 14px @monospaced-fonts, monospace;
33
&.cm-s-default {
44
border-radius: 3px;
55
padding: 0 !important;

public/less/_form.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192

193193
.githook {
194194
textarea {
195-
font-family: monospace;
195+
font-family: @monospaced-fonts, monospace;
196196
}
197197
}
198198

public/less/_home.less

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
max-width: 220px;
44
}
55
.hero {
6-
h1, h2 {
7-
font-family: 'PT Sans Narrow', sans-serif, 'Microsoft YaHei';
8-
}
96
@media only screen and (max-width: 767px) {
107
h1 {
118
font-size: 3.5em;

public/less/_markdown.less

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.markdown:not(code) {
22
overflow: hidden;
3-
font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif;
43
font-size: 16px;
54
line-height: 1.6 !important;
65
word-wrap: break-word;

public/less/_repository.less

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@
330330
.code-view {
331331
* {
332332
font-size: 12px;
333-
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
333+
font-family: @monospaced-fonts, monospace;
334334
line-height: 20px;
335335
}
336336

@@ -430,7 +430,7 @@
430430
.branch-name {
431431
display: inline-block;
432432
padding: 3px 6px;
433-
font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace;
433+
font: 12px @monospaced-fonts, monospace;
434434
color: rgba(0,0,0,0.65);
435435
background-color: rgba(209,227,237,0.45);
436436
border-radius: 3px;
@@ -699,7 +699,7 @@
699699
}
700700
textarea {
701701
height: 200px;
702-
font-family: "Consolas", monospace;
702+
font-family: @monospaced-fonts, monospace;
703703
}
704704
}
705705

@@ -802,7 +802,7 @@
802802
}
803803
textarea {
804804
height: 200px;
805-
font-family: "Consolas", monospace;
805+
font-family: @monospaced-fonts, monospace;
806806
}
807807
}
808808
}
@@ -1346,7 +1346,7 @@
13461346
&.new {
13471347
.CodeMirror {
13481348
.CodeMirror-code {
1349-
font-family: "Consolas", monospace;
1349+
font-family: @monospaced-fonts, monospace;
13501350
.cm-comment {
13511351
background: inherit;
13521352
}

public/less/_review.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,6 @@
109109
}
110110

111111
.file-comment {
112-
font: 12px Consolas,"Liberation Mono",Menlo,Courier,monospace;
112+
font: 12px @monospaced-fonts, monospace;
113113
color: rgba(0,0,0,.87);
114114
}

0 commit comments

Comments
 (0)