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

Add Adobe fonts for Simplified Chinese translation #10

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ COPY trans/static/fonts/SourceSansPro/ttf/* /usr/share/fonts/
COPY trans/static/fonts/Korean/* /usr/share/fonts/
COPY trans/static/fonts/Thai/* /usr/share/fonts/
COPY trans/static/fonts/Taiwan/* /usr/share/fonts/
COPY trans/static/fonts/Adobe/* /usr/share/fonts/

COPY requirements.txt /root/requirements.txt
RUN pip3 install -r /root/requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ You may optionally perform the following tasks:
Then exit from the shell by typing `exit`.
* You can get access to the system logs by running `dokcer-compose logs`.
To follow the logs from now on, run `docker-compose logs -f --tail=0`.
* To stop the system, run `dokcer-compose stop`.
* To stop the system, run `docker-compose stop`.

Development Settings
--------------------
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django
Django<2
gunicorn>=19.5.0
psycopg2==2.6
redis==2.10.3
Expand Down
Binary file modified trans/initial_data/initial_data.xlsx
Binary file not shown.
8 changes: 4 additions & 4 deletions trans/management/commands/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def import_languages(self, reset):
for name, code, direction in data:
Language.objects.get_or_create(name=name, code=code, rtl=(direction=='rtl'))
# print(name, code, direction=='rtl')
print('Languages improted.')
print('Languages imported.')

def import_countries(self, reset):
if reset:
Expand All @@ -62,7 +62,7 @@ def import_countries(self, reset):
for name, code in data:
Country.objects.get_or_create(name=name, code=code)
# print(name, code)
print('Countries improted.')
print('Countries imported.')

def import_users(self, reset):
if reset:
Expand All @@ -77,7 +77,7 @@ def import_users(self, reset):
user.set_password(password)
user.save()
# print(country, language, username, password)
print('Users improted.')
print('Users imported.')

def import_tasks(self, reset):
if reset:
Expand All @@ -97,7 +97,7 @@ def import_tasks(self, reset):
task_name = task_parts[-1]
self.import_task(file_name, task_name, order, contest_slug)
# print('Task {} imported to {}.'.format(task_name, contest_slug))
print('Tasks improted.')
print('Tasks imported.')

def import_task(self, file_name, task_name, order, contest_slug):
with open(file_name, 'r') as file:
Expand Down
18 changes: 17 additions & 1 deletion trans/static/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Global

@import url(/static/fonts/SourceSansPro/SourceSansPro.css);
@import url(/static/fonts/IRANSans/IRANSans.css);
@import url(/static/fonts/Adobe/adobe.css);

/*@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600);*/

Expand Down Expand Up @@ -262,6 +263,21 @@ code, pre {
font-family: 'Loma', CustomTextFont, Arial, serif;
}

.rendered_content[lang="zh"], .rendered_content[lang="tw"]{
.rendered_content[lang="zh-CN"] {
font-family: 'Source Han Serif CN', CustomTextFont, serif;
}
.rendered_content[lang="zh-CN"] h1,
.rendered_content[lang="zh-CN"] h2,
.rendered_content[lang="zh-CN"] h3,
.rendered_content[lang="zh-CN"] h4 {
font-family: 'Source Han Sans CN', CustomTextFont, sans;
}
.rendered_content[lang="zh-CN"] code {
font-family: 'Source Code Pro', monospace;
}

.rendered_content[lang="zh-TW"],
.rendered_content[lang="zh-HK"],
.rendered_content[lang="zh-MO"] {
font-family: 'PMingLiU', CustomTextFont, Arial, serif;
}
Binary file added trans/static/fonts/Adobe/SourceCodePro-Bold.otf
Binary file not shown.
Binary file not shown.
Binary file added trans/static/fonts/Adobe/SourceHanSansCN-Bold.otf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
47 changes: 47 additions & 0 deletions trans/static/fonts/Adobe/adobe.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
@font-face{
font-family: 'Source Han Serif CN';
font-weight: 210;
font-style: normal;
font-stretch: normal;
src: url('./SourceHanSerifCN-Regular.otf') format('opentype');
}

@font-face{
font-family: 'Source Han Serif CN';
font-weight: 730;
font-style: normal;
font-stretch: normal;
src: url('./SourceHanSerifCN-Bold.otf') format('opentype');
}

@font-face{
font-family: 'Source Han Sans CN';
font-weight: 420;
font-style: normal;
font-stretch: normal;
src: url('./SourceHanSansCN-Regular.otf') format('opentype');
}

@font-face{
font-family: 'Source Han Sans CN';
font-weight: 780;
font-style: normal;
font-stretch: normal;
src: url('./SourceHanSansCN-Regular.otf') format('opentype');
}

@font-face{
font-family: 'Source Code Pro';
font-weight: 400;
font-style: normal;
font-stretch: normal;
src: url('./SourceCodePro-Regular.otf') format('opentype');
}

@font-face{
font-family: 'Source Code Pro';
font-weight: 700;
font-style: normal;
font-stretch: normal;
src: url('./SourceCodePro-Bold.otf') format('opentype');
}
2 changes: 1 addition & 1 deletion trans/views/translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def get(self, request, contest_slug, task_name):
context={'trans': trans.get_latest_text(), 'task': task_text,
'text_font_base64': user.text_font_base64, 'contest_slug': contest_slug,
'contests': contests, 'task_name': task_name, 'is_editor': user.is_editor(),
'taskID': task.id, 'language': user.credentials(), 'username': user.username,
'taskID': task.id, 'language': user.language.code, 'username': user.username,
'direction': user.language.direction()})


Expand Down