diff options
| author | Claudine Peyrat <88194877+claudinepeyrat06@users.noreply.github.com> | 2025-07-27 10:15:58 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-27 10:15:58 +0200 |
| commit | 9ac1dbfa98a640f731183543c45c8ed8fd222139 (patch) | |
| tree | e1661bcd6aec05f9ccdb746067304c1efab0a1dd /lib/extensions/lettering_svg_font_to_layers.py | |
| parent | 1ddceafe91f1e2d8c2a9969bb86dfb7c163887cd (diff) | |
Update lettering_svg_font_to_layers.py (#3883)
* Update lettering_svg_font_to_layers.py
when we get a glyph from the Private Unicode Area, the entry point has no meaning, but hopefully we can get some good information from the glyph_name
* Update font_info.py
kerning information must be associated to the right nanme glyph layer in case of PUA letters
* remove commented code
Diffstat (limited to 'lib/extensions/lettering_svg_font_to_layers.py')
| -rw-r--r-- | lib/extensions/lettering_svg_font_to_layers.py | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/lib/extensions/lettering_svg_font_to_layers.py b/lib/extensions/lettering_svg_font_to_layers.py index 0bcd7003..323c941a 100644 --- a/lib/extensions/lettering_svg_font_to_layers.py +++ b/lib/extensions/lettering_svg_font_to_layers.py @@ -167,9 +167,38 @@ class LetteringSvgFontToLayers(InkstitchExtension): Converts a single glyph into a new SVG layer, applying scaling and coordinate transformation. """ unicode_char = glyph.get("unicode") - if unicode_char is None or unicodedata.category(unicode_char[0])[0] != "Z": - # all unicode with category starting with 'Z' is not rendered, no need to create layers with path.d ="" + glyph_name = glyph.get("glyph-name").split('.') + # if we are in the PUA zone, then we need to find the information in the glyph_name + if unicode_char is None or ord(unicode_char[0]) >= 57344: + if len(glyph_name) == 2: + unicode_char = glyph_name[0] + else: + return + + typographic_feature = '' + if len(glyph_name) == 2: + typographic_feature = glyph_name[1] + else: + arabic_form = glyph.get('arabic-form', None) + if arabic_form is not None and len(arabic_form) > 4: + typographic_feature = arabic_form[:4] + if typographic_feature: + typographic_feature = f".{typographic_feature}" + + layer = self.svg.add(Layer.new(f"GlyphLayer-{unicode_char}{typographic_feature}")) + + # glyph layers (except the first one) are initially hidden + if hide_layer: + layer.style["display"] = "none" + + # Using curve description in d attribute of svg:glyph + path = layer.add(PathElement()) + path.path = self.flip_cordinate_system(glyph, emsize, baseline, scale_by) + + unicode_char = glyph.get("unicode") + if unicode_char is None: + glyph_name = glyph.get("glyph-name").split('.') if unicode_char is None: if len(glyph_name) == 2: |
