Skip to content

Commit fe92b78

Browse files
fix: improve Japanese typography (lang attribute and font fallback) (#706)
1 parent 1fc2ec6 commit fe92b78

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+82
-39
lines changed

src/main/resources/static/css/main.css

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,65 @@
5050
}
5151
@font-face {
5252
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
53-
font-family: 'Noto Sans';
53+
font-family: 'Noto Sans SC';
5454
font-style: normal;
5555
font-weight: 400;
5656
src: url('../fonts/noto-sans-sc-chinese-simplified-400-normal.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
5757
}
5858

59+
@font-face {
60+
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
61+
font-family: 'Noto Serif JP';
62+
font-style: normal;
63+
font-weight: 200;
64+
src: url('../fonts/noto-serif-jp-japanese-200-normal.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
65+
}
66+
67+
@font-face {
68+
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
69+
font-family: 'Noto Serif JP';
70+
font-style: normal;
71+
font-weight: 400;
72+
src: url('../fonts/noto-serif-jp-japanese-400-normal.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
73+
}
74+
75+
@font-face {
76+
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
77+
font-family: 'Noto Serif JP';
78+
font-style: normal;
79+
font-weight: 900;
80+
src: url('../fonts/noto-serif-jp-japanese-900-normal.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
81+
}
82+
83+
@font-face {
84+
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
85+
font-family: 'Noto Sans JP';
86+
font-style: normal;
87+
font-weight: 400;
88+
src: url('../fonts/noto-sans-jp-japanese-400-normal.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
89+
}
90+
5991
:root {
6092
--color-highlight: #F5DEB3FF;
6193
--color-background-dark: #3b3b3b;
6294
--color-background-dark-light: #5c5c5c;
6395
--color-text-white: #e3e3e3;
6496
--color-text-gray: #c0c0c0;
65-
--serif-font: "Fraunces", 'Noto Serif SC', 'PingFang SC', 'Microsoft YaHei', serif;;
97+
--serif-font: "Fraunces", 'Noto Serif SC', 'PingFang SC', 'Microsoft YaHei', serif;
6698
--memories-header-height: 550px;
6799
--box-shadow: 0 8px 25px rgba(245, 222, 179, 0.2);
68-
--sans-serif-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
100+
--sans-serif-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
101+
}
102+
103+
/* CJK Language-specific font stacks */
104+
:root:lang(ja) {
105+
--serif-font: "Fraunces", 'Noto Serif JP', 'Hiragino Mincho ProN', 'YuMincho', serif;
106+
--sans-serif-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'YuGothic', 'Meiryo', sans-serif;
107+
}
108+
109+
:root:lang(zh-CN) {
110+
--serif-font: "Fraunces", 'Noto Serif SC', 'PingFang SC', 'Microsoft YaHei', serif;
111+
--sans-serif-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
69112
}
70113

71114
body {
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

src/main/resources/templates/error.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html xmlns:th="http://www.thymeleaf.org">
2+
<html xmlns:th="http://www.thymeleaf.org" th:lang="${#locale.toLanguageTag()}">
33
<head>
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">

src/main/resources/templates/error/magic-link-error.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html xmlns:th="http://www.thymeleaf.org">
2+
<html xmlns:th="http://www.thymeleaf.org" th:lang="${#locale.toLanguageTag()}">
33
<head>
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">

src/main/resources/templates/fragments/main-navigation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
2+
<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml" th:lang="${#locale.toLanguageTag()}">
33
<body>
44
<div th:fragment="main-navigation(activeSection)" class="navigation-container">
55
<div class="navbar">

src/main/resources/templates/fragments/places.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html xmlns:th="http://www.thymeleaf.org">
2+
<html xmlns:th="http://www.thymeleaf.org" th:lang="${#locale.toLanguageTag()}">
33
<body>
44

55
<div th:fragment="geocoding-response-content">

src/main/resources/templates/fragments/settings-navigation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
2+
<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml" th:lang="${#locale.toLanguageTag()}">
33
<body>
44
<div th:fragment="settings-nav(activeSection, dataManagementEnabled, isAdmin)" class="settings-nav">
55
<a th:href="@{/settings/job-status}"

0 commit comments

Comments
 (0)