Closed kidyudiqy closed 6 months ago
Seconding that I'm getting the exact same issue (updated all nodes and python libraries today) on my Ubuntu VM.
@Suzie1 or any other contributor that sees this, I assume the naming convention was correct before the two new nodes were added but didn't really dig deep - this resolved the issue for me on Linux Mint(which should also work for Ubuntu/most other Debian flavors).
class CR_SelectFont:
@classmethod
def INPUT_TYPES(cls):
if platform.system() == "Windows":
system_root = os.environ.get("SystemRoot")
font_dir = os.path.join(system_root, "Fonts") if system_root else None
# The class was throwing a TypeError during page load/refresh.
# Added default debian-based Linux & MacOS font dirs
elif platform.system() == "Linux":
font_dir = "/usr/share/fonts/truetype"
elif platform.system() == "Darwin":
font_dir = "/System/Library/Fonts"
return {
"required": {
"font_name": (font_dir,),
}
}
RETURN_TYPES = ("STRING", "STRING")
RETURN_NAMES = ("font_name", "show_help")
FUNCTION = "select_font"
CATEGORY = icons.get("Comfyroll/Graphics/Text")
def select_font(self, font_name):
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Text-Nodes#cr-select-font"
return (
font_name,
show_help,
)
many thanks for reporting this
@slbillups I made this change. please can you test and let me know if its okay
@kidyudiqy Thanks for mentioning the local fonts. I may need to add this.
fixed in version: 1.71.1
Suzie
Running on Ubuntu 22.04. After I updated Comfyroll to the newest version (
Comfyroll Studio v1.66
) this error pops up:https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/3a9779f82cc2498cd8c1395c59b6a5832f672229/nodes/nodes_graphics_text.py#L457-L459 I think it's because linux doesn't have
SystemRoot
in its env vars.System-wide fonts on linux is usually found at
/usr/share/fonts
, but often fonts are installed locally for a user on their$HOME
folder instead, so you might want to also check~/.fonts
and~/.local/share/fonts
too.(Tangentially related: You can also install fonts on per-user basis on Windows, so you also need to check
C:\Users\{username}\AppData\Local\Microsoft\Windows\Fonts
too, I think.)