Update font.py (#848)

* Add new fonts
* Update old fonts
* Update lettering gui

Co-authored-by: Lex Neva
Co-authored-by: kalleen
pull/1025/head
LaureFR38 2021-02-04 16:40:02 +01:00 zatwierdzone przez GitHub
rodzic dac312f01f
commit 1cb501986f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
63 zmienionych plików z 88278 dodań i 74402 usunięć

Wyświetl plik

@ -40,6 +40,9 @@ jobs:
# for PyGObject
sudo apt install libgirepository1.0-dev
# for shapely
sudo apt install libgeos-dev
uname -a
python --version
python -m pip --version

Wyświetl plik

@ -0,0 +1,94 @@
This font has been adapted for Ink/Stitch by Célia Imbert Sabater, Claudette Venneugues-Aminot, Corinne Renaud, Françoise Lapierre Baillet, Laure Doisneau, Marie Françoise Bris
ORIGINAL FONT DOWNLOAD: https://fonts.google.com/specimen/Baumans#standard-styles
LICENSE: licensed under the Open Font License.
==========================
Baumans
==========================
Baumans is a font designed by Cyreal
Open Font License
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Wyświetl plik

@ -0,0 +1,203 @@
{
"name": "Baumans",
"description": "",
"leading": 40,
"auto_satin": false,
"default_glyph": "",
"min_scale": 0.8,
"max_scale": 1.5,
"horiz_adv_x_default": 93,
"horiz_adv_x_space": 37,
"horiz_adv_x": {
"!": 44,
"\"": 48,
"#": 97,
"$": 82,
"%": 145,
"&": 95,
"'": 25,
"(": 62,
")": 62,
"*": 75,
",": 34,
"-": 46,
".": 27,
"\/": 52,
"0": 95,
"1": 51,
"2": 86,
"3": 86,
"4": 91,
"5": 86,
"6": 92,
"7": 72,
"8": 90,
"9": 92,
":": 27,
";": 41,
"<": 74,
">": 74,
"?": 85,
"@": 127,
"A": 98,
"B": 96,
"C": 85,
"D": 98,
"E": 82,
"F": 66,
"G": 99,
"H": 102,
"I": 37,
"J": 62,
"K": 88,
"L": 78,
"M": 128,
"N": 101,
"O": 126,
"P": 91,
"Q": 126,
"R": 92,
"S": 81,
"T": 79,
"U": 100,
"V": 97,
"W": 133,
"X": 91,
"Y": 87,
"Z": 84,
"[": 47,
"\\": 57,
"]": 47,
"_": 91,
"`": 40,
"a": 81,
"b": 96,
"c": 76,
"d": 94,
"e": 81,
"f": 51,
"g": 95,
"h": 83,
"i": 42,
"j": 38,
"k": 77,
"l": 43,
"m": 121,
"n": 84,
"p": 96,
"q": 94,
"r": 56,
"s": 73,
"t": 58,
"u": 84,
"v": 75,
"w": 110,
"x": 75,
"y": 80,
"z": 69,
"{": 61,
"|": 35,
"}": 65,
"~": 99,
"¡": 44,
"¢": 76,
"£": 88,
"¤": 96,
"¥": 87,
"¦": 35,
"§": 79,
"¨": 58,
"©": 132,
"ª": 57,
"«": 77,
"®": 132,
"¯": 46,
"°": 43,
"²": 47,
"³": 45,
"´": 40,
"µ": 80,
"¶": 96,
"·": 31,
"¸": 35,
"¹": 39,
"º": 68,
"»": 77,
"¼": 108,
"½": 109,
"¾": 109,
"¿": 85,
"À": 98,
"Á": 98,
"Â": 98,
"Ã": 98,
"Ä": 98,
"Å": 98,
"Æ": 143,
"Ç": 88,
"È": 82,
"É": 82,
"Ê": 82,
"Ë": 82,
"Ì": 37,
"Í": 37,
"Î": 37,
"Ï": 37,
"Ð": 98,
"Ñ": 100,
"Ò": 126,
"Ó": 126,
"Ô": 126,
"Õ": 126,
"Ö": 126,
"Ø": 134,
"Ù": 100,
"Ú": 100,
"Û": 100,
"Ü": 100,
"Ý": 87,
"Þ": 88,
"ß": 82,
"à": 81,
"á": 81,
"â": 81,
"ã": 81,
"ä": 81,
"å": 81,
"æ": 131,
"ç": 76,
"è": 81,
"é": 81,
"ê": 81,
"ë": 81,
"ì": 42,
"í": 42,
"î": 42,
"ï": 42,
"ð": 94,
"ñ": 84,
"ø": 91,
"ù": 84,
"ú": 84,
"û": 84,
"ü": 84,
"ý": 80,
"ÿ": 80,
"Œ": 177,
"œ": 144,
"ˆ": 61,
"˜": 69,
"–": 91,
"—": 115,
"": 45,
"": 45,
"": 34,
"“": 79,
"”": 79,
"„": 69,
"•": 66,
"": 47,
"": 47,
"€": 86
}
}

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 18 KiB

7549
fonts/baumans/←.svg 100644

File diff suppressed because one or more lines are too long

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 559 KiB

7344
fonts/baumans/→.svg 100644

File diff suppressed because one or more lines are too long

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 544 KiB

Wyświetl plik

@ -0,0 +1,10 @@
This font has been adapted for Ink/Stitch by Célia Imbert Sabater
ORIGINAL FONT DOWNLOAD: https://www.fonts4free.net/chopin-script-font.html
LICENSE: Public Domain
==========================
Chopin Script
==========================
Chopin script is a font from Claude Pelletier who is also known as Diogene

Wyświetl plik

@ -0,0 +1,196 @@
{
"name": "Chopin Script",
"description": "",
"leading": 60,
"reversible" : false,
"auto_satin": false,
"default_glyph": "",
"min_scale": 0.8,
"max_scale": 1.5,
"horiz_adv_x_default": 212,
"horiz_adv_x_space": 54,
"horiz_adv_x": {
"!": 65,
"\"": 53,
"#": 53,
"$": 74,
"%": 100,
"&": 170,
"'": 31,
"(": 68,
")": 68,
"*": 53,
"+": 67,
",": 48,
"-": 53,
".": 48,
"\/": 34,
"0": 104,
"1": 59,
"2": 90,
"3": 97,
"4": 94,
"5": 90,
"6": 96,
"7": 87,
"8": 104,
"9": 98,
":": 48,
";": 48,
"<": 63,
"=": 53,
">": 63,
"?": 104,
"@": 138,
"C": 186,
"D": 170,
"E": 194,
"F": 205,
"G": 182,
"H": 188,
"I": 157,
"J": 188,
"K": 210,
"L": 195,
"M": 224,
"N": 208,
"O": 120,
"P": 209,
"Q": 132,
"R": 227,
"S": 142,
"T": 198,
"U": 173,
"V": 119,
"W": 179,
"X": 146,
"Y": 209,
"Z": 135,
"[": 60,
"\\": 75,
"]": 60,
"^": 83,
"_": 100,
"`": 60,
"a": 85,
"b": 79,
"c": 77,
"d": 86,
"e": 61,
"f": 47,
"g": 69,
"h": 68,
"i": 47,
"j": 39,
"k": 67,
"l": 46,
"m": 106,
"n": 77,
"o": 73,
"p": 74,
"q": 74,
"r": 58,
"s": 49,
"t": 47,
"u": 83,
"v": 75,
"w": 110,
"x": 77,
"y": 76,
"z": 62,
"{": 80,
"|": 52,
"}": 80,
"~": 88,
"¡": 65,
"¢": 71,
"£": 138,
"¨": 56,
"«": 54,
"°": 91,
"´": 0,
"·": 100,
"¸": 36,
"»": 57,
"¼": 121,
"½": 121,
"¾": 121,
"¿": 104,
"Æ": 295,
"Ç": 186,
"È": 194,
"É": 194,
"Ê": 194,
"Ë": 194,
"Ì": 157,
"Í": 157,
"Î": 157,
"Ï": 157,
"Ñ": 208,
"Ò": 120,
"Ó": 120,
"Ô": 120,
"Õ": 120,
"Ö": 120,
"×": 60,
"Ù": 173,
"Ú": 173,
"Û": 173,
"Ü": 173,
"Ý": 209,
"ß": 72,
"à": 85,
"á": 85,
"â": 85,
"ã": 85,
"ä": 85,
"å": 85,
"æ": 100,
"ç": 77,
"è": 61,
"é": 61,
"ê": 61,
"ë": 61,
"ì": 47,
"í": 47,
"î": 47,
"ï": 47,
"ñ": 77,
"ò": 75,
"ó": 75,
"ô": 75,
"õ": 75,
"ö": 75,
"÷": 60,
"ø": 73,
"ù": 83,
"ú": 83,
"û": 83,
"ü": 83,
"ý": 76,
"ÿ": 76,
"Œ": 206,
"œ": 102,
"Š": 142,
"š": 49,
"Ÿ": 209,
"Ž": 135,
"ž": 62,
"–": 82,
"—": 120,
"": 0,
"": 31,
"": 48,
"“": 43,
"”": 43,
"„": 71,
"†": 91,
"‡": 91,
"•": 51,
"…": 120,
"‰": 125,
"": 34,
"": 34,
"€": 94
}
}

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 17 KiB

12646
fonts/chopin/→.svg 100644

File diff suppressed because one or more lines are too long

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 1.6 MiB

Wyświetl plik

@ -1,4 +1,5 @@
This font has been adapted for Ink/Stitch by @Augusa
Update 23/12/202
ORIGINAL FONT DOWNLOAD: https://www.fontsquirrel.com/fonts/dejavu-serif
LICENSE: https://www.fontsquirrel.com/license/dejavu-serif

Plik diff jest za duży Load Diff

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 16 KiB

File diff suppressed because one or more lines are too long

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 658 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 890 KiB

File diff suppressed because one or more lines are too long

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 658 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 940 KiB

File diff suppressed because one or more lines are too long

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 658 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 757 KiB

File diff suppressed because one or more lines are too long

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 658 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 880 KiB

Wyświetl plik

@ -2,13 +2,9 @@
"name": "Geneva Simple Sans Rounded",
"description": "Suitable for small fonts (8 to 20 mm)",
"leading": 16,
"letter_spacing": 2,
"word_spacing": 8,
"horiz_adv_x_space": 30,
"auto_satin": true,
"default_glyph": "<22>",
"min_scale": 0.75,
"max_scale": 2.0,
"kerning_pairs": {
"wo": -0.9
}
"max_scale": 2.0
}

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 38 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 433 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 433 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 433 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 433 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 433 KiB

