fondi 0.2.1.dev21__tar.gz → 0.2.1.dev23__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fondi-0.2.1.dev21/src/fondi.egg-info → fondi-0.2.1.dev23}/PKG-INFO +1 -1
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/pyproject.toml +1 -1
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/backends/svg.py +11 -1
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23/src/fondi.egg-info}/PKG-INFO +1 -1
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/tests/test.py +6 -1
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/tests/test_svg.py +14 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/LICENSE +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/MANIFEST.in +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/readme.md +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/setup.cfg +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/__init__.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/backends/__init__.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/backends/pillow.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/fileloader.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/layout/__init__.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/layout/cases.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/layout/decoration.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/layout/delimiter_data.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/layout/delimiter_geom.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/layout/fraction.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/layout/helper.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/layout/ignore.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/layout/integral.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/layout/layout.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/layout/parenthesis.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/layout/scene_builder.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/layout/spaces.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/layout/sqrt.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/layout/supersub.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/layout/symbols.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/layout/text.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/mathtext.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/metrics.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/parser/__init__.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/parser/helper.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/parser/parser.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/parser/tokens.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/path_util.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/plain/__init__.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/plain/helper.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/plain/image.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/plain/plain.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/plain/symbol.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/raster_symbols.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/NewCM10-Italic.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/NewCM10-Regular.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/__init__.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/cmu.serif-roman.ttf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/contour-integral.png +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCM08-Book.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCM08-BookItalic.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCM08-Italic.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCM08-Regular.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCM08Devanagari-Book.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCM08Devanagari-Regular.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCM10-Bold.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCM10-BoldItalic.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCM10-Book.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCM10-BookItalic.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCM10-Italic.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCM10-Regular.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCM10Devanagari-Bold.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCM10Devanagari-Book.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCM10Devanagari-Regular.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMMath-Book.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMMath-Regular.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMMono10-Bold.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMMono10-BoldOblique.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMMono10-Book.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMMono10-BookItalic.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMMono10-Italic.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMMono10-Regular.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMSans08-Book.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMSans08-BookOblique.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMSans08-Oblique.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMSans08-Regular.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMSans10-Bold.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMSans10-BoldOblique.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMSans10-Book.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMSans10-BookOblique.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMSans10-Oblique.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMSans10-Regular.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMUncial08-Bold.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMUncial08-Book.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMUncial08-Regular.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMUncial10-Bold.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMUncial10-Book.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMUncial10-Regular.otf +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/__init__.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/integral.png +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/normpara_left.png +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/normpara_right.png +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/tuborpara_left.png +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/tuborpara_right.png +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/scene.py +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi.egg-info/SOURCES.txt +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi.egg-info/dependency_links.txt +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi.egg-info/requires.txt +0 -0
- {fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi.egg-info/top_level.txt +0 -0
|
@@ -85,6 +85,14 @@ def _fondi_y_to_svg(y: float, scene_height: float) -> float:
|
|
|
85
85
|
return scene_height - y
|
|
86
86
|
|
|
87
87
|
|
|
88
|
+
def _ascii_safe_svg_markup(svg: str) -> str:
|
|
89
|
+
"""Replace non-ASCII with numeric entities for pdflatex / includesvg."""
|
|
90
|
+
return "".join(
|
|
91
|
+
ch if ord(ch) < 128 else f"&#{ord(ch)};"
|
|
92
|
+
for ch in svg
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
|
|
88
96
|
def _flip_x_transform(x: float, width: float) -> str:
|
|
89
97
|
cx = round(x + width / 2, 3)
|
|
90
98
|
return f"translate({cx},0) scale(-1,1) translate({-cx},0)"
|
|
@@ -203,7 +211,9 @@ def render_svg(
|
|
|
203
211
|
group = SubElement(root, "g")
|
|
204
212
|
for node in scene.children:
|
|
205
213
|
_append_node(group, node, height)
|
|
206
|
-
return '<?xml version="1.0" encoding="UTF-8"?>\n' +
|
|
214
|
+
return '<?xml version="1.0" encoding="UTF-8"?>\n' + _ascii_safe_svg_markup(
|
|
215
|
+
tostring(root, encoding="unicode")
|
|
216
|
+
)
|
|
207
217
|
|
|
208
218
|
|
|
209
219
|
def save_svg_bundle(
|
|
@@ -16,7 +16,7 @@ class TestMethods:
|
|
|
16
16
|
def __createMathText__(self, mathtext, filename, fontsize=50, color=(255,255,255,255)):
|
|
17
17
|
txt = fondi.MathText(mathtext, fontsize, color)
|
|
18
18
|
txt.image.save(BASEDIR / filename)
|
|
19
|
-
|
|
19
|
+
txt.save_svg(BASEDIR / filename.replace('.png', '.svg'))
|
|
20
20
|
|
|
21
21
|
def testPolynomen(self):
|
|
22
22
|
self.__createMathText__('2*x_{5}^{2}+7^{2}_{1}', 'images/polynomen.png')
|
|
@@ -87,6 +87,11 @@ class TestMethods:
|
|
|
87
87
|
self.__createMathText__('a_{ijk} + b^{xyz} + c_{a+b}^{m+n} + a_{bc_{ak}}', 'images/subscript_multiple_characters.png')
|
|
88
88
|
|
|
89
89
|
|
|
90
|
+
def testGreekLetters(self):
|
|
91
|
+
self.__createMathText__('\\alpha + \\beta + \\gamma + \\Gamma + \\delta + \\Delta + \\eta + \\epsilon + \\theta + \\kappa + \\mu + \\lambda + \\tau + \\sigma + \\Sigma + \\phi + \\chi + \\psi + \\omega + \\Omega + \\pi + \\prime', 'images/greek_letters.png')
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
90
95
|
if __name__ == '__main__':
|
|
91
96
|
TestMethods().run()
|
|
92
97
|
#TestMethods().testPara()
|
|
@@ -216,6 +216,19 @@ def test_square_brackets_in_cases_do_not_overlap_brace():
|
|
|
216
216
|
assert bracket_left > brace_right
|
|
217
217
|
|
|
218
218
|
|
|
219
|
+
def test_svg_greek_letters_are_ascii_safe():
|
|
220
|
+
mt = fondi.MathText(r"\alpha + \omega", 50, COLOR)
|
|
221
|
+
svg = mt.to_svg(embed_fonts=False)
|
|
222
|
+
assert "ω" not in svg
|
|
223
|
+
assert "α" not in svg
|
|
224
|
+
assert "ω" in svg
|
|
225
|
+
assert "α" in svg
|
|
226
|
+
root = ET.fromstring(svg)
|
|
227
|
+
texts = [el.text for el in root.iter() if el.tag.endswith("text")]
|
|
228
|
+
assert "ω" in texts
|
|
229
|
+
assert "α" in texts
|
|
230
|
+
|
|
231
|
+
|
|
219
232
|
def test_save_svg_skip_copy_fonts():
|
|
220
233
|
import tempfile
|
|
221
234
|
|
|
@@ -282,5 +295,6 @@ if __name__ == "__main__":
|
|
|
282
295
|
test_round_parens_use_vector_delimiters()
|
|
283
296
|
test_square_brackets_in_cases_do_not_overlap_brace()
|
|
284
297
|
test_save_svg_skip_copy_fonts()
|
|
298
|
+
test_svg_greek_letters_are_ascii_safe()
|
|
285
299
|
write_gallery()
|
|
286
300
|
print(f"test_svg: ok — SVG files written to {SVG_DIR}")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCM08Devanagari-Book.otf
RENAMED
|
File without changes
|
{fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCM08Devanagari-Regular.otf
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCM10Devanagari-Bold.otf
RENAMED
|
File without changes
|
{fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCM10Devanagari-Book.otf
RENAMED
|
File without changes
|
{fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCM10Devanagari-Regular.otf
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMMono10-BoldOblique.otf
RENAMED
|
File without changes
|
|
File without changes
|
{fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMMono10-BookItalic.otf
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMSans08-BookOblique.otf
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMSans10-BoldOblique.otf
RENAMED
|
File without changes
|
|
File without changes
|
{fondi-0.2.1.dev21 → fondi-0.2.1.dev23}/src/fondi/resources/fonts/NewCMSans10-BookOblique.otf
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|