mike-engel/swiftvg

what about other attributes in svg?

MiladFaridnia opened this issue · 1 comments

Thanks for your perfect tool. I used that and its amazing. Just want to ask haw can convert other attributes in svg to UIBezeirPath. For example I have svg like this:

<path stroke-width="2" fill-rule="evenodd" fill="none" stroke="#444444" d="m229.75,-0.758c-0.943,0.374 -16.259,15.484 -18.043,17.801c-0.466,0.605 -1.498,1.751 -2.294,2.547c-0.795,0.795 -1.446,1.604 -1.446,1.796c0,0.193 -0.203,0.472 -0.45,0.622c-0.248,0.149 -0.821,0.798 -1.275,1.441c-0.864,1.227 -1.484,2.008 -2.712,3.418c-0.406,0.468 -0.986,1.232 -1.287,1.7c-0.301,0.467 -0.742,0.972 -0.98,1.121c-0.238,0.15 -0.433,0.494 -0.433,0.765c0,0.713 -0.378,0.615 -1.887,-0.489c-1.783,-1.306 -5.767,-3.436 -6.425,-3.436c-0.288,0 -0.524,-0.135 -0.524,-0.301c0,-0.165 -0.344,-0.379 -0.765,-0.475c-0.786,-0.18 -2.622,-0.808 -3.823,-1.308c-0.658,-0.274 -2.285,-0.696 -5.098,-1.322c-0.747,-0.167 -2.311,-0.31 -3.475,-0.318l-2.115,-0.015l-0.688,1.511c-0.379,0.831 -0.688,1.672 -0.688,1.869c0,0.197 -0.153,0.359 -0.34,0.359c-0.187,0 -0.341,0.267 -0.342,0.594c-0.001,0.327 -0.231,1.033 -0.51,1.569c-0.279,0.535 -0.508,1.124 -0.508,1.308c0,0.184 -0.222,0.816 -0.493,1.405c-0.272,0.589 -0.964,2.294 -1.54,3.79c-0.575,1.495 -1.175,3.024 -1.333,3.398c-0.55,1.303 -1.741,5.442 -1.736,6.032c0.002,0.328 -0.137,0.595 -0.311,0.595c-0.173,0 -0.421,0.843 -0.549,1.874c-0.129,1.03 -0.362,1.953 -0.519,2.049c-0.156,0.097 -0.388,1.089 -0.514,2.205c-0.126,1.116 -0.362,2.029 -0.525,2.029c-0.163,0 -0.296,0.229 -0.296,0.509c0,0.348 -0.378,0.524 -1.19,0.553c-1.256,0.044 -1.398,0.069 -2.209,0.383c-0.28,0.109 -1.552,0.292 -2.827,0.408c-1.275,0.115 -2.575,0.343 -2.889,0.505c-0.314,0.163 -1.565,0.573 -2.78,0.911c-1.215,0.337 -2.591,0.81 -3.058,1.049c-0.468,0.239 -1.118,0.436 -1.445,0.437c-0.327,0.001 -0.595,0.155 -0.595,0.342c0,0.187 -0.151,0.34 -0.337,0.34c-1.542,0 -3.051,1.228 -3.265,2.658c-0.478,3.188 0.83,21.515 1.591,22.304c0.562,0.582 0.328,1.439 -0.571,2.093c-4.375,3.181 -6.531,5.138 -10.931,9.923c-2.055,2.235 -2.917,5.503 -1.451,5.503c0.163,0 0.405,0.497 0.537,1.104c0.133,0.608 0.451,1.407 0.707,1.775c0.257,0.369 0.466,0.943 0.466,1.275c0,0.332 0.115,0.607 0.255,0.611c0.141,0.004 0.638,0.842 1.105,1.862c0.467,1.02 0.964,1.858 1.104,1.862c0.141,0.004 0.255,0.156 0.255,0.337c0,0.297 1.94,3.333 2.396,3.748c0.102,0.094 0.547,0.687 0.988,1.318l0.803,1.148l-0.819,1.571c-0.45,0.864 -0.898,1.647 -0.994,1.741c-0.337,0.326 -2.374,4.747 -2.385,5.175c-0.006,0.238 -0.235,0.729 -0.509,1.092c-0.275,0.363 -0.499,1.013 -0.499,1.444c0,0.432 -0.148,0.785 -0.328,0.785c-0.181,0 -0.43,0.768 -0.555,1.707c-0.125,0.939 -0.359,1.789 -0.522,1.889c-0.365,0.226 -0.394,2.861 -0.03,2.861c0.145,0 0.734,0.421 1.309,0.935c1.767,1.58 2.623,2.242 4.726,3.653c1.115,0.748 2.078,1.474 2.14,1.614c0.062,0.14 0.319,0.255 0.57,0.255c0.252,0 0.662,0.191 0.913,0.425c0.648,0.605 2.514,1.614 2.983,1.614c1.113,0 1.973,2.985 1.028,3.569c-0.204,0.126 -0.34,2.432 -0.34,5.777c0,3.345 0.136,5.651 0.34,5.777c0.187,0.116 0.34,1.108 0.34,2.205c0,2.417 0.432,2.946 2.638,3.23c0.886,0.114 1.916,0.378 2.29,0.587c0.394,0.22 3.213,0.446 6.705,0.538l6.025,0.159l0.216,1.147c0.118,0.631 0.337,1.223 0.487,1.316c0.149,0.092 0.375,0.779 0.501,1.525c0.126,0.747 0.369,1.358 0.539,1.358c0.171,0 0.311,0.268 0.311,0.595c0.001,0.327 0.459,1.512 1.019,2.633c0.559,1.122 1.017,2.231 1.018,2.464c0.001,0.234 0.125,0.425 0.276,0.425c0.151,0 0.648,0.84 1.105,1.866c0.456,1.026 0.944,1.867 1.084,1.869c0.14,0.002 0.258,0.195 0.261,0.428c0.004,0.234 0.475,1.171 1.048,2.083l1.041,1.658l1.904,-0.224c1.047,-0.123 2.067,-0.352 2.266,-0.509c0.199,-0.157 0.974,-0.395 1.721,-0.53c0.748,-0.134 1.513,-0.352 1.7,-0.483c0.187,-0.131 1.219,-0.524 2.294,-0.874c1.074,-0.35 1.954,-0.758 1.954,-0.906c0,-0.148 0.535,-0.369 1.189,-0.492c0.654,-0.123 1.19,-0.342 1.19,-0.488c0,-0.146 0.382,-0.361 0.849,-0.479c0.468,-0.117 0.85,-0.351 0.85,-0.519c0,-0.169 0.459,-0.408 1.019,-0.531c0.561,-0.123 1.02,-0.364 1.02,-0.536c0,-0.899 1.325,0.016 4.346,3c4.166,4.115 5.786,5.523 6.354,5.523c0.243,0 0.53,0.229 0.638,0.51c0.107,0.28 0.417,0.509 0.688,0.509c0.27,0 0.543,0.116 0.605,0.258c0.186,0.422 2.901,2.461 3.277,2.461c0.192,0 0.399,0.115 0.461,0.255c0.685,1.54 5.019,3.218 6.032,2.334c1.138,-0.991 6.826,-6.66 6.826,-6.802c0,-0.082 0.612,-0.786 1.359,-1.564c0.748,-0.779 1.36,-1.532 1.36,-1.675c0,-0.229 0.387,-0.756 1.693,-2.304c0.19,-0.226 0.346,-0.559 0.346,-0.741c0,-0.181 0.191,-0.532 0.425,-0.779c0.234,-0.247 0.731,-1.06 1.105,-1.808c0.903,-1.808 2.412,-2.359 3.228,-1.179c0.093,0.135 0.819,0.355 1.614,0.487c0.794,0.133 1.444,0.366 1.444,0.519c0,0.152 0.918,0.383 2.04,0.513c1.122,0.13 2.118,0.364 2.214,0.519c0.096,0.156 1.052,0.389 2.124,0.518c1.071,0.13 2.106,0.361 2.298,0.513c0.192,0.152 1.568,0.385 3.058,0.518c1.491,0.132 2.786,0.348 2.88,0.479c0.168,0.238 4.193,0.745 10.705,1.349c3.703,0.344 4.248,0.144 4.248,-1.562c0,-0.421 0.144,-0.854 0.32,-0.963c0.176,-0.109 0.413,-0.92 0.527,-1.804c0.114,-0.883 0.343,-1.857 0.508,-2.162c0.166,-0.306 0.408,-1.53 0.537,-2.719c0.13,-1.19 0.406,-2.377 0.615,-2.639c0.257,-0.322 0.38,-3.205 0.381,-8.895l0.001,-8.419l0.977,-0.196c0.537,-0.108 1.407,-0.196 1.934,-0.196c0.526,0 1.038,-0.131 1.137,-0.291c0.099,-0.16 0.911,-0.384 1.804,-0.498c0.893,-0.114 2.007,-0.298 2.474,-0.409c0.467,-0.111 1.423,-0.289 2.124,-0.396c0.701,-0.107 1.274,-0.31 1.274,-0.45c0,-0.141 0.839,-0.361 1.864,-0.489c1.025,-0.128 1.943,-0.361 2.04,-0.517c0.096,-0.157 0.94,-0.39 1.874,-0.518c0.934,-0.129 1.778,-0.363 1.876,-0.522c0.098,-0.159 0.865,-0.391 1.704,-0.517c0.839,-0.126 1.601,-0.351 1.693,-0.5c0.092,-0.149 0.778,-0.374 1.524,-0.5c0.745,-0.126 1.434,-0.356 1.529,-0.51c0.095,-0.154 0.784,-0.384 1.529,-0.51c0.746,-0.126 1.442,-0.368 1.548,-0.539c0.105,-0.171 0.45,-0.311 0.766,-0.312c0.316,-0.002 0.985,-0.217 1.487,-0.478c0.501,-0.262 1.379,-0.578 1.95,-0.704c0.571,-0.125 1.126,-0.369 1.232,-0.542c0.107,-0.172 0.567,-0.313 1.024,-0.313c0.456,0 0.829,-0.141 0.829,-0.313c0,-0.172 0.469,-0.416 1.043,-0.542c0.573,-0.126 1.452,-0.443 1.954,-0.705c0.501,-0.261 1.179,-0.476 1.506,-0.477c0.327,-0.002 0.595,-0.155 0.595,-0.342c0,-0.187 0.268,-0.341 0.595,-0.341c1.031,-0.003 2.907,-1.333 2.533,-1.797c-0.182,-0.226 -0.437,-0.908 -0.567,-1.516c-0.13,-0.607 -0.377,-1.104 -0.549,-1.104c-0.172,0 -0.313,-0.191 -0.314,-0.425c-0.001,-0.234 -0.459,-1.342 -1.018,-2.464c-0.56,-1.121 -1.018,-2.23 -1.019,-2.464c0,-0.233 -0.137,-0.425 -0.304,-0.425c-0.167,0 -0.399,-0.382 -0.516,-0.849c-0.117,-0.467 -0.351,-0.85 -0.52,-0.85c-0.168,0 -0.407,-0.459 -0.53,-1.019c-0.123,-0.561 -0.327,-1.02 -0.454,-1.02c-0.126,0 -0.432,-0.457 -0.68,-1.016c-0.546,-1.235 -4.144,-6.585 -4.534,-6.744c-0.154,-0.062 -0.279,-0.261 -0.279,-0.441c0,-0.18 -0.353,-0.664 -0.783,-1.076c-0.431,-0.412 -1.156,-1.284 -1.611,-1.938c-0.455,-0.654 -2.091,-2.426 -3.635,-3.937c-3.113,-3.047 -3.211,-3.263 -1.873,-4.126c1.09,-0.703 2.19,-1.6 3.523,-2.873c0.525,-0.5 1.177,-1.036 1.45,-1.189c1.533,-0.862 17.882,-16.635 17.882,-17.252c0,-0.137 0.803,-1.055 1.784,-2.041c0.981,-0.986 2.014,-2.135 2.294,-2.552c0.28,-0.418 1.045,-1.334 1.699,-2.036c0.655,-0.702 2.107,-2.444 3.229,-3.873c1.121,-1.428 2.154,-2.598 2.294,-2.599c0.14,-0.002 0.255,-0.162 0.255,-0.357c0,-0.195 0.382,-0.767 0.849,-1.271c1.212,-1.307 1.105,-2.034 -0.34,-2.305c-0.654,-0.123 -1.189,-0.347 -1.189,-0.499c0,-0.151 -0.469,-0.378 -1.042,-0.504c-0.574,-0.125 -1.453,-0.443 -1.955,-0.704c-0.501,-0.262 -1.179,-0.477 -1.506,-0.478c-0.327,-0.001 -0.595,-0.141 -0.595,-0.312c0,-0.17 -0.611,-0.413 -1.359,-0.54c-0.748,-0.126 -1.359,-0.351 -1.359,-0.501c0,-0.149 -0.421,-0.352 -0.935,-0.451c-0.514,-0.099 -2.005,-0.569 -3.314,-1.044c-1.308,-0.475 -2.714,-0.87 -3.123,-0.878c-0.41,-0.008 -0.836,-0.163 -0.949,-0.344c-0.112,-0.182 -0.965,-0.431 -1.896,-0.555c-0.932,-0.123 -1.769,-0.346 -1.861,-0.496c-0.092,-0.149 -1.006,-0.376 -2.031,-0.504c-1.026,-0.128 -1.864,-0.352 -1.864,-0.498c0,-0.146 -1.225,-0.374 -2.721,-0.506c-1.496,-0.133 -2.798,-0.366 -2.892,-0.518c-0.094,-0.153 -1.702,-0.386 -3.574,-0.519c-1.871,-0.133 -3.484,-0.374 -3.585,-0.537c-0.1,-0.162 -1.626,-0.295 -3.391,-0.295c-2.625,0 -3.209,-0.093 -3.209,-0.51c0,-0.28 0.115,-0.51 0.255,-0.511c0.141,-0.001 0.534,-0.727 0.874,-1.614c0.341,-0.887 0.838,-2.115 1.105,-2.729c0.267,-0.614 0.485,-1.408 0.485,-1.764c0,-0.357 0.14,-0.735 0.311,-0.84c0.17,-0.106 0.413,-0.802 0.539,-1.548c0.126,-0.746 0.36,-1.437 0.52,-1.535c0.159,-0.099 0.393,-0.866 0.519,-1.706c0.126,-0.839 0.35,-1.6 0.498,-1.691c0.147,-0.092 0.373,-0.931 0.502,-1.865c0.128,-0.934 0.363,-1.778 0.522,-1.876c0.158,-0.098 0.393,-1.246 0.522,-2.55c0.128,-1.304 0.353,-2.371 0.5,-2.371c0.147,0 0.375,-1.185 0.507,-2.634c0.132,-1.448 0.353,-2.786 0.493,-2.973c0.139,-0.187 0.36,-1.258 0.491,-2.379c0.131,-1.122 0.3,-2.422 0.376,-2.889c0.155,-0.946 0.398,-3.215 0.673,-6.287c0.101,-1.122 0.27,-2.941 0.376,-4.044l0.193,-2.005l-1.925,0.199c-1.059,0.109 -2.106,0.346 -2.327,0.527c-0.22,0.182 -1.28,0.439 -2.355,0.572c-1.075,0.133 -1.954,0.362 -1.954,0.51c0,0.148 -0.765,0.374 -1.7,0.503c-0.934,0.128 -1.699,0.361 -1.699,0.517c0,0.156 -0.841,0.388 -1.869,0.517c-1.028,0.128 -1.869,0.369 -1.869,0.534c0,0.166 -0.262,0.301 -0.581,0.301c-0.703,0 -10.053,3.135 -10.295,3.452c-0.094,0.123 -0.744,0.331 -1.444,0.463c-0.701,0.131 -1.274,0.375 -1.274,0.541c0,0.166 -0.268,0.307 -0.595,0.313c-0.327,0.007 -1.206,0.307 -1.954,0.668c-0.747,0.362 -1.627,0.662 -1.954,0.669c-0.327,0.006 -0.595,0.164 -0.595,0.351c0,0.187 -0.188,0.34 -0.418,0.34c-0.451,0 -4.059,1.41 -4.34,1.696c-0.187,0.192 -2.611,1.356 -4.333,2.082c-0.607,0.256 -1.104,0.569 -1.104,0.696c0,0.126 -0.459,0.33 -1.02,0.454c-0.56,0.123 -1.019,0.364 -1.019,0.536c0,0.172 -0.211,0.313 -0.468,0.313c-0.258,0 -0.678,0.253 -0.935,0.562c-0.417,0.503 -0.489,0.44 -0.689,-0.595c-0.122,-0.636 -0.327,-1.539 -0.455,-2.006c-0.128,-0.467 -0.316,-1.232 -0.418,-1.699c-0.102,-0.467 -0.304,-1.003 -0.449,-1.19c-0.145,-0.187 -0.371,-0.913 -0.502,-1.614c-0.131,-0.701 -0.354,-1.274 -0.497,-1.274c-0.142,0 -0.356,-0.612 -0.476,-1.36c-0.119,-0.747 -0.351,-1.359 -0.515,-1.359c-0.164,0 -0.398,-0.535 -0.521,-1.19c-0.123,-0.654 -0.369,-1.189 -0.548,-1.189c-0.178,0 -0.324,-0.248 -0.324,-0.55c0,-0.303 -0.518,-1.412 -1.15,-2.464c-0.633,-1.053 -1.469,-2.548 -1.858,-3.323c-0.39,-0.775 -0.904,-1.62 -1.144,-1.878c-0.648,-0.698 -1.965,-2.602 -1.965,-2.841c0,-0.114 -0.192,-0.407 -0.425,-0.651c-0.234,-0.245 -0.654,-0.781 -0.935,-1.192c-1.745,-2.56 -2.577,-3.073 -4.045,-2.492m16.698,38.67c0.006,7.832 -1.175,15.313 -3.944,24.979c-0.295,1.028 -0.634,2.214 -0.754,2.634c-0.303,1.065 0.074,1.005 4.675,-0.742c5.194,-1.971 12.076,-4.001 19.146,-5.647c5.515,-1.283 17.842,-2.241 17.842,-1.386c0,3.685 -12.57,21.029 -22.679,31.291c-2.107,2.14 -3.716,3.991 -3.576,4.114c0.141,0.123 1.709,0.496 3.485,0.829c11.66,2.187 25.702,8.074 29.852,12.515l0.795,0.851l-2.494,1.674c-3.731,2.505 -8.003,4.958 -11.914,6.841c-6.523,3.141 -11.485,4.997 -23.167,8.665l-1.321,0.414l1.831,2.024c6.634,7.333 10.825,14.204 12.742,20.885c1.086,3.788 1.293,3.583 -4.106,4.085c-7.155,0.665 -14.959,-0.056 -26.452,-2.445c-3.928,-0.817 -3.703,-0.927 -3.288,1.609c1.415,8.641 -0.765,23.32 -3.371,22.694c-4.157,-0.998 -12.173,-6.187 -18.992,-12.293c-1.55,-1.387 -2.868,-2.465 -2.93,-2.394c-0.062,0.071 -0.837,1.582 -1.722,3.357c-3.81,7.647 -9.481,14.278 -11.352,13.276c-1.773,-0.949 -6.934,-10.439 -8.743,-16.079c-1.135,-3.538 -0.736,-3.46 -4.628,-0.9c-7.617,5.01 -13.123,6.651 -13.857,4.128c-0.872,-3 -0.709,-15.516 0.234,-17.975c0.179,-0.466 -0.144,-0.503 -2.649,-0.303c-4.888,0.39 -5.963,0.404 -8.696,0.115c-3.679,-0.39 -5.882,-1.152 -5.882,-2.035c0,-2.205 2.952,-9.083 5.822,-13.566c1.961,-3.062 1.962,-3.067 0.55,-3.67c-6.259,-2.674 -9.756,-4.94 -12.796,-8.293l-0.817,-0.901l0.975,-1.407c1.597,-2.304 5.632,-5.769 9.461,-8.124c4.179,-2.572 4.104,-2.357 1.87,-5.338c-3.74,-4.988 -7.094,-11.726 -7.213,-14.493c-0.11,-2.546 5.37,-4.48 13.787,-4.865c2.571,-0.118 4.673,-0.23 4.671,-0.249c-0.001,-0.019 -0.306,-2.328 -0.677,-5.132c-0.779,-5.876 -0.887,-15.24 -0.219,-19.031l0.419,-2.379l1.854,0.095c4.353,0.224 9.052,2.131 14.704,5.968c3.592,2.437 3.972,2.594 3.972,1.64c0,-4.597 11.725,-30.643 13.794,-30.643c2.655,0 9.216,11.065 12.083,20.376c1.266,4.115 1.231,4.093 3.026,1.912c6.344,-7.709 18.364,-18.2 27.171,-23.715l2.55,-1.597l0.461,1.257c0.325,0.883 0.463,3.076 0.467,7.374" id="path4"/>

And I want to convert it compeletly to UIBezierPath. All other attributes are important for me not just "d" attribute. Your online tool just accepts "d" attribute.

Hi @MiladFaridnia! Thanks for the feedback! At this time, I'm not able to dedicate enough time to this project for the complexity that multi-path/multi-attribute SVGs would incur. The extra attributes you have there wouldn't be hard to implement, but it then would mean that this project would need to parse more complex SVGs with nested elements, etc. If you would like to put together a PR, I'd be willing to review it, however.