From 530b15914e0f5e4746e984377a95df0b929130a0 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Thu, 4 Apr 2024 22:01:47 +0300 Subject: [PATCH] First commit --- .editorconfig | 16 ++++++++++++++++ .gitignore | 2 ++ LICENSE | 24 ++++++++++++++++++++++++ README.md | 0 make-font.sh | 3 +++ pyproject.toml | 3 +++ scripts/generate.py | 33 +++++++++++++++++++++++++++++++++ 7 files changed, 81 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100755 make-font.sh create mode 100644 pyproject.toml create mode 100644 scripts/generate.py diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f3430c3 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.py] +indent_style = space +indent_size = 4 + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5f763e9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +icons/ +*.ttf diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..cf1ab25 --- /dev/null +++ b/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/make-font.sh b/make-font.sh new file mode 100755 index 0000000..ba877f7 --- /dev/null +++ b/make-font.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +fontforge -script scripts/generate.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..cb70edc --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[tool.black] +skip-string-normalization = true +line-length = 100 diff --git a/scripts/generate.py b/scripts/generate.py new file mode 100644 index 0000000..1e0e180 --- /dev/null +++ b/scripts/generate.py @@ -0,0 +1,33 @@ +import string +import glob +import csv +import fontforge + + +if __name__ == '__main__': + letters = string.ascii_letters + letters += string.digits + # letters += string.punctuation + # letters += 'абвгдеёжзийклмнопрстуфхцчшщъыьэюя' + # letters += 'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ' + + files = glob.glob('icons/*.svg') + + font = fontforge.font() + font.encoding = 'UnicodeBMP' + font.familyname = 'Feather' + + icon_index = 0 + for letter in letters: + if icon_index < len(files): + print(letter, '\t', files[icon_index]) + + glyph = font.createMappedChar(letter) + # glyph = font.createChar(int(letter, 16)) + glyph.importOutlines(files[icon_index]) + # print(symbol[0], files[icon_index]) + icon_index += 1 + + font.generate('testfont.ttf') + + print('Total icons:', len(letters))