Wyświetl plik

@ -2,13 +2,9 @@
"name": "Geneva Simple Sans",
"description": "Suitable for small fonts (6 to 15mm)",
"leading": 16,
"letter_spacing": 2.5,
"word_spacing": 9,
"horiz_adv_x_space": 34,
"auto_satin": true,
"default_glyph": "<22>",
"min_scale": 0.75,
"max_scale": 2.0,
"kerning_pairs": {
"wo": -0.9
}
"max_scale": 2.0
}

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 28 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 392 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 392 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 392 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 394 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 392 KiB

Wyświetl plik

@ -0,0 +1,94 @@
This font has been adapted for Ink/Stitch by Françoise Lapierre Baillet
ORIGINAL FONT DOWNLOAD: https://fonts.google.com/specimen/Lobster+Two#standard-styles
LICENSE: licensed under the Open Font License.
==========================
Lobster 2 Bold italic
==========================
Lobster 2 Bold italic is a font designed by Pablo Impallari
Open Font License
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Plik diff jest za duży Load Diff

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 20 KiB

16014
fonts/lobster/→.svg 100644

File diff suppressed because one or more lines are too long

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 811 KiB

Wyświetl plik

@ -2,13 +2,9 @@
"name": "Ink/Stitch Medium Font",
"description": "A basic font suited for medium-sized characters. The capital em is 0.6 inches wide at 100% scale. Can be scaled down to 75% or up to 150%. Every satin has contour underlay.",
"leading": 24,
"letter_spacing": 4.5,
"word_spacing": 13.5,
"horiz_adv_x_space": 51,
"auto_satin": true,
"default_glyph": "<22>",
"min_scale": 0.75,
"max_scale": 2.0,
"kerning_pairs": {
"wo": -0.9
}
"max_scale": 2.0
}

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 36 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 332 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 333 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 325 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 328 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 330 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 326 KiB

