Skip to content

Add lang specific font stacks for CJK #6007

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

Merged
merged 22 commits into from
Mar 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d9cff8b
Add lang specific font stacks
zeripath Feb 8, 2019
7733808
Force font changes
zeripath Feb 9, 2019
1dc2afd
Merge branch 'master' into issue-4173-alternative-fix
zeripath Feb 9, 2019
5d13c8b
Fix icons
zeripath Feb 9, 2019
0fc334a
Merge branch 'master' into issue-4173-alternative-fix
zeripath Feb 9, 2019
9e652eb
Fix octicons and icons
zeripath Feb 10, 2019
755983e
Just override the semantic ui fonts only
zeripath Feb 10, 2019
2c55257
Missed the headers... override them too
zeripath Feb 10, 2019
645a79d
Missed some more semantic ui stuff
zeripath Feb 10, 2019
5a0c8f3
Fix PT Sans
zeripath Feb 10, 2019
1264f90
Merge branch 'master' into issue-4173-alternative-fix
zeripath Feb 12, 2019
d014ae5
More changes
zeripath Feb 12, 2019
f3f23bf
Merge branch 'master' into issue-4173-alternative-fix
zeripath Feb 16, 2019
0b219ce
Merge branch 'master' into issue-4173-alternative-fix
zeripath Feb 17, 2019
e851f00
Merge branch 'master' into issue-4173-alternative-fix
zeripath Feb 20, 2019
81a7a7f
Merge branch 'master' into issue-4173-alternative-fix
zeripath Feb 23, 2019
0948dba
Merge branch 'master' into issue-4173-alternative-fix
zeripath Mar 3, 2019
489eed6
Merge branch 'master' into issue-4173-alternative-fix
zeripath Mar 13, 2019
47f323b
Squashed commit of the following:
CL-Jeremy Mar 13, 2019
d9b45ec
Merge pull request #1 from CL-Jeremy/issue-4173-patch
zeripath Mar 13, 2019
3034e23
update stylesheet
zeripath Mar 13, 2019
ca5fd1d
Merge branch 'master' into issue-4173-alternative-fix
lunny Mar 18, 2019
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
1 change: 1 addition & 0 deletions modules/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ func Contexter() macaron.Handler {
},
Org: &Organization{},
}
ctx.Data["Language"] = ctx.Locale.Language()
c.Data["Link"] = ctx.Link
ctx.Data["PageStartTime"] = time.Now()
// Quick responses appropriate go-get meta with status 200
Expand Down
2 changes: 1 addition & 1 deletion public/css/index.css

Large diffs are not rendered by default.

130 changes: 126 additions & 4 deletions public/less/_base.less
Original file line number Diff line number Diff line change
@@ -1,11 +1,133 @@

@font-face {
font-family: 'Lato';
src: url('../vendor/assets/lato-fonts/lato-regular.eot');
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');
font-weight: 400;
font-style: normal;
}

@font-face {
font-family: 'Lato';
src: url('../vendor/assets/lato-fonts/lato-italic.eot');
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');
font-weight: 400;
font-style: italic;
}

@font-face {
font-family: 'Lato';
src: url('../vendor/assets/lato-fonts/lato-bold.eot');
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');
font-weight: 700;
font-style: normal;
}

@font-face {
font-family: 'Lato';
src: url('../vendor/assets/lato-fonts/lato-bolditalic.eot');
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');
font-weight: 700;
font-style: italic;
}

@font-face {
font-family: 'Yu Gothic';
src: local('Yu Gothic Medium');
font-weight: 400;
}

@font-face {
font-family: 'Yu Gothic';
src: local('Yu Gothic Bold');
font-weight: 700;
}

@default-fonts: -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', Roboto, Helvetica, Arial;
@monospaced-fonts: 'SF Mono', Consolas, Menlo, 'Liberation Mono', Monaco, 'Lucida Console';

.override-fonts(@fonts) {
textarea {
font-family: @fonts, sans-serif;
}

.markdown:not(code) {
font-family: @fonts, sans-serif;
}

/* We're going to just override the semantic fonts here */
h1, h2, h3, h4, h5 {
font-family: Lato, @fonts, sans-serif;
}

.home .hero h1, .home .hero h2 {
font-family: 'PT Sans Narrow', Lato, @fonts, sans-serif;
}

.ui.accordion .title:not(.ui),
.ui.button,
.ui.card > .content > .header.ui.card > .content > .header,
.ui.category.search > .results .category > .name,
.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],
.ui.header,
.ui.items > .item > .content > .header,
.ui.list .list > .item .header,
.ui.list > .item .header,
.ui.menu,
.ui.message .header,
.ui.modal > .header,
.ui.popup > .header,
.ui.search > .results .result .title,
.ui.search > .results > .message .header,
body,
.ui.input>input, .ui.input input,
.ui.statistics .statistic > .value,
.ui.statistic > .value,
.ui.statistics .statistic > .label,
.ui.statistic > .label,
.ui.steps .step .title,
.ui.text.container,
.ui.language > .menu > .item&
{
font-family: Lato, @fonts, sans-serif;
}
}

.override-fonts(@default-fonts);

body {
font-family: "Lato", "Segoe UI", "Microsoft YaHei", Arial, Helvetica, sans-serif !important;
background-color: #fff;
overflow-y: auto;
-webkit-font-smoothing: antialiased;
display: flex;
flex-direction: column;
}

