1
0
mirror of https://github.com/konpa/devicon.git synced 2025-08-13 18:14:21 +02:00

Only check stroke for icons in devicon.json's font objects (#1491)

Co-authored-by: David Leal <halfpacho@gmail.com>
This commit is contained in:
Jørgen Kalsnes Hagen
2023-04-14 19:25:41 +02:00
committed by GitHub
parent 648b6068a3
commit c97a0bb00a
2 changed files with 21 additions and 7 deletions

View File

@@ -42,7 +42,7 @@ def main():
print("No SVGs to check, ending script.")
svg_err_msg = "Error checking SVGs: no SVGs to check. Might be caused by above issues."
else:
svg_err_msg = check_svgs(svgs)
svg_err_msg = check_svgs(svgs, filtered_icon)
err_msg = []
if devicon_err_msg != []:
@@ -163,7 +163,7 @@ def check_devicon_object(icon: dict):
return ""
def check_svgs(svg_file_paths: List[Path]):
def check_svgs(svg_file_paths: List[Path], devicon_object: dict):
"""
Check the width, height, viewBox and style of each svgs passed in.
The viewBox must be '0 0 128 128'.
@@ -195,10 +195,11 @@ def check_svgs(svg_file_paths: List[Path]):
err_msg.append("- 'viewBox' is not '0 0 128 128' -> Set it or scale the file using https://www.iloveimg.com/resize-image/resize-svg.")
# goes through all elems and check for strokes
for child in tree.iter():
if child.get("stroke") != None:
err_msg.append("- SVG contains `stroke` property. This will get ignored by Icomoon. Please convert them to fills.")
break
if util.is_svg_in_font_attribute(svg_path, devicon_object):
for child in tree.iter():
if child.get("stroke") != None:
err_msg.append("- SVG contains `stroke` property. This will get ignored by Icomoon. Please convert them to fills.")
break
if len(err_msg) > 1:
err_msgs.append("\n".join(err_msg))