Wyświetl plik

@ -2,13 +2,9 @@
"name": "Ink/Stitch Small Font",
"description": "A font suited for small characters. The capital em is 0.2 inches wide at 100% scale. Can be scaled up to 300%.",
"leading": 8,
"letter_spacing": 1.5,
"word_spacing": 4.5,
"horiz_adv_x_space": 17,
"auto_satin": true,
"default_glyph": "<22>",
"min_scale": 1.0,
"max_scale": 3.0,
"kerning_pairs": {
"wo": -0.3
}
"max_scale": 3.0
}

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 42 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 329 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 330 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 323 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 325 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 324 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 322 KiB

Wyświetl plik

@ -1,14 +1,226 @@
{
"name": "TT Directors",
"description": "A font suited for directing",
"leading": 20,
"letter_spacing": 1.0,
"word_spacing": 4.5,
"auto_satin": true,
"default_glyph": "?",
"min_scale": 1.0,
"max_scale": 5.0,
"kerning_pairs": {
"wo": -0.3
}
}
"leading": 20,
"auto_satin": true,
"default_glyph": "?",
"min_scale": 1.0,
"max_scale": 5.0,
"horiz_adv_x_default": 34,
"horiz_adv_x_space": 14,
"horiz_adv_x": {
"!": 17,
"\"": 27,
"#": 47,
"$": 30,
"%": 53,
"&": 35,
"'": 14,
"(": 22,
")": 22,
"*": 32,
"+": 33,
",": 15,
"-": 31,
".": 15,
"\/": 36,
"1": 25,
"2": 30,
"3": 31,
"4": 35,
"5": 30,
"6": 33,
"7": 29,
"8": 32,
"9": 33,
":": 17,
";": 17,
"<": 35,
"=": 30,
">": 35,
"?": 30,
"@": 53,
"A": 32,
"C": 32,
"E": 27,
"F": 27,
"G": 33,
"I": 19,
"J": 19,
"K": 33,
"L": 26,
"M": 46,
"P": 33,
"S": 30,
"T": 29,
"U": 35,
"V": 32,
"W": 49,
"X": 32,
"Y": 33,
"Z": 27,
"[": 24,
"\\": 36,
"]": 24,
"^": 29,
"_": 27,
"`": 18,
"{": 28,
"|": 19,
"}": 28,
"~": 30,
"¤": 35,
"¦": 19,
"§": 27,
"©": 80,
"«": 39,
"¬": 31,
"®": 80,
"°": 32,
"±": 33,
"µ": 27,
"¶": 40,
"·": 15,
"»": 39,
"–": 31,
"—": 44,
"": 15,
"": 15,
"": 15,
"“": 30,
"”": 30,
"„": 30,
"†": 35,
"‡": 35,
"•": 20,
"…": 49,
"‰": 75,
"": 27,
"": 27,
"a": 32,
"c": 32,
"e": 27,
"f": 27,
"g": 33,
"i": 19,
"j": 19,
"k": 33,
"l": 26,
"m": 46,
"p": 33,
"s": 30,
"t": 29,
"u": 35,
"v": 32,
"w": 49,
"x": 32,
"y": 33,
"z": 27
},
"kerning_pairs": {
"Aw": 1,
"Av": 1,
"AW": 1,
"AV": 1,
"BT": 1,
"Fz": 2,
"Ft": 1,
"Fs": 1,
"Fa": 2,
"Lw": 2,
"Lv": 2,
"Tx": 3,
"Tw": 3,
"Tv": 3,
"Ts": 3,
"Tq": 3,
"To": 3,
"Tm": 3,
"Tf": 3,
"VA": 1,
"WA": 1,
"Yx": 2,
"Yw": 2,
"Yv": 3,
"Ys": 3,
"Yq": 3,
"Yo": 3,
"Ym": 3,
"\"A": 2,
"'A": 2,
"`A": 2,
"A": 2,
"A": 2,
"“A": 2,
"”A": 2,
"-T": 3,
"–T": 3,
"—T": 3,
"-Y": 3,
"–Y": 3,
"—Y": 3,
"A\"": 2,
"A'": 2,
"A`": 2,
"A": 2,
"A": 2,
"A“": 2,
"A”": 2,
"AT": 2,
"AY": 3,
"Ay": 1,
"L\"": 4,
"L'": 4,
"L`": 4,
"L": 4,
"L": 4,
"L“": 4,
"L”": 4,
"L-": 3,
"L–": 3,
"L—": 3,
"Lt": 2,
"Ly": 2,
"T,": 3,
"T.": 3,
"T": 3,
"T„": 3,
"T…": 3,
"Ta": 3,
"Tc": 3,
"Td": 3,
"Te": 3,
"Tg": 3,
"Tn": 3,
"Tp": 3,
"Tr": 3,
"Tt": 3,
"Tu": 3,
"Ty": 3,
"Tz": 3,
"Y,": 3,
"Y.": 3,
"Y": 3,
"Y„": 3,
"Y…": 3,
"Y-": 3,
"Y–": 3,
"Y—": 3,
"YA": 2,
"Ya": 3,
"Yc": 3,
"Yd": 3,
"Ye": 3,
"Yg": 3,
"Yn": 3,
"Yp": 3,
"Yr": 3,
"Yt": 2,
"Yu": 3,
"Yy": 2,
"Yz": 2,
"t-": 2,
"t–": 2,
"t—": 2
}
}

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 33 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 198 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 198 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 201 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 200 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 198 KiB

