DistributedProofreaders / guiguts-py

Guiguts rewrite using Python/tkinter
GNU General Public License v2.0
2 stars 7 forks source link

Font management #66

Open tangledhelix opened 9 months ago

tangledhelix commented 9 months ago

Choose a default font (for each platform Win/Mac/Linux):

I would also propose bundling DP Sans Mono for easy use, if possible. I'm not sure how to install custom fonts on every platform, but on macOS I think adding font files to $HOME/Library/Fonts/ is sufficient.

"Linux" is actually a bunch of different platforms, really... I'll leave it for someone else to figure out what default fonts are available on any of them, since I have no clue about it...

srjfoo commented 9 months ago

Modern Macs should all come with Font Book, and all you should need to do is open that and navigate to where the downloaded font is and open it.

Caveat: The current version of DPSM that I have is, I think (though I haven't verified it for sure), the current version, and does not identify itself to at least some apps (Font Book and BBEdit, for sure) as a monospace font, though it behaves like one. (In Font Book, it sorts into All and User fonts for me.)

tangledhelix commented 9 months ago

That's true (about Font Book) but I was hoping to auto-install it, and reduce the amount of extra steps for users to take. All Font Book really does is provide a UI for this - I believe dropping font files into the right folder accomplishes the same thing.

(What I'm not sure about is whether filesystem sandboxing would prevent an install from happening.)

Regarding your caveat: I notice that if I look in my Font book, it has a filter for fixed-width fonts, and choosing it, DP Sans Mono is not there.

Screenshot 2023-12-19 at 1 30 34 AM

That filter checks that the "Design Style" field is set to "Monospaced". So it seems like that bit of metadata may not be set quite right in the DP Sans Mono font... too bad. Although it doesn't prevent it from working in Guiguts.

tangledhelix commented 9 months ago

Also, for what it's worth, it seems like bundling font files in apps may be common and we could do the same?

❯ find /Applications -type f -name '*.ttf' | wc -l
    1123
srjfoo commented 9 months ago

That's true (about Font Book) but I was hoping to auto-install it, and reduce the amount of extra steps for users to take. All Font Book really does is provide a UI for this - I believe dropping font files into the right folder accomplishes the same thing.

(What I'm not sure about is whether filesystem sandboxing would prevent an install from happening.)

Regarding your caveat: I notice that if I look in my Font book, it has a filter for fixed-width fonts, and choosing it, DP Sans Mono is not there.

Screenshot 2023-12-19 at 1 30 34 AM

That filter checks that the "Design Style" field is set to "Monospaced". So it seems like that bit of metadata may not be set quite right in the DP Sans Mono font... too bad. Although it doesn't prevent it from working in Guiguts.

Okay, that's fair. I missed the fact that you were thinking of an auto-install (I figured it would be easier for users to use Font Book than to manually move the font to the correct directlry.

I didn't know what exactly it was that caused DPSM not to be identified as monospaces, but figured it was some sort of metadata that was not set properly. And yes, same. In Font Book, DPSM is not identified as monospaced for me, either.

cpeel commented 9 months ago

I agree that having a sensible OS-specific default font is a great idea.

I don't think GG should be installing fonts on a user's system -- I've never seen any other app do that on any operating system. The more we can make GG act like "any other app" the easier it will be for users to know how to install / uninstall it.

I've no problem with bundling fonts and/or providing the user instructions for how to install them.

Also, for what it's worth, it seems like bundling font files in apps may be common and we could do the same?

Looks like ATSApplicationFontsPath is the macOS way to have apps use fonts included in their bundle.