diff --git a/modules/Roboto-Regular.ttf b/modules/Roboto-Regular.ttf new file mode 100644 index 000000000..500b1045b Binary files /dev/null and b/modules/Roboto-Regular.ttf differ diff --git a/modules/images.py b/modules/images.py index d8527179d..3b8b62d93 100644 --- a/modules/images.py +++ b/modules/images.py @@ -13,12 +13,12 @@ import numpy as np import piexif import piexif.helper from PIL import Image, ImageFont, ImageDraw, PngImagePlugin -from fonts.ttf import Roboto import string import json import hashlib from modules import sd_samplers, shared, script_callbacks, errors +from modules.paths_internal import roboto_ttf_file from modules.shared import opts LANCZOS = (Image.Resampling.LANCZOS if hasattr(Image, 'Resampling') else Image.LANCZOS) @@ -26,9 +26,9 @@ LANCZOS = (Image.Resampling.LANCZOS if hasattr(Image, 'Resampling') else Image.L def get_font(fontsize: int): try: - return ImageFont.truetype(opts.font or Roboto, fontsize) + return ImageFont.truetype(opts.font or roboto_ttf_file, fontsize) except Exception: - return ImageFont.truetype(Roboto, fontsize) + return ImageFont.truetype(roboto_ttf_file, fontsize) def image_grid(imgs, batch_size=1, rows=None): diff --git a/modules/paths_internal.py b/modules/paths_internal.py index a3d3e1f88..a23f6d706 100644 --- a/modules/paths_internal.py +++ b/modules/paths_internal.py @@ -22,3 +22,5 @@ models_path = os.path.join(data_path, "models") extensions_dir = os.path.join(data_path, "extensions") extensions_builtin_dir = os.path.join(script_path, "extensions-builtin") config_states_dir = os.path.join(script_path, "config_states") + +roboto_ttf_file = os.path.join(modules_path, 'Roboto-Regular.ttf') diff --git a/requirements.txt b/requirements.txt index 35987a135..2423bfd22 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,8 +2,6 @@ astunparse blendmodes accelerate basicsr -fonts -font-roboto gfpgan gradio==3.29.0 numpy diff --git a/requirements_versions.txt b/requirements_versions.txt index 476029044..df8c6861b 100644 --- a/requirements_versions.txt +++ b/requirements_versions.txt @@ -11,8 +11,6 @@ torch omegaconf==2.2.3 pytorch_lightning==1.9.4 scikit-image==0.19.2 -fonts -font-roboto timm==0.6.7 piexif==1.1.3 einops==0.4.1