Wyświetl plik

@ -2,15 +2,139 @@
"name": "TT Masters",
"description": "A font suited for heavy typing :)",
"leading": 22,
"letter_spacing": 1.5,
"word_spacing": 7,
"auto_satin": true,
"default_glyph": "?",
"min_scale": 1.0,
"max_scale": 3.0,
"kerning_pairs": {
"wo": -0.3,
"vo": -0.3
}
}
"horiz_adv_x_default": 63,
"horiz_adv_x_space": 22,
"horiz_adv_x": {
"D": 62,
"E": 54,
"F": 54,
"G": 60,
"H": 67,
"I": 32,
"J": 60,
"K": 65,
"L": 50,
"M": 81,
"N": 61,
"O": 61,
"P": 56,
"Q": 60,
"R": 58,
"S": 53,
"T": 58,
"U": 65,
"W": 76,
"X": 59,
"Y": 57,
"Z": 58,
"!": 33,
"\"": 36,
"#": 78,
"$": 54,
"%": 70,
"'": 21,
"(": 34,
")": 36,
"*": 31,
"+": 47,
",": 22,
"-": 46,
".": 22,
"\/": 50,
"0": 56,
"1": 37,
"2": 53,
"3": 49,
"4": 53,
"5": 55,
"6": 52,
"7": 51,
"8": 57,
"9": 56,
";": 25,
":": 25,
"<": 46,
">": 46,
"?": 53,
"@": 78,
"C": 58,
"[": 45,
"\\": 56,
"]": 45,
"{": 38,
"|": 33,
"}": 42,
"~": 49,
"¦": 29,
"§": 46,
"©": 72,
"«": 55,
"»": 55,
"¬": 51,
"¶": 54,
"·": 22,
"®": 80,
"°": 34,
"±": 48,
"µ": 50,
"–": 71,
"—": 90,
"”": 41,
"“": 41,
"†": 44,
"‡": 46,
"€": 57,
"•": 32,
"": 33,
"‰": 92,
"": 31,
"_": 41,
"`": 28,
"A": 59,
"": 22,
"": 22,
"": 22,
"…": 68,
"¤": 61,
"^": 44,
"„": 41,
"a": 59,
"b": 58,
"c": 58,
"d": 62,
"e": 54,
"f": 54,
"g": 60,
"h": 67,
"i": 32,
"j": 60,
"k": 65,
"l": 50,
"m": 81,
"n": 61,
"o": 61,
"p": 56,
"q": 60,
"r": 58,
"s": 53,
"t": 58,
"u": 65,
"w": 76,
"x": 59,
"y": 57,
"z": 58,
"B": 58
},
"kerning_pairs": {
"GZ": 2,
"TA": 3,
"TJ": 10,
"YA": 2,
"YJ": 7,
"AY": 2
}
}

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 43 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 373 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 373 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 373 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 375 KiB

Plik diff jest za duży Load Diff

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 373 KiB

Wyświetl plik

