Feat(text tool): Add import custom fonts#9091
Conversation
…t-custom-fonts # Conflicts: # invokeai/app/api/routers/utilities.py # invokeai/app/services/config/config_default.py # invokeai/frontend/web/public/locales/en.json # invokeai/frontend/web/src/services/api/endpoints/utilities.ts
|
@Pfannkuchensack What changed:
On the auth question: this router is not mounted behind a parent FastAPI dependency. Confirmed: I addressed that by making custom font availability reactive:
So this is no longer relying on an implicit re-render path. |
|
For variable fonts this should probably feature a thickness slider as opposed to picking the lightest weight. |
joshistoast
left a comment
There was a problem hiding this comment.
There's a few potential font readiness issues here, and a big potential issue for malformed font files getting served by the API.
I'd improve this further and make the font service registry live as a provider/service that mounts with the canvas instead of just the text toolbar, or a single shared loader API that both the toolbar and commit/render paths use directly. Right now the registry feels like global state whose source of truth is hidden behind one component, which is what creates the race/lifecycle issue I called out in textToolOptions.tsx
|
This feature is also going to need an entry in the docs |
|
Coming late to the game here, and I haven't looked at the code or tried it. That said, is this able to pull fonts directly from Google Fonts? |
…com/DustyShoe/InvokeAI into Feat(Text-tool)/import-custom-fonts
As stated in PR description this implementation only loads custom fonts from the host-managed
|
Added. I documented the custom font workflow in:
The docs now cover:
|
Agreed on the general direction, but this PR does not currently pick the lightest weight. Right now the backend collapses a family to a single dropdown entry by preferring:
So the representative face is intended to be the regular/default face, not the thinnest one. The family's discovered faces are still returned separately in the API and used for normal/bold/italic loading. A full variable-font weight/thickness control would be follow-up work. It would need:
I kept this PR scoped to importing and using custom font families within the existing text tool controls. |
|
I recommend that paths not have spaces and stick to the lowercase convention |
Updated in this PR. The custom font directory is now lowercase |
Great! Does this allow for a custom path via |
I did not include it here because it adds another persistent config surface, and I am not sure it is worth doing right now given the planned UI/tooling refactor unless there is a concrete use case for a non-default font directory. |

Summary
Add support for custom text-tool fonts loaded from
invokeai/Fonts.This feature lets users add their own font files without replacing the built-in font set. The backend now discovers and serves fonts from
invokeai/Fonts, creates the directory andREADME.txtautomatically, and parses font metadata to show clean family names. The frontend loads these fonts into the text tool, shows them separately from built-in fonts, and keeps built-in fonts as fallback when no custom fonts are available.Related Issues / Discussions
N/A
QA Instructions
.ttf,.otf,.woff, or.woff2files toinvokeai/Fontsinvokeai/Fontsis emptyinvokeai/frontend/web/src/services/api/schema.tswas regenerated after adding the new utilities endpointsMerge Plan
Standard merge.
Checklist
What's Newcopy (if doing a release after this PR)