From: Nathan Williams Date: Thu, 17 Nov 2022 23:16:15 +0000 (-0800) Subject: GFK: Set max vector image size to 1500KB (#5574) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b8164a99d4c2706aac9691aba4367be45a2716a;p=thirdparty%2Fgoogle%2Ffonts.git GFK: Set max vector image size to 1500KB (#5574) * Set max vector image size to 1500KB * Set max vector image size to 1500KB * Increase SVG size limit to 1.6MB * Replace oversized SVG with a red X for now. * Increase SVG size limit to 1750 KB --- diff --git a/.github/workflows/knowledge_graph.py b/.github/workflows/knowledge_graph.py index c6a7070c94..563c30612d 100644 --- a/.github/workflows/knowledge_graph.py +++ b/.github/workflows/knowledge_graph.py @@ -11,7 +11,8 @@ import sys from typing import Callable, Iterable, List, Mapping, NamedTuple, Optional, Tuple, Set, Union -MAX_IMAGE_SIZE_KB = 800 +MAX_RASTER_IMAGE_SIZE_KB = 800 +MAX_VECTOR_IMAGE_SIZE_KB = 1750 def _topic_target_to_path(_: Set[str], target: str) -> str: @@ -245,6 +246,14 @@ def _check_proto_files(knowledge: KnowledgeContent) -> bool: return result +def _is_svg(image_file: Path) -> bool: + return image_file.suffix == '.svg' + + +def _is_svg(image_file: Path) -> bool: + return image_file.suffix == '.svg' + + def _check_image_files(knowledge: KnowledgeContent) -> bool: result = True image_files = list(knowledge.knowledge_dir.glob("**/images/*")) @@ -259,9 +268,14 @@ def _check_image_files(knowledge: KnowledgeContent) -> bool: if not has_view_box and not has_width_and_height: print("Must specify viewBox and/or width+height on :", image_file.relative_to(knowledge.knowledge_dir)) result = False - if image_file.suffix != ".svg" and image_file.stat().st_size > MAX_IMAGE_SIZE_KB * 1024: - print("File exceeds max size of %s KB:" % MAX_IMAGE_SIZE_KB, image_file.relative_to(knowledge.knowledge_dir)) - result = False + if not _is_svg(image_file): + if image_file.stat().st_size > MAX_RASTER_IMAGE_SIZE_KB * 1024: + print("File exceeds max size of %s KB:" % MAX_RASTER_IMAGE_SIZE_KB, image_file.relative_to(knowledge.knowledge_dir)) + result = False + else: + if image_file.stat().st_size > MAX_VECTOR_IMAGE_SIZE_KB * 1024: + print("File exceeds max size of %s KB:" % MAX_VECTOR_IMAGE_SIZE_KB, image_file.relative_to(knowledge.knowledge_dir)) + result = False return result diff --git a/cc-by-sa/knowledge/modules/readability/lessons/how_type_influences_readability/images/readability_06.svg b/cc-by-sa/knowledge/modules/readability/lessons/how_type_influences_readability/images/readability_06.svg index 6099200b40..6f18a37fef 100644 --- a/cc-by-sa/knowledge/modules/readability/lessons/how_type_influences_readability/images/readability_06.svg +++ b/cc-by-sa/knowledge/modules/readability/lessons/how_type_influences_readability/images/readability_06.svg @@ -1,44 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + +