Skip to content

Commit

Permalink
README: Updated usage instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
sakshamarora1 committed Feb 19, 2021
1 parent e3ff348 commit cf77e9c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,21 @@ Your form should look like this:

1. Make sure you have installed `handwrite`, `potrace` & `fontforge`.

2. In a terminal type `handwrite (PATH_TO_IMAGE) (OUTPUT_DIRECTORY)`.
2. In a terminal type `handwrite [PATH TO IMAGE or DIRECTORY WITH IMAGES] [OUTPUT DIRECTORY]`.
(You can also type `handwrite -h`, to see all the arguments you can use).

3. Your font will be created as `OUTPUT_DIRECTORY/OUTPUT_FONT_NAME.ttf`. Install the font in your system.
3. (Optional) Config file containing custom options for your font can also be passed using
the `--config [CONFIG FILE]` or `--config [DIRECTORY WITH CONFIG FILES]` argument.

<blockquote>
Note:

- If passing a directory, make sure to rename the config files to the corresponding sheet names.
- If a single config file is passed for multiple inputs, that config will be used for all the inputs.
- If no config file is provided for an input then the [default config file](handwrite/default.json) is used.
</blockquote>

3. Your font will be created as `OUTPUT DIRECTORY/OUTPUT FONT NAME.ttf`. Install the font in your system.

4. Select your font in your word processor and get to work!

Expand Down
10 changes: 5 additions & 5 deletions handwrite/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def converters(sheet, characters_dir, output_directory, config):
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"sheet", help="Path to sample sheet/directory with multiple sample sheets"
"input_path", help="Path to sample sheet/directory with multiple sample sheets"
)
parser.add_argument("output_directory", help="Directory Path to save font output")
parser.add_argument(
Expand All @@ -44,11 +44,11 @@ def main():
if os.path.isdir(args.config):
configs_dir = args.config

if os.path.isdir(args.sheet):
if os.path.isdir(args.input_path):
configs_dir = configs_dir or directory + os.sep + "configs"
os.makedirs(configs_dir, exist_ok=True)

for sheet_name in sorted(os.listdir(args.sheet)):
for sheet_name in sorted(os.listdir(args.input_path)):
config_file = (
configs_dir + os.sep + os.path.splitext(sheet_name)[0] + ".json"
)
Expand All @@ -62,13 +62,13 @@ def main():
os.makedirs(characters_dir, exist_ok=True)

converters(
args.sheet + os.sep + sheet_name,
args.input_path + os.sep + sheet_name,
characters_dir,
args.output_directory,
config_file,
)
else:
converters(args.sheet, directory, args.output_directory, args.config)
converters(args.input_path, directory, args.output_directory, args.config)

if not args.directory:
shutil.rmtree(directory)

0 comments on commit cf77e9c

Please sign in to comment.