summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/extensions/__init__.py2
-rw-r--r--lib/extensions/lettering_update_json_glyphlist.py56
-rw-r--r--templates/lettering_update_json_glyphlist.xml33
3 files changed, 0 insertions, 91 deletions
diff --git a/lib/extensions/__init__.py b/lib/extensions/__init__.py
index 50a86b67..beafcc56 100644
--- a/lib/extensions/__init__.py
+++ b/lib/extensions/__init__.py
@@ -39,7 +39,6 @@ from .lettering_generate_json import LetteringGenerateJson
from .lettering_edit_json import LetteringEditJson
from .lettering_remove_kerning import LetteringRemoveKerning
from .lettering_set_color_sort_index import LetteringSetColorSortIndex
-from .lettering_update_json_glyphlist import LetteringUpdateJsonGlyphlist
from .letters_to_font import LettersToFont
from .object_commands import ObjectCommands
from .object_commands_toggle_visibility import ObjectCommandsToggleVisibility
@@ -109,7 +108,6 @@ __all__ = extensions = [About,
LetteringGenerateJson,
LetteringRemoveKerning,
LetteringSetColorSortIndex,
- LetteringUpdateJsonGlyphlist,
LettersToFont,
ObjectCommands,
ObjectCommandsToggleVisibility,
diff --git a/lib/extensions/lettering_update_json_glyphlist.py b/lib/extensions/lettering_update_json_glyphlist.py
deleted file mode 100644
index 6ceb0704..00000000
--- a/lib/extensions/lettering_update_json_glyphlist.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# Authors: see git history
-#
-# Copyright (c) 2010 Authors
-# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
-
-import json
-import os
-
-from inkex import errormsg
-
-from ..i18n import _
-from ..lettering import Font
-from .base import InkstitchExtension
-
-
-class LetteringUpdateJsonGlyphlist(InkstitchExtension):
- '''
- This extension helps font creators to generate the json file for the lettering tool
- '''
- def __init__(self, *args, **kwargs):
- InkstitchExtension.__init__(self, *args, **kwargs)
- self.arg_parser.add_argument("--notebook")
- self.arg_parser.add_argument("-d", "--font-dir", type=str, default="", dest="font_dir")
-
- def effect(self):
- # file paths
- font_dir = self.options.font_dir
- if not os.path.isdir(font_dir):
- errormsg(_("Please verify font folder path."))
- return
- json_file = self._get_json_file(font_dir)
-
- # glyphs
- font = Font(font_dir)
- font._load_variants()
- glyphs = font.get_variant(font.default_variant).glyphs
- glyphs = list(glyphs.keys())
-
- if not glyphs:
- return
-
- # read json file
- with open(json_file, 'r') as font_data:
- data = json.load(font_data)
-
- data['glyphs'] = glyphs
-
- # write data to the.json file
- with open(json_file, 'w', encoding="utf8") as font_data:
- json.dump(data, font_data, indent=4, ensure_ascii=False)
-
- def _get_json_file(self, font_dir):
- json_file = os.path.join(font_dir, "font.json")
- if not os.path.isfile(json_file):
- errormsg(_("Could not find json file. Please create one with Extensions > Ink/Stitch > Font Management > Generate JSON..."))
- return json_file
diff --git a/templates/lettering_update_json_glyphlist.xml b/templates/lettering_update_json_glyphlist.xml
deleted file mode 100644
index ac74cf1f..00000000
--- a/templates/lettering_update_json_glyphlist.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<inkscape-extension translationdomain="inkstitch" xmlns="http://www.inkscape.org/namespace/inkscape/extension">
- <name>Update Glyphlist</name>
- <id>org.{{ id_inkstitch }}.lettering_update_json_glyphlist</id>
- <param name="extension" type="string" gui-hidden="true">lettering_update_json_glyphlist</param>
-
- <param name="notebook" type="notebook">
- <page name="options" gui-text="Options">
- <param type="path" name="font-dir" gui-text="Font Folder" mode="folder"/>
- </page>
- <page name="info" gui-text="Help">
- <label appearance="header">Updates the glyphlist in the json file.</label>
- <spacer />
- <label>More information on our website</label>
- <label appearance="url">https://inkstitch.org/docs/font-tools/#update-glyph-list</label>
- </page>
- </param>
-
- <effect needs-live-preview="false">
- <object-type>all</object-type>
- <icon>{{ icon_path }}inx/font_management.svg</icon>
- <menu-tip>Updates the glyphlist in the json file</menu-tip>
- <effects-menu>
- <submenu name="{{ menu_inkstitch }}" translatable="no">
- <submenu name="Font Management" />
- </submenu>
- </effects-menu>
- </effect>
-
- <script>
- {{ command_tag | safe }}
- </script>
-</inkscape-extension>