diff --git a/CHANGELOG.md b/CHANGELOG.md index baee534..269d81c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Unreleased] ### Added +- Adding support for the S command letter in svg ### Changed ### Deprecated ### Removed diff --git a/svg2tikz/tikz_export.py b/svg2tikz/tikz_export.py index 1b99ef0..484e039 100644 --- a/svg2tikz/tikz_export.py +++ b/svg2tikz/tikz_export.py @@ -1124,8 +1124,9 @@ def convert_path_to_tikz(self, path): s += f" -- {self.coord_to_tz(tparams[0])}" # cubic bezier curve - elif letter == "C": + elif letter in ["C", "S"]: s += f".. controls {self.coord_to_tz(tparams[0])} and {self.coord_to_tz(tparams[1])} .. {self.coord_to_tz(tparams[2])}" + # s_point = 2 * tparams[2] - tparams[1] # quadratic bezier curve elif letter == "Q": diff --git a/tests/test_complete_files.py b/tests/test_complete_files.py index 3167756..ea848c8 100644 --- a/tests/test_complete_files.py +++ b/tests/test_complete_files.py @@ -169,6 +169,13 @@ def test_arc_direction(self): # Exemple taken from svg of the flag of the state of California filename = "R_letter_with_arc" create_test_from_filename(filename, self) + c + + def test_arc_direction(self): + """Test svg with S command inside it""" + # Exemple taken from svg of the flag of the state of California + filename = "s_command_letter" + create_test_from_filename(filename, self) if __name__ == "__main__": diff --git a/tests/testfiles/s_command_letter.svg b/tests/testfiles/s_command_letter.svg new file mode 100644 index 0000000..e504431 --- /dev/null +++ b/tests/testfiles/s_command_letter.svg @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/tests/testfiles/s_command_letter.tex b/tests/testfiles/s_command_letter.tex new file mode 100644 index 0000000..b88f252 --- /dev/null +++ b/tests/testfiles/s_command_letter.tex @@ -0,0 +1,23 @@ + +\documentclass{article} +\usepackage[utf8]{inputenc} +\usepackage{tikz} + +\begin{document} +\definecolor{cff5555}{RGB}{255,85,85} +\definecolor{c003cff}{RGB}{0,60,255} + + +\def \globalscale {1.000000} +\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] + \path[fill=cff5555] (6.6514, -0.2902).. controls (6.6119, -0.2902) and (6.5775, -0.2762) .. (6.5487, -0.2479).. controls (6.5199, -0.2196) and (6.5053, -0.1852) .. (6.5053, -0.1442).. controls (6.5053, -0.1032) and (6.5199, -0.0709) .. (6.5487, -0.0426).. controls (6.5775, -0.0143) and (6.6119, 0.0) .. (6.6514, 0.0).. controls (6.6908, 0.0) and (6.7265, -0.0143) .. (6.754, -0.0426).. controls (6.7815, -0.0709) and (6.7956, -0.1048) .. (6.7956, -0.1442).. controls (6.7956, -0.1836) and (6.7818, -0.2196) .. (6.754, -0.2479).. controls (6.7265, -0.2762) and (6.6921, -0.2902) .. (6.6514, -0.2902) -- cycle(6.5429, -1.4923) -- (6.5429, -0.5054) -- (6.7598, -0.5054) -- (6.7598, -1.4923) -- cycle; + + + + \path[fill=c003cff] (6.6514, -0.2902).. controls (6.6119, -0.2902) and (6.5775, -0.2762) .. (6.5487, -0.2479).. controls (6.5199, -0.2196) and (6.5053, -0.1852) .. (6.5053, -0.1442).. controls (6.5053, -0.1032) and (6.5199, -0.0709) .. (6.5487, -0.0426).. controls (6.5775, -0.0143) and (6.6119, -0.0) .. (6.6514, -0.0).. controls (6.6908, -0.0) and (6.7265, -0.0143) .. (6.754, -0.0426).. controls (6.7815, -0.0709) and (6.7956, -0.1048) .. (6.7956, -0.1442).. controls (6.7956, -0.1836) and (6.7818, -0.2196) .. (6.754, -0.2479).. controls (6.7265, -0.2762) and (6.6921, -0.2902) .. (6.6514, -0.2902) -- cycle; + + + + +\end{tikzpicture} +\end{document}