Skip to content

Commit

Permalink
完成基础实现
Browse files Browse the repository at this point in the history
  • Loading branch information
TakWolf committed Feb 28, 2022
1 parent 4fd2cd0 commit 2b40cd3
Show file tree
Hide file tree
Showing 25 changed files with 854 additions and 0 deletions.
146 changes: 146 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
.idea/

# Project
outputs/
releases/
www/
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
**注意:**

本字体的字模无法提供明确的来源出处和版权许可证。

如果你正在寻找可以免费商用的开源像素字体,请尝试 [方舟像素字体](https://github.com/TakWolf/ark-pixel-font)

# 汉字库像素字体 / HZK Pixel Font

中文像素字体,支持 12 和 16 像素尺寸。

字符范围为:ASCII + GB2312

这个项目提供了构建字体所需要的完整程序。

## 预览

12 像素预览:

![preview-12px.png](docs/preview-12px.png)

16 像素预览:

![preview-16px.png](docs/preview-16px.png)

[点击这里查看在线示例文本](https://hzk-pixel-font.takwolf.com)

## 下载

[下载地址](https://github.com/TakWolf/hzk-pixel-font/releases)

## 授权信息

### 字体

本字体使用的字模来源于:[https://github.com/aguegu/BitmapFont/tree/master/font](https://github.com/aguegu/BitmapFont/tree/master/font)

根据 [原项目作者博客描述](http://aguegu.net/?p=1279) ,该字模可能来源于 UCDOS ,或是早期的 WPS 。但我无法找到关于该字模的明确版权信息。

因此,本字体不提供任何许可证。您在使用本字体时,请谨慎考量并自负版权风险。

### 构建程序

使用 [MIT 许可证](LICENSE) 授权。
Binary file added assets/backup/font_bitmap.zip
Binary file not shown.
Binary file added assets/design/12/notdef.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/design/16/notdef.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/hzk-fonts/ASC12
Binary file not shown.
Binary file added assets/hzk-fonts/ASC16
Binary file not shown.
Binary file added assets/hzk-fonts/HZK12
Binary file not shown.
Binary file added assets/hzk-fonts/HZK16
Binary file not shown.
1 change: 1 addition & 0 deletions assets/www-static/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hzk-pixel-font.takwolf.com
87 changes: 87 additions & 0 deletions assets/www-static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<title>HZK Pixel Font</title>
<style>
body {
padding: 50px 200px;
color: #4b4b4b;
background-color: beige;
}
@font-face {
font-family: HZK12;
src: url("hzk-pixel-12px.woff2");
}
@font-face {
font-family: HZK16;
src: url("hzk-pixel-16px.woff2");
}
.title-12px {
font-family: HZK12, sans-serif;
font-size: 36px;
font-weight: normal;
line-height: 48px;
letter-spacing: 1px;
}
.content-12px {
font-family: HZK12, sans-serif;
font-size: 24px;
line-height: 36px;
letter-spacing: 1px;
}
.title-16px {
font-family: HZK16, sans-serif;
font-size: 48px;
font-weight: normal;
line-height: 64px;
letter-spacing: 1px;
}
.content-16px {
font-family: HZK16, sans-serif;
font-size: 32px;
line-height: 48px;
letter-spacing: 1px;
}
</style>
</head>
<body>
<h1 class="title-16px">汉字库像素字体 / HZK Pixel Font</h1>
<p class="content-12px">项目地址:<a href="https://github.com/TakWolf/hzk-pixel-font">https://github.com/TakWolf/hzk-pixel-font</a></p>
<br>
<p class="content-12px">12像素示例文本:</p>
<h1 class="title-12px">任天堂</h1>
<a class="content-12px" href="https://zh.wikipedia.org/wiki/%E4%BB%BB%E5%A4%A9%E5%A0%82">https://zh.wikipedia.org/wiki/%E4%BB%BB%E5%A4%A9%E5%A0%82</a>
<p class="content-12px">任天堂是一家主要从事电子游戏和玩具的开发、制造与发行的日本公司。于1889年在日本京都创立,至今公司总部仍设于京都。任天堂最初以生产花札起家,1970年代后期投入电子游戏产业,在1983年推出家用游戏机 Family Computer(俗称红白机)、及在1985年推出游戏软件《超级马力欧兄弟》后,逐渐成为世界知名的电子游戏开发商。随着电子游戏事业的成功,任天堂亦向日本以外地区发展,现已有任天堂(美国)、任天堂(香港)等多家海外子公司。</p>
<p class="content-12px">任天堂已开发的家用游戏机包括Color TV-Game、Family Computer、Super Famicom、任天堂64、任天堂GameCube、Wii和Wii U,而掌上游戏机则包括Game & Watch、Game Boy系列、任天堂DS系列和任天堂3DS系列(包括定位是掌上游戏机,但属于桌面台式游戏机的Virtual Boy),此外还有最新的便携式家用游戏机任天堂Switch和掌上型游戏机任天堂Switch Lite。 任天堂本公司及第二方(包括控股子公司以及参股公司)开发了许多知名游戏系列与作品;亦创造了众多知名虚拟游戏角色。 自1983年红白机发售起至2018年初,任天堂已在全球售出超过45亿份游戏软件,超过7.2亿台游戏主机(包括家用游戏机和掌上游戏机)。</p>
<h1 class="title-12px">任天堂株式会社</h1>
<a class="content-12px" href="https://ja.wikipedia.org/wiki/%E4%BB%BB%E5%A4%A9%E5%A0%82">https://ja.wikipedia.org/wiki/%E4%BB%BB%E5%A4%A9%E5%A0%82</a>
<p class="content-12px">任天堂株式会社(にんてんどう、英: Nintendo Co., Ltd.)は、主に玩具やコンピュータゲームの開発・製造・販売を行う日本の企業。TOPIX Core30の構成銘柄の一つである。</p>
<p class="content-12px">明治時代の1889年に創業した老舗企業で、娯楽に関する様々な事業を展開している。創業以来、多くの種類の玩具を製作しており、特に花札やトランプは創業初期から現在に至るまで製造・販売を続けている。</p>
<p class="content-12px">1970年代後期からは家庭用と業務用のコンピュータゲーム機の開発を開始。1983年発売の据置型ゲーム機「ファミリーコンピュータ」のゲームソフトとして1985年に発売した『スーパーマリオブラザーズ』は世界的にヒットし、任天堂はゲーム機やゲームソフトを開発する会社として広く認知されるようになった。</p>
<p class="content-12px">『スーパーマリオブラザーズ』の主人公「マリオ」など、任天堂のゲームソフトに登場するキャラクターは世界で知られているものが多く、2010年代からはキャラクターIPのゲーム外での活用を進めている。</p>
<h1 class="title-12px">Nintendo</h1>
<a class="content-12px" href="https://en.wikipedia.org/wiki/Nintendo">https://en.wikipedia.org/wiki/Nintendo</a>
<p class="content-12px">Nintendo Co., Ltd. is a Japanese multinational consumer electronics and video game company headquartered in Kyoto. The company was founded in 1889 as Nintendo Karuta by craftsman Fusajiro Yamauchi and originally produced handmade hanafuda playing cards. After venturing into various lines of business during the 1960s and acquiring a legal status as a public company under the current company name, Nintendo distributed its first video game console, the Color TV-Game, in 1977. It gained international recognition with the release of the Nintendo Entertainment System in 1985.</p>
<p class="content-12px">Since then, Nintendo has produced some of the most successful consoles in the video game industry, such as the Game Boy, the Super Nintendo Entertainment System, the Nintendo DS, the Wii, and the Nintendo Switch. It has created numerous major franchises, including Mario, Donkey Kong, The Legend of Zelda, Pokémon, Kirby, Metroid, Fire Emblem, Animal Crossing, Splatoon, Star Fox, Xenoblade Chronicles, and Super Smash Bros.</p>
<p class="content-12px">Nintendo has multiple subsidiaries in Japan and abroad, in addition to business partners such as The Pokémon Company and HAL Laboratory. Nintendo and its staff has received awards including Emmy Awards for Technology & Engineering, Game Awards, Game Developers Choice Awards and British Academy Games Awards. It is one of the wealthiest and most valuable companies in the Japanese market.</p>
<br>
<p class="content-16px">16像素示例文本:</p>
<h1 class="title-16px">任天堂</h1>
<a class="content-16px" href="https://zh.wikipedia.org/wiki/%E4%BB%BB%E5%A4%A9%E5%A0%82">https://zh.wikipedia.org/wiki/%E4%BB%BB%E5%A4%A9%E5%A0%82</a>
<p class="content-16px">任天堂是一家主要从事电子游戏和玩具的开发、制造与发行的日本公司。于1889年在日本京都创立,至今公司总部仍设于京都。任天堂最初以生产花札起家,1970年代后期投入电子游戏产业,在1983年推出家用游戏机 Family Computer(俗称红白机)、及在1985年推出游戏软件《超级马力欧兄弟》后,逐渐成为世界知名的电子游戏开发商。随着电子游戏事业的成功,任天堂亦向日本以外地区发展,现已有任天堂(美国)、任天堂(香港)等多家海外子公司。</p>
<p class="content-16px">任天堂已开发的家用游戏机包括Color TV-Game、Family Computer、Super Famicom、任天堂64、任天堂GameCube、Wii和Wii U,而掌上游戏机则包括Game & Watch、Game Boy系列、任天堂DS系列和任天堂3DS系列(包括定位是掌上游戏机,但属于桌面台式游戏机的Virtual Boy),此外还有最新的便携式家用游戏机任天堂Switch和掌上型游戏机任天堂Switch Lite。 任天堂本公司及第二方(包括控股子公司以及参股公司)开发了许多知名游戏系列与作品;亦创造了众多知名虚拟游戏角色。 自1983年红白机发售起至2018年初,任天堂已在全球售出超过45亿份游戏软件,超过7.2亿台游戏主机(包括家用游戏机和掌上游戏机)。</p>
<h1 class="title-16px">任天堂株式会社</h1>
<a class="content-16px" href="https://ja.wikipedia.org/wiki/%E4%BB%BB%E5%A4%A9%E5%A0%82">https://ja.wikipedia.org/wiki/%E4%BB%BB%E5%A4%A9%E5%A0%82</a>
<p class="content-16px">任天堂株式会社(にんてんどう、英: Nintendo Co., Ltd.)は、主に玩具やコンピュータゲームの開発・製造・販売を行う日本の企業。TOPIX Core30の構成銘柄の一つである。</p>
<p class="content-16px">明治時代の1889年に創業した老舗企業で、娯楽に関する様々な事業を展開している。創業以来、多くの種類の玩具を製作しており、特に花札やトランプは創業初期から現在に至るまで製造・販売を続けている。</p>
<p class="content-16px">1970年代後期からは家庭用と業務用のコンピュータゲーム機の開発を開始。1983年発売の据置型ゲーム機「ファミリーコンピュータ」のゲームソフトとして1985年に発売した『スーパーマリオブラザーズ』は世界的にヒットし、任天堂はゲーム機やゲームソフトを開発する会社として広く認知されるようになった。</p>
<p class="content-16px">『スーパーマリオブラザーズ』の主人公「マリオ」など、任天堂のゲームソフトに登場するキャラクターは世界で知られているものが多く、2010年代からはキャラクターIPのゲーム外での活用を進めている。</p>
<h1 class="title-16px">Nintendo</h1>
<a class="content-16px" href="https://en.wikipedia.org/wiki/Nintendo">https://en.wikipedia.org/wiki/Nintendo</a>
<p class="content-16px">Nintendo Co., Ltd. is a Japanese multinational consumer electronics and video game company headquartered in Kyoto. The company was founded in 1889 as Nintendo Karuta by craftsman Fusajiro Yamauchi and originally produced handmade hanafuda playing cards. After venturing into various lines of business during the 1960s and acquiring a legal status as a public company under the current company name, Nintendo distributed its first video game console, the Color TV-Game, in 1977. It gained international recognition with the release of the Nintendo Entertainment System in 1985.</p>
<p class="content-16px">Since then, Nintendo has produced some of the most successful consoles in the video game industry, such as the Game Boy, the Super Nintendo Entertainment System, the Nintendo DS, the Wii, and the Nintendo Switch. It has created numerous major franchises, including Mario, Donkey Kong, The Legend of Zelda, Pokémon, Kirby, Metroid, Fire Emblem, Animal Crossing, Splatoon, Star Fox, Xenoblade Chronicles, and Super Smash Bros.</p>
<p class="content-16px">Nintendo has multiple subsidiaries in Japan and abroad, in addition to business partners such as The Pokémon Company and HAL Laboratory. Nintendo and its staff has received awards including Emmy Awards for Technology & Engineering, Game Awards, Game Developers Choice Awards and British Academy Games Awards. It is one of the wealthiest and most valuable companies in the Japanese market.</p>
</body>
</html>
23 changes: 23 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import logging
import os
import shutil

from services import dump_asc_12, dump_asc_16, dump_hzk_16, dump_hzk_12, make_font

logging.basicConfig(level=logging.DEBUG)

outputs_dir = 'outputs/'


def main():
if os.path.exists(outputs_dir):
shutil.rmtree(outputs_dir)
dump_asc_12.run()
dump_asc_16.run()
dump_hzk_12.run()
dump_hzk_16.run()
make_font.run()


if __name__ == '__main__':
main()
Binary file added docs/preview-12px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/preview-16px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 73 additions & 0 deletions publish.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import logging
import os
import shutil
import time

import git

logging.basicConfig(level=logging.DEBUG)

outputs_dir = 'outputs/'
docs_dir = 'docs/'
releases_dir = 'releases/'
www_static_dir = 'assets/www-static/'
www_dir = 'www/'

git_url = 'git@github.com:TakWolf/hzk-pixel-font.git'
git_remote_name = 'origin'
git_branch_name = 'gh-pages'


def _copy_files(file_names, from_dir, to_dir):
for file_name in file_names:
shutil.copy(os.path.join(from_dir, file_name), os.path.join(to_dir, file_name))


def _publish_docs():
if not os.path.exists(docs_dir):
os.makedirs(docs_dir)
_copy_files([
'preview-12px.png',
'preview-16px.png',
], outputs_dir, docs_dir)


def _publish_releases():
if os.path.exists(releases_dir):
shutil.rmtree(releases_dir)
os.makedirs(releases_dir)
_copy_files([
'hzk-pixel-12px.otf',
'hzk-pixel-12px.woff2',
'hzk-pixel-12px.ttf',
'hzk-pixel-16px.otf',
'hzk-pixel-16px.woff2',
'hzk-pixel-16px.ttf',
], outputs_dir, releases_dir)


def _publish_www():
if os.path.exists(www_dir):
shutil.rmtree(www_dir)
shutil.copytree(www_static_dir, www_dir)
_copy_files([
'hzk-pixel-12px.woff2',
'hzk-pixel-16px.woff2',
], outputs_dir, www_dir)

repo = git.Repo.init(www_dir)
repo.git.add(all=True)
repo.git.commit(m=f'deployed at {time.strftime("%Y-%m-%d %H-%M-%S")}')
repo.git.checkout(b=git_branch_name)
repo.git.remote('add', git_remote_name, git_url)
repo.git.push(git_remote_name, git_branch_name, '-f')


def main():
_publish_docs()
_publish_releases()
_publish_www()


if __name__ == '__main__':
main()
7 changes: 7 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Brotli==1.0.9
fonttools==4.29.1
gitdb==4.0.9
GitPython==3.1.27
Pillow==9.0.1
pypng==0.0.21
smmap==5.0.0
Empty file added services/__init__.py
Empty file.
Loading

0 comments on commit 2b40cd3

Please sign in to comment.