@ -1,21 +1,23 @@
# -*- coding: UTF-8 -*-
from base64 import b64encode, b64decode
import json
import os
import sys
from base64 import b64decode, b64encode
import appdirs
import inkex
import wx
import wx.adv
from ..elements import nodes_to_elements
from ..gui import PresetsPanel, SimulatorPreview, info_dialog, SubtitleComboBox
from ..gui import PresetsPanel, SimulatorPreview, info_dialog
from ..i18n import _
from ..lettering import Font, FontError
from ..svg import get_correction_transform
from ..svg.tags import SVG_PATH_TAG, SVG_GROUP_TAG, INKSCAPE_LABEL, INKSTITCH_LETTERING
from ..utils import get_bundled_dir, DotDict, cache
from ..svg.tags import (INKSCAPE_LABEL, INKSTITCH_LETTERING, SVG_GROUP_TAG,
SVG_PATH_TAG)
from ..utils import DotDict, cache, get_bundled_dir
from .commands import CommandsExtension
@ -33,9 +35,23 @@ class LetteringFrame(wx.Frame):
self.preview = SimulatorPreview(self, target_duration=1)
self.presets_panel = PresetsPanel(self)
# font
self.font_selector_box = wx.StaticBox(self, wx.ID_ANY, label=_("Font"))
self.update_font_list()
self.font_chooser = wx.adv.BitmapComboBox(self, wx.ID_ANY, style=wx.CB_READONLY | wx.CB_SORT)
self.set_font_list()
self.font_chooser.Bind(wx.EVT_COMBOBOX, self.on_font_changed)
# font details
self.font_description = wx.StaticText(self, wx.ID_ANY)
# options
self.options_box = wx.StaticBox(self, wx.ID_ANY, label=_("Options"))
self.scale_spinner = wx.SpinCtrl(self, wx.ID_ANY, min=100, max=100, initial=100)
self.scale_spinner.Bind(wx.EVT_SPINCTRL, lambda event: self.on_change("scale", event))
self.back_and_forth_checkbox = wx.CheckBox(self, label=_("Stitch lines of text back and forth"))
self.back_and_forth_checkbox.Bind(wx.EVT_CHECKBOX, lambda event: self.on_change("back_and_forth", event))
@ -43,15 +59,7 @@ class LetteringFrame(wx.Frame):
self.trim_checkbox.Bind(wx.EVT_CHECKBOX, lambda event: self.on_change("trim", event))
# text editor
self.text_editor_box = wx.StaticBox(self, wx.ID_ANY, label=_("Text"))
self.update_font_list()
self.font_chooser = SubtitleComboBox(self, wx.ID_ANY, choices=self.get_font_names(),
subtitles=self.get_font_descriptions(), style=wx.CB_READONLY)
self.font_chooser.Bind(wx.EVT_COMBOBOX, self.on_font_changed)
self.scale_spinner = wx.SpinCtrl(self, wx.ID_ANY, min=100, max=100, initial=100)
self.scale_spinner.Bind(wx.EVT_SPINCTRL, lambda event: self.on_change("scale", event))
self.text_input_box = wx.StaticBox(self, wx.ID_ANY, label=_("Text"))
self.text_editor = wx.TextCtrl(self, style=wx.TE_MULTILINE | wx.TE_DONTWRAP)
self.text_editor.Bind(wx.EVT_TEXT, lambda event: self.on_change("text", event))
@ -73,7 +81,7 @@ class LetteringFrame(wx.Frame):
self.settings = DotDict({
"text": u"",
"back_and_forth": True,
"back_and_forth": False,
"font": None,
"scale": 100
})
@ -134,6 +142,28 @@ class LetteringFrame(wx.Frame):
info_dialog(self, _("Unable to find any fonts! Please try reinstalling Ink/Stitch."))
self.cancel()
def set_font_list(self):
for font in self.fonts.values():
image = font.preview_image
if image is not None:
image = wx.Image(font.preview_image)
"""
# I would like to do this but Windows requires all images to be the exact same size
# It might work with an updated wxpython version - so let's keep it here
# Scale to max 20 height
img_height = 20
width, height = image.GetSize()
scale_factor = height / img_height
width = int(width / scale_factor)
image.Rescale(width, img_height, quality=wx.IMAGE_QUALITY_HIGH)
"""
# Windows requires all images to have the exact same size
image.Rescale(300, 20, quality=wx.IMAGE_QUALITY_HIGH)
self.font_chooser.Append(font.name, wx.Bitmap(image))
else:
self.font_chooser.Append(font.name)
def get_font_names(self):
font_names = [font.name for font in self.fonts.itervalues()]
font_names.sort()
@ -149,19 +179,17 @@ class LetteringFrame(wx.Frame):
message = '''This text was created using the font "%s", but Ink/Stitch can't find that font. ''' \
'''A default font will be substituted.'''
info_dialog(self, _(message) % font_id)
try:
self.font_chooser.SetValueByUser(self.fonts_by_id[font_id].name)
self.font_chooser.SetValue(self.fonts_by_id[font_id].name)
except KeyError:
self.font_chooser.SetValueByUser(self.default_font.name)
self.font_chooser.SetValue(self.default_font.name)
self.on_font_changed()
@property
@cache
def default_font(self):
try:
return self.fonts[self.DEFAULT_FONT]
return self.fonts_by_id[self.DEFAULT_FONT]
except KeyError:
return self.fonts.values()[0]
@ -173,7 +201,36 @@ class LetteringFrame(wx.Frame):
font = self.fonts.get(self.font_chooser.GetValue(), self.default_font)
self.settings.font = font.id
self.scale_spinner.SetRange(int(font.min_scale * 100), int(font.max_scale * 100))
font_variants = font.has_variants()
# Update font description
color = (0, 0, 0)
description = font.description
if len(font_variants) == 0:
color = (255, 0, 0)
description = _('This font has no available font variant. Please update or remove the font.')
self.font_description.SetLabel(description)
self.font_description.SetForegroundColour(color)
self.font_description.Wrap(self.GetSize().width - 20)
if font.reversible:
self.back_and_forth_checkbox.Enable()
self.back_and_forth_checkbox.SetValue(bool(self.settings.back_and_forth))
else:
# The creator of the font banned the possibility of writing in reverse with json file: "reversible": false
self.back_and_forth_checkbox.Disable()
self.back_and_forth_checkbox.SetValue(False)
if font.auto_satin:
self.trim_checkbox.Enable()
self.trim_checkbox.SetValue(bool(self.settings.trim))
else:
self.trim_checkbox.Disable()
self.trim_checkbox.SetValue(False)
self.update_preview()
self.GetSizer().Layout()
def update_preview(self, event=None):
self.preview.update()
@ -255,27 +312,38 @@ class LetteringFrame(wx.Frame):
def __do_layout(self):
outer_sizer = wx.BoxSizer(wx.VERTICAL)
options_sizer = wx.StaticBoxSizer(self.options_box, wx.VERTICAL)
options_sizer.Add(self.back_and_forth_checkbox, 1, wx.EXPAND | wx.LEFT | wx.TOP | wx.RIGHT, 5)
options_sizer.Add(self.trim_checkbox, 1, wx.EXPAND | wx.LEFT | wx.TOP | wx.RIGHT | wx.BOTTOM, 5)
# font selection
font_selector_sizer = wx.StaticBoxSizer(self.font_selector_box, wx.VERTICAL)
font_selector_sizer.Add(self.font_chooser, 0, wx.EXPAND | wx.ALL, 10)
font_selector_sizer.Add(self.font_description, 1, wx.EXPAND | wx.ALL, 10)
outer_sizer.Add(font_selector_sizer, 0, wx.EXPAND | wx.LEFT | wx.TOP | wx.RIGHT, 10)
# options
left_option_sizer = wx.BoxSizer(wx.VERTICAL)
left_option_sizer.Add(self.back_and_forth_checkbox, 1, wx.EXPAND | wx.LEFT | wx.TOP | wx.RIGHT, 5)
left_option_sizer.Add(self.trim_checkbox, 1, wx.EXPAND | wx.LEFT | wx.TOP | wx.RIGHT | wx.BOTTOM, 5)
font_scale_sizer = wx.BoxSizer(wx.HORIZONTAL)
font_scale_sizer.Add(wx.StaticText(self, wx.ID_ANY, "Scale"), 0, wx.LEFT | wx.ALIGN_CENTRE_VERTICAL, 0)
font_scale_sizer.Add(self.scale_spinner, 0, wx.LEFT, 10)
font_scale_sizer.Add(wx.StaticText(self, wx.ID_ANY, "%"), 0, wx.LEFT | wx.ALIGN_CENTRE_VERTICAL, 3)
options_sizer = wx.StaticBoxSizer(self.options_box, wx.HORIZONTAL)
options_sizer.Add(left_option_sizer, 1, wx.EXPAND, 10)
options_sizer.Add(font_scale_sizer, 0, wx.RIGHT, 10)
outer_sizer.Add(options_sizer, 0, wx.EXPAND | wx.LEFT | wx.TOP | wx.RIGHT, 10)
font_sizer = wx.BoxSizer(wx.HORIZONTAL)
font_sizer.Add(self.font_chooser, 1, wx.EXPAND, 0)
font_sizer.Add(wx.StaticText(self, wx.ID_ANY, "Scale"), 0, wx.LEFT | wx.ALIGN_CENTRE_VERTICAL, 20)
font_sizer.Add(self.scale_spinner, 0, wx.LEFT, 10)
font_sizer.Add(wx.StaticText(self, wx.ID_ANY, "%"), 0, wx.LEFT | wx.ALIGN_CENTRE_VERTICAL, 3)
text_editor_sizer = wx.StaticBoxSizer(self.text_editor_box, wx.VERTICAL)
text_editor_sizer.Add(font_sizer, 0, wx.ALL | wx.EXPAND, 10)
text_editor_sizer.Add(self.text_editor, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, 10)
outer_sizer.Add(text_editor_sizer, 1, wx.EXPAND | wx.LEFT | wx.TOP | wx.RIGHT, 10)
# text input
text_input_sizer = wx.StaticBoxSizer(self.text_input_box, wx.VERTICAL)
text_input_sizer.Add(self.text_editor, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, 10)
outer_sizer.Add(text_input_sizer, 2, wx.EXPAND | wx.LEFT | wx.TOP | wx.RIGHT, 10)
# presets
outer_sizer.Add(self.presets_panel, 0, wx.EXPAND | wx.EXPAND | wx.ALL, 10)
buttons_sizer = wx.BoxSizer(wx.HORIZONTAL)
buttons_sizer.Add(self.cancel_button, 0, wx.ALIGN_RIGHT | wx.RIGHT, 10)
buttons_sizer.Add(self.apply_button, 0, wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM, 10)
buttons_sizer.Add(self.cancel_button, 0, wx.RIGHT, 10)
buttons_sizer.Add(self.apply_button, 0, wx.RIGHT | wx.BOTTOM, 10)
outer_sizer.Add(buttons_sizer, 0, wx.ALIGN_RIGHT, 10)
self.SetSizerAndFit(outer_sizer)

