Closed ivan-mogilko closed 1 month ago
@messengerbag , I added an alternate Fonts nodes as sub-nodes to Font Files. They co-exist with the linear fonts list and reflect same data (meaning, these are not separate data instances). This allows to test both ways of organizing these nodes in one editor. Currently you can add fonts (or "font styles" if you prefer that term) from context menu called either from "Fonts" folder or any of the FontFile nodes.
I suppose it would also help if there was some visual cue for each different kind of node... different icon, or text font or style used...
@AlanDrake could you please post the new icons that you made previously here, for easier reference?
I think this is ready for review.
Other things that were mentioned in #996, but not implemented here, are calling font items "Font Styles", and moving font files into "Fonts" subfolder on disk.
I am not a super fan of not renaming the font files, I see a few EndsWith(".ttf")
and similar, these all need to be case insensitive if we are keeping the original font name. If we renamed on import then these would be guaranteed to work in case sensitive.
I am not a super fan of not renaming the font files, I see a few
EndsWith(".ttf")
and similar, these all need to be case insensitive if we are keeping the original font name. If we renamed on import then these would be guaranteed to work in case sensitive.
Please elaborate, are there other arguments against not keeping original name, or just that I used incorrect comparison function in code? When you think that they should be renamed, do you mean only the letter case, or keeping old font name convention like "agsfntN.ext"?
Personally, I try to assume that the game may be constructed by gathering the files by hand, outside of the editor, so assuming filename case is not a good thing. I must therefore fix EndsWith usage.
EDIT: In regards to keeping original names, my main argument is that it's simply easier to identify the asset, than having a uniform name which differs only by number and extension.
I see a few
EndsWith(".ttf")
and similar, these all need to be case insensitive if we are keeping the original font name. If we renamed on import then these would be guaranteed to work in case sensitive.
BTW, I searched for EndsWith(".
and there are numerous cases like this throughout the Editor code.
I suppose that we need to replace these with a helper function, like TestFileExtension, that compares case insensitive.
Per @AlanDrake 's suggestion (posted elsewhere, maybe on Discord?), changed font file location to a "Fonts" subdirectory.
Fonts are copied over on project upgrade, and Editor even makes a folder backup if it existed previously, complying to how RoomComponent does this when upgrading rooms.
I had to modify "--runfromide" engine's command, because fonts are not packed when running a test game, editor must tell an extra directory to the engine. Existing arg list for "runfromide" is rather inconvenient, with hardcoded meaning for each entry. So I modified it to be a custom list of dirs paired with "asset filter" list (asset filters are used to narrow search of certain asset types). This change might come handy for other purposes later.
I think I've done everything that was planned here. The only missing feature (iirc) would be a font file's preview, but this may be added later when we decide how it should look like. I.e. maybe we might have a selection of a point size to preview. Then, the font's preview in general might benefit for improvement after unicode support. Perhaps an addition of a input field to type a text which you like to see rendered in this font.
Resolves #996
Summary:
Screenshots:
In order to test an alternate organization of font nodes, each font connected to the font file is also "mirrored" under respective font file node: