From 16d6e9f74f51c1bf5c5624a0292a5c6defe2cd37 Mon Sep 17 00:00:00 2001 From: Dawood Date: Fri, 1 Nov 2024 01:46:58 -0400 Subject: [PATCH 1/3] fix --- gradio/routes.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gradio/routes.py b/gradio/routes.py index 1e40ed45a70e7..81f8bf422a6e0 100644 --- a/gradio/routes.py +++ b/gradio/routes.py @@ -595,8 +595,11 @@ def get_config(request: fastapi.Request): @app.get("/static/{path:path}") def static_resource(path: str): - static_file = routes_safe_join(STATIC_PATH_LIB, UserProvidedPath(path)) - return FileResponse(static_file) + if path.startswith(("fonts/ui-sans-serif/", "fonts/system-ui/")): + return Response(status_code=200) + else: + static_file = routes_safe_join(STATIC_PATH_LIB, UserProvidedPath(path)) + return FileResponse(static_file) @router.get("/custom_component/{id}/{environment}/{type}/{file_name}") def custom_component_path( From 983e97b2fbd100331d0d2ca922510425c68c90d3 Mon Sep 17 00:00:00 2001 From: gradio-pr-bot Date: Fri, 1 Nov 2024 05:48:28 +0000 Subject: [PATCH 2/3] add changeset --- .changeset/grumpy-snakes-pick.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/grumpy-snakes-pick.md diff --git a/.changeset/grumpy-snakes-pick.md b/.changeset/grumpy-snakes-pick.md new file mode 100644 index 0000000000000..8ddcc5c6ee679 --- /dev/null +++ b/.changeset/grumpy-snakes-pick.md @@ -0,0 +1,5 @@ +--- +"gradio": minor +--- + +feat:Fix fonts loading From 87ac4de1490063366a09f7e2c31264663ef777db Mon Sep 17 00:00:00 2001 From: Dawood Date: Wed, 20 Nov 2024 15:06:36 -0500 Subject: [PATCH 3/3] font fix --- gradio/themes/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradio/themes/base.py b/gradio/themes/base.py index 51230be69623d..dc11d8abbe2bb 100644 --- a/gradio/themes/base.py +++ b/gradio/themes/base.py @@ -469,13 +469,13 @@ def expand_shortcut(shortcut, mode="color", prefix=None): if isinstance(font, (fonts.Font, str)): font = [font] self._font = [ - fontfam if isinstance(fontfam, fonts.Font) else fonts.LocalFont(fontfam) + fontfam if isinstance(fontfam, fonts.Font) else fonts.Font(fontfam) for fontfam in font ] if isinstance(font_mono, (fonts.Font, str)): font_mono = [font_mono] self._font_mono = [ - fontfam if isinstance(fontfam, fonts.Font) else fonts.LocalFont(fontfam) + fontfam if isinstance(fontfam, fonts.Font) else fonts.Font(fontfam) for fontfam in font_mono ] self.font = ", ".join(str(font) for font in self._font)