Wyświetl plik

@ -1,5 +1,4 @@
from dialogs import info_dialog, confirm_dialog
from electron import open_url
from presets import PresetsPanel
from simulator import EmbroiderySimulator, SimulatorPreview, show_simulator
from subtitle_combo_box import SubtitleComboBox
from .dialogs import confirm_dialog, info_dialog
from .electron import open_url
from .presets import PresetsPanel
from .simulator import EmbroiderySimulator, SimulatorPreview, show_simulator

Wyświetl plik

@ -1,85 +0,0 @@
import wx
import wx.adv
from wx.lib.wordwrap import wordwrap
class SubtitleComboBox(wx.adv.OwnerDrawnComboBox):
TITLE_FONT_SIZE = 12
SUBTITLE_FONT_SIZE = 10
# I'd love to make this 12 too, but if I do it seems to get drawn as 10
# initially no matter what I do.
CONTROL_FONT_SIZE = 12
MARGIN = 5
def __init__(self, *args, **kwargs):
self.titles = kwargs.get('choices', [])
subtitles = kwargs.pop('subtitles', {})
self.subtitles = [subtitles.get(title, '') for title in self.titles]
wx.adv.OwnerDrawnComboBox.__init__(self, *args, **kwargs)
self.control_font = wx.Font(pointSize=self.CONTROL_FONT_SIZE, family=wx.DEFAULT, style=wx.NORMAL, weight=wx.NORMAL)
self.title_font = wx.Font(pointSize=self.TITLE_FONT_SIZE, family=wx.DEFAULT, style=wx.NORMAL, weight=wx.NORMAL)
self.subtitle_font = wx.Font(pointSize=self.SUBTITLE_FONT_SIZE, family=wx.DEFAULT, style=wx.NORMAL, weight=wx.NORMAL)
def OnMeasureItemWidth(self, item):
# This _should_ allow us to set the width of the combobox to match the
# width of the widest title. In reality, this method is never called
# and I can't figure out why. We just use self.GetSize().GetWidth()
# instead and rely on the parent window to size us appropriately. Ugh.
title = self.titles[item]
# technique from https://stackoverflow.com/a/23529463/4249120
dc = wx.ScreenDC()
dc.SetFont(self.title_font)
return dc.GetTextExtent(title).GetWidth() + 2 * self.MARGIN
def OnMeasureItem(self, item):
title = self.titles[item]
subtitle = self.subtitles[item]
dc = wx.ScreenDC()
dc.SetFont(self.subtitle_font)
wrapped = wordwrap(subtitle, self.GetSize().GetWidth(), dc)
subtitle_height = dc.GetTextExtent(wrapped).GetHeight()
dc = wx.ScreenDC()
dc.SetFont(self.title_font)
title_height = dc.GetTextExtent(title).GetHeight()
return subtitle_height + title_height + 3 * self.MARGIN
def OnDrawBackground(self, dc, rect, item, flags):
if flags & wx.adv.ODCB_PAINTING_SELECTED:
# let the parent class draw the selected item so we don't
# hae to figure out the highlight color
wx.adv.OwnerDrawnComboBox.OnDrawBackground(self, dc, rect, item, flags)
else:
# alternate white and grey for the dropdown items, and draw the
# combo box itself as white
if flags & wx.adv.ODCB_PAINTING_CONTROL or item % 2 == 0:
background_color = wx.Colour(255, 255, 255)
else:
background_color = wx.Colour(240, 240, 240)
dc.SetBrush(wx.Brush(background_color))
dc.SetPen(wx.Pen(background_color))
dc.DrawRectangle(rect)
def OnDrawItem(self, dc, rect, item, flags):
if flags & wx.adv.ODCB_PAINTING_CONTROL:
# painting the selected item in the box
dc.SetFont(self.control_font)
dc.DrawText(self.titles[item], rect.x + self.MARGIN, rect.y + self.MARGIN)
else:
# painting the items in the popup
dc.SetFont(self.title_font)
title_height = dc.GetCharHeight()
dc.DrawText(self.titles[item], rect.x + self.MARGIN, rect.y + self.MARGIN)
dc.SetFont(self.subtitle_font)
subtitle = wordwrap(self.subtitles[item], self.GetSize().GetWidth(), dc)
dc.DrawText(subtitle, rect.x + self.MARGIN, rect.y + title_height + self.MARGIN * 2)

