Please note, that this project is obsolete, and is no longer maintained. No additional documentation will be released. No additional installation support will be provided.
Please note, that user font creation process, demonstrated in this readme file, is an extremely unpractical and tedious endeavor. More information regarding this project is available at the following address: GitHub pages.
Item | Description |
---|---|
What is this? | A project, saved into git repository, hosted at GitHub website. |
What does it contain? |
|
Whom are they for? | For beginner python developers. |
What is the current project status? |
|
Why is it obsolete? |
|
What is the purpose of this repository? | Host an educational archive with working code. |
Why is it named like that? | Because at one point in time it allowed to save several human wrists from unnecessary injuries. |
For the best experience, please use the specific version of the Spyder
python IDE. It can be installed via pip install spyder==5.5.6
command.
- Clone this repository in a directory of choice.
- Navigate to this directory.
- Follow this manual in order to:
- Create the virtual environment
- Activate this virtual environment
- Make the
Spyder
work in this virtual environment.
- Install the dependencies, listed in the
requirements.txt
, into this virtual environment. - In
Spyder
, open the menu option "Projects"->"New Project...", select "Existing directory", set "Location" to the dir of the cloned repository and click "Create". - Open the menu option "Tools"->"Preferences", select "Run", set "Working directory settings" to "The current working directory" option.
- Make sure that current working dir is the cloned repository dir.
- Open the
step5_Printer.py
file withSpyder
. - Scroll to the bottom.
- Adjust the
my_font_folder
variable. - Choose the menu option "Run"->"Run".
The .png
images, named consequtively 1.png
, 2.png
, 3.png
... (their number depends on the amount of text being printed and user font size) will start appearing in the cloned repository folder. The user may want to manually post-process them via any available image editor.
The example output with a fine-tuned font could be as follows (please note that for privacy reasons the original output image, which was 2480x3500px and 300 dpi resolution, had to be cropped and severely scaled down):
- Open the
giant_lecture.html
file. - Carefully edit its contents (make sure all tags are closed, etc).
- Keep the tag structure as simple as possible — only headers, paragraphs and new lines are recognized. Probably. I don't remember.
Please note, that theoretically wristsaver
can print in any language — any letter, number, text symbol, emoji, pictogram, word, phrase, anything. In order to achieve this in practice, the user needs to manually add each desired custom item into his font and provide appropriate metadata. The process will be described in further sections.
- Open the
main.css
file. - Carefully edit its contents (make sure all tags are closed, etc).
- Keep the values as simple as possible.
For demonstration purposes, a minimal demo font is included at all development stages — from raw
to printable
. The contents of this font are sampled from the freely available Kaggle handwriting dataset, available at the official website.
Please see the expected folder structure (some files are omitted):
■ cloned repository directory
├─■ fonts (root folder for all fonts)
│ ├─■ step0_raw_kaggle_test_images.zip
│ ├─■ step1_manually_split_kaggle_test_letters.zip
│ ├─■ step2kaggle_rem_bg_create_df.zip
│ ├─■ step3kaggle_write_image_width_and_height_to_df.zip
│ └─■ step4kaggle_Editor (folder with actual printable font)
├─■ step2_rem_bg_create_df.py
├─■ step3_write_image_width_and_height_to_df.py
├─■ step4_Editor.py
├─■ step5_Printer.py (already explained in the previous section)
└─■ step10_Marker.py
- Scan a page with some handwritten text on it.
- Create a folder
fonts/my_font_0raw
. - Put a disposable copy of the scanned image into the folder.
Please note, that the desired fragments can have any shape or size — no restriction. Any differences will be mitigated via metadata editing tool in Step 4.
Let's say that during Step 0
the user has obtained raw.png
image. Let's assume that this raw.png
contains the following handwritten text: The weather is good 100% :D
. Let's assume that the user wants to extract the following sub-images from this big raw.png
:
- The image, containing word
The
- The images for each individual letter (
T
,h
,e
,w
,e
,a
,t
,h
,e
,r
,i
,s
,g
,o
,o
,d
,1
,0
,0
,%
,:
,D
) - The image, containing the frequenty-used number
100
- The image, containing the smile
:D
.
The means to achieve this are entirely up to the user. Worst-case scenario is manual image editing: select desired region, save it to disk.
Let's assume that at this moment the user has a lot of small images that contain the desired extracts from the big raw.png
.
- Create a folder
fonts/my_font_1split
. - Create a folder
fonts/my_font_1split/letters_lowercase
. - Create a folder
fonts/my_font_1split/letters_uppercase
. - Create a folder
fonts/my_font_1split/numbers
. - Create a folder
fonts/my_font_1split/my_custom_category
. - Create a folder
fonts/my_font_1split/it_can_be_named_anything
. - Put disposable copies of some of the small images into the appropriate subfolders.
Please note, that the small images can be placed anywhere — in root fonts/my_font_1split
, in some user-defined subfolder. The target image location is entirely up to the user.
- Duplicate the folder
fonts/my_font_1split
. - Rename it to be
fonts/my_font_2metadata
. - Open the
step2_rem_bg_create_df.py
file withSpyder
. - Scroll to the bottom.
- Adjust the
folder_with_letter_images
variable to thefonts/my_font_2metadata
. - Choose the menu option "Run"->"Run".
The images in the fonts/my_font_2metadata
folder will be edited inplace — their background will become transparent. Additionally, df.xls
files will be created.
- Duplicate the folder
fonts/my_font_2metadata
. - Rename it to be
fonts/my_font_3metadata
. - Open the
step3_write_image_width_and_height_to_df.py
file withSpyder
. - Scroll to the bottom.
- Adjust the
folder_with_letter_images
variable to thefonts/my_font_3metadata
. - Choose the menu option "Run"->"Run".
The df.xls
files will be edited inplace.
- Duplicate the folder
fonts/my_font_3metadata
. - Rename it to be
fonts/my_font_printable
. - Open one
df.xls
in this folder with any supported editor. - Add new column named
text
. - Input the desired text (example:
t_uppercase.png
has textT
,a_version_slanted.png
has texta
,1.png
has text1
,smiley_face.png
has text😊
,word_the.png
has text^
).
Please note that only one-character symbols are supported. Probably. I don't remember.
At this moment in time the font is officially usable: it has enouh metadata. The printed results will most likely be odd — letter spacing is incorrect, tall images are placed wrong, etc.
- Open the
step4_Editor.py
file withSpyder
. - Scroll to the bottom.
- Adjust the
my_font_folder
variable. - Choose the menu option "Run"->"Run".
- Two
GUI windows
will show up:
- Click on any letter in the
GUI window with letters
. - The letter will become highlighted by red border, and the lines will appear:
- Use
W
,A
,S
,D
to adjust the letter's position relative to its neighbouring letters. - When satisfied, press
ENTER
- In the
Font Browser
GUI window press theSave changes
button. - In the
Font Browser
GUI window press theRe-render
button. - Choose another letter to edit.
Press the `
key to toggle different editor modes: the "default" one and the "relative to the previous letter" one.
After this, attempt to print the document via step5_Printer.py
again, and see if the results are better.
The user may further enhance the font by using the step10_Marker.py
editor.
The user may further enhance the font by manually adding the previous letter
values into the df.xls
files.
The actual licenses are available at the beginning of each source code file; superficial overview:
- The
GUI
elements that rely on thePyQt5
library are generally subject to GPL v3. - Modules that don't rely on the
PyQt5
library are generally subject to Apache 2.0.
Any unmarked file is implied to be subject to Apache 2.0.