@ja-fonts: 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Source Han Sans JP', 'Noto Sans CJK JP', 'Droid Sans Japanese', 'Meiryo', 'MS PGothic';
:lang(ja) {
.override-fonts(@default-fonts, @ja-fonts;);
}

@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;
:lang(zh-CN) {
.override-fonts(@default-fonts, @zh-CN-fonts;);
}

@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;
:lang(zh-TW) {
.override-fonts(@default-fonts, @zh-TW-fonts;);
}

@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;
:lang(zh-HK) {
.override-fonts(@default-fonts, @zh-HK-fonts;);
}

@ko-fonts: 'Apple SD Gothic Neo', 'NanumBarunGothic', 'Malgun Gothic', 'Gulim', 'Dotum', 'Nanum Gothic', 'Source Han Sans KR', 'Noto Sans CJK KR';
:lang(ko) {
.override-fonts(@default-fonts, @ko-fonts;);
}

img {
border-radius: 3px;
}
Expand All @@ -19,7 +141,7 @@ a {
border-radius: .28571429rem !important;
}
pre, code {
font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace;
font: 12px @monospaced-fonts, monospace;
&.raw {
padding: 7px 12px;
margin: 10px 0;
Expand Down Expand Up @@ -337,7 +459,7 @@ pre, code {
}

.sha.label {
font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace;
font-family: @monospaced-fonts, monospace;
font-size: 13px;
padding: 6px 10px 4px 10px;
font-weight: normal;
Expand Down Expand Up @@ -391,7 +513,7 @@ pre, code {
}

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

}
Expand Down
2 changes: 1 addition & 1 deletion public/less/_dashboard.less
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
}
}
.commit-id {
font-family: Consolas, monospace;
font-family: @monospaced-fonts, monospace;
}
code {
padding: 1px;
Expand Down
2 changes: 1 addition & 1 deletion public/less/_editor.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.CodeMirror {
font: 14px Consolas, "Liberation Mono", Menlo, Courier, monospace;
font: 14px @monospaced-fonts, monospace;
&.cm-s-default {
border-radius: 3px;
padding: 0 !important;
Expand Down
2 changes: 1 addition & 1 deletion public/less/_form.less
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@

.githook {
textarea {
font-family: monospace;
font-family: @monospaced-fonts, monospace;
}
}

Expand Down
3 changes: 0 additions & 3 deletions public/less/_home.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
max-width: 220px;
}
.hero {
h1, h2 {
font-family: 'PT Sans Narrow', sans-serif, 'Microsoft YaHei';
}
@media only screen and (max-width: 767px) {
h1 {
font-size: 3.5em;
Expand Down
1 change: 0 additions & 1 deletion public/less/_markdown.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.markdown:not(code) {
overflow: hidden;
font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif;
font-size: 16px;
line-height: 1.6 !important;
word-wrap: break-word;
Expand Down
10 changes: 5 additions & 5 deletions public/less/_repository.less
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@
.code-view {
* {
font-size: 12px;
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
font-family: @monospaced-fonts, monospace;
line-height: 20px;
}

Expand Down Expand Up @@ -430,7 +430,7 @@
.branch-name {
display: inline-block;
padding: 3px 6px;
font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace;
font: 12px @monospaced-fonts, monospace;
color: rgba(0,0,0,0.65);
background-color: rgba(209,227,237,0.45);
border-radius: 3px;
Expand Down Expand Up @@ -699,7 +699,7 @@
}
textarea {
height: 200px;
font-family: "Consolas", monospace;
font-family: @monospaced-fonts, monospace;
}
}

Expand Down Expand Up @@ -802,7 +802,7 @@
}
textarea {
height: 200px;
font-family: "Consolas", monospace;
font-family: @monospaced-fonts, monospace;
}
}
}
Expand Down Expand Up @@ -1346,7 +1346,7 @@
&.new {
.CodeMirror {
.CodeMirror-code {
font-family: "Consolas", monospace;
font-family: @monospaced-fonts, monospace;
.cm-comment {
background: inherit;
}
Expand Down
2 changes: 1 addition & 1 deletion public/less/_review.less
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,6 @@
}

.file-comment {
font: 12px Consolas,"Liberation Mono",Menlo,Courier,monospace;
font: 12px @monospaced-fonts, monospace;
color: rgba(0,0,0,.87);
}
Binary file added public/vendor/assets/lato-fonts/lato-bold.eot
Binary file not shown.
Binary file added public/vendor/assets/lato-fonts/lato-bold.woff
Binary file not shown.
Binary file added public/vendor/assets/lato-fonts/lato-bold.woff2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added public/vendor/assets/lato-fonts/lato-italic.eot
Binary file not shown.
Binary file added public/vendor/assets/lato-fonts/lato-italic.woff
Binary file not shown.
Binary file not shown.
Binary file added public/vendor/assets/lato-fonts/lato-regular.eot
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion templates/base/footer_content.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="text">{{.LangName}}</div>
<div class="menu">
{{range .AllLangs}}
<a class="item {{if eq $.Lang .Lang}}active selected{{end}}" href="{{if eq $.Lang .Lang}}#{{else}}{{$.Link}}?lang={{.Lang}}{{end}}">{{.Name}}</a>
<a lang="{{.Lang}}" class="item {{if eq $.Lang .Lang}}active selected{{end}}" href="{{if eq $.Lang .Lang}}#{{else}}{{$.Link}}?lang={{.Lang}}{{end}}">{{.Name}}</a>
{{end}}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/base/head.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="{{.Language}}">
<head data-suburl="{{AppSubUrl}}">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
Expand Down