Wyświetl plik

@ -1,8 +1,8 @@
# -*- coding: UTF-8 -*-
from copy import deepcopy
import json
import os
from copy import deepcopy
import inkex
@ -11,7 +11,7 @@ from ..exceptions import InkstitchException
from ..i18n import _, get_languages
from ..stitches.auto_satin import auto_satin
from ..svg import PIXELS_PER_MM
from ..svg.tags import SVG_GROUP_TAG, SVG_PATH_TAG, INKSCAPE_LABEL
from ..svg.tags import INKSCAPE_LABEL, SVG_GROUP_TAG, SVG_PATH_TAG
from ..utils import Point
from .font_variant import FontVariant
@ -44,7 +44,11 @@ def localized_font_metadata(name, default=None):
# This may be a font packaged with Ink/Stitch, in which case the
# text will have been sent to CrowdIn for community translation.
# Try to fetch the translated version.
return _(self.metadata.get(name))
original_metadata = self.metadata.get(name)
localized_metadata = ""
if original_metadata != "":
localized_metadata = _(original_metadata)
return localized_metadata
else:
return default
@ -103,20 +107,54 @@ class Font(object):
name = localized_font_metadata('name', '')
description = localized_font_metadata('description', '')
default_variant = font_metadata('default_variant', FontVariant.LEFT_TO_RIGHT)
default_glyph = font_metadata('defalt_glyph', u"<EFBFBD>")
letter_spacing = font_metadata('letter_spacing', 1.5, multiplier=PIXELS_PER_MM)
default_glyph = font_metadata('default_glyph', u"<EFBFBD>")
leading = font_metadata('leading', 5, multiplier=PIXELS_PER_MM)
word_spacing = font_metadata('word_spacing', 3, multiplier=PIXELS_PER_MM)
kerning_pairs = font_metadata('kerning_pairs', {})
auto_satin = font_metadata('auto_satin', True)
min_scale = font_metadata('min_scale', 1.0)
max_scale = font_metadata('max_scale', 1.0)
# use values from SVG Font, exemple:
# <font horiz-adv-x="45" ... <glyph .... horiz-adv-x="49" glyph-name="A" /> ... <hkern ... k="3"g1="A" g2="B" /> .... />
# Example font.json : "horiz_adv_x": {"A":49},
horiz_adv_x = font_metadata('horiz_adv_x', {})
# Example font.json : "horiz_adv_x_default" : 45,
horiz_adv_x_default = font_metadata('horiz_adv_x_default')
# Define by <glyph glyph-name="space" unicode=" " horiz-adv-x="22" />, Example font.json : "horiz_adv_x_space":22,
word_spacing = font_metadata('horiz_adv_x_space', 0)
reversible = font_metadata('reversible', True)
@property
def id(self):
return os.path.basename(self.path)
@property
def default_variant(self):
# Set default variant to any existing variant if default font file is missing
default_variant = font_metadata('default_variant', FontVariant.LEFT_TO_RIGHT)
font_variants = self.has_variants()
if default_variant not in font_variants and len(font_variants) > 0:
default_variant = font_variants[0]
return default_variant
@property
def preview_image(self):
preview_image_path = os.path.join(self.path, "preview.png")
if os.path.isfile(preview_image_path):
return preview_image_path
return None
def has_variants(self):
font_variants = []
for variant in FontVariant.VARIANT_TYPES:
if os.path.isfile(os.path.join(self.path, "%s.svg" % variant)):
font_variants.append(variant)
return font_variants
def render_text(self, text, destination_group, variant=None, back_and_forth=True, trim=False):
"""Render text into an SVG group element."""
self._load_variants()
@ -124,7 +162,7 @@ class Font(object):
if variant is None:
variant = self.default_variant
if back_and_forth:
if back_and_forth and self.reversible:
glyph_sets = [self.get_variant(variant), self.get_variant(FontVariant.reversed_variant(variant))]
else:
glyph_sets = [self.get_variant(variant)] * 2
@ -135,7 +173,7 @@ class Font(object):
line = line.strip()
letter_group = self._render_line(line, position, glyph_set)
if glyph_set.variant == FontVariant.RIGHT_TO_LEFT:
if back_and_forth and self.reversible and i % 2 == 1:
letter_group[:] = reversed(letter_group)
destination_group.append(letter_group)
@ -205,14 +243,25 @@ class Font(object):
we're at the start of the line or a word.
"""
node = deepcopy(glyph.node)
# Concerning min_x: I add it before moving the letter because it is to
# take into account the margin in the drawing of the letter. With respect
# to point 0 the letter can start at 5 or -5. The letters have a defined
# place in the drawing that's important.
# Then to calculate the position of x for the next letter I have to remove
# the min_x margin because the horizontal adv is calculated from point 0 of the drawing.
node = deepcopy(glyph.node)
if last_character is not None:
position.x += self.letter_spacing + self.kerning_pairs.get(last_character + character, 0) * PIXELS_PER_MM
position.x += glyph.min_x - self.kerning_pairs.get(last_character + character, 0)
transform = "translate(%s, %s)" % position.as_tuple()
node.set('transform', transform)
position.x += glyph.width
horiz_adv_x_default = self.horiz_adv_x_default
if horiz_adv_x_default is None:
horiz_adv_x_default = glyph.width + glyph.min_x
position.x += self.horiz_adv_x.get(character, horiz_adv_x_default) - glyph.min_x
return node

Wyświetl plik

@ -1,6 +1,7 @@
# -*- coding: UTF-8 -*-
import os
import inkex
import simplestyle
@ -45,6 +46,10 @@ class FontVariant(object):
return None
def __init__(self, font_path, variant, default_glyph=None):
# If the font variant file does not exist, this constructor will
# raise an exception. The caller should catch it and decide
# what to do.
self.path = font_path
self.variant = variant
self.default_glyph = default_glyph

Wyświetl plik

@ -64,21 +64,21 @@ class Glyph(object):
def _process_baseline(self, svg):
for guide in get_guides(svg):
if guide.label == "baseline":
self._baseline = guide.position.y
self.baseline = guide.position.y
break
else:
# no baseline guide found, assume 0 for lack of anything better to use...
self._baseline = 0
self.baseline = 0
def _process_bbox(self):
left, right, top, bottom = simpletransform.computeBBox(self.node.iterdescendants())
self.width = right - left
self._min_x = left
self.min_x = left
def _move_to_origin(self):
translate_x = -self._min_x
translate_y = -self._baseline
translate_x = -self.min_x
translate_y = -self.baseline
transform = "translate(%s, %s)" % (translate_x, translate_y)
for node in self.node.iter(SVG_PATH_TAG):