stump icon indicating copy to clipboard operation
stump copied to clipboard

[FEATURE] More fonts

Open hollisticated-horse opened this issue 1 year ago • 10 comments

Is your feature request related to a problem? Please describe.

Be able to use different fonts in Stump.

Describe the solution you'd like

WIP Proposal:

Add multiple fonts :

  • System wide
    • as mentioned in #122, the opendyslexic font is essential.
    • add an option both for admins and regular users to change the system font
  • For the epub reader
    • Having a couple of fonts for both sans-serif and serif types.
    • I have a personnal preference for Libre Baskerville.
    • change the fonts in the reading preferences per users, as well as in the epub reader.

Describe alternatives you've considered One interesting thing is that I believe that epubs sometimes have fonts embeded in the file. So for the epub reader, maybe use the fonts or not.

Additional context Will add if anything comes up

hollisticated-horse avatar Jul 31 '24 18:07 hollisticated-horse

Font Licensing

  • SIL OFL (Open Font License)
  • GPL
  • Apache

Fonts of interest

KOReader default Fonts

  • Noto Sans OFL
  • Noto Serif OFL
  • FreeSans GPL
  • FreeSerif (same) GPL
  • Droid Sans Mono Apache
  • ChareInk ?
  • Conforta OFL

Please, if anyone has other fonts that could make the cut, leave a comment :grin:

Some Nice Fonts Examples

hollisticated-horse avatar Aug 07 '24 19:08 hollisticated-horse

I think that including font options would be nice, though it likely requires some changes to make sure we can properly embed the fonts server side to provide to the client (someone correct me if I'm wrong in thinking this).

Given that Stump would be supplying the fonts, and presumably including them in the repo, do we know that each of these fonts has no licensing restrictions that we'd run into problems with? An annoying detail to think about, but still one that should be considered.

JMicheli avatar Aug 07 '24 19:08 JMicheli

I think that including font options would be nice, though it likely requires some changes to make sure we can properly embed the fonts server side to provide to the client (someone correct me if I'm wrong in thinking this).

It would be client-side only, I don't think anything would really change on the server. There is already a 'custom' font declaration, so if any were to be added it would just be a matter of shoving them there for the most part.

I'm personally much more inclined to support mapping custom fonts, e.g. one could optionally mount a directory to /fonts which contains all the font declarations. This could piggyback off of the (future) custom theme feature, which funny enough I forgot to write up into a separate issue lol see https://github.com/stumpapp/stump/issues/227#issuecomment-1872654422

Edit to add that I created the issue: https://github.com/stumpapp/stump/issues/383

That being said, I think a few others can be baked in so long as it doesn't bloat the bundle too much (with preference to accessibility-focused fonts).

An annoying detail to think about [license restrictions], but still one that should be considered.

Good point! Anything baked into the repo has to follow licensing guidelines. The two listed (GPL and SIL OFL) seem to be ✅ on the surface, but I'd have to be sure before any commitment

aaronleopold avatar Aug 07 '24 19:08 aaronleopold

Hey thanks for adding the font licenses. Very helpful!

JMicheli avatar Aug 07 '24 19:08 JMicheli

Thank you @JMicheli, your comment got me going to look for the licensing.

From what I understand, both OFL;

  1. Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user.

and GPL:

  1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

Are okay to use for Stump (most fonts from google fonts for example follow one of those licenses).

I think it's a neat idea to just select a few (4 by default at most, for example) + the opendyslexique one. The rest can indeed be added manually via a font dir.

Would all fonts be usable for : System and reader texts ?

hollisticated-horse avatar Aug 07 '24 20:08 hollisticated-horse

Are okay to use for Stump

After a little time last night reviewing OFL, any of those should be good to use directly (i.e. providing them as part of Stump).

The GPL ones I am not as sure about, but can get back to you 👍

Would all fonts be usable for : System and reader texts ?

Yes, ideally both. However I'd make the reader a separate configuration from the general app font configuration

aaronleopold avatar Aug 08 '24 14:08 aaronleopold

As of https://github.com/stumpapp/stump/pull/386, the OpenDyslexic font was added and I've outlined how to properly bundle a font in the webapp on the documentation website (the site will be re-deployed when I release 0.0.5).

In my spare time, I'll try to add 1-2 more OFL-licensed fonts. I'll also accept PRs, so long as the font additions aren't too large (in file size). Please also be aware of the note in the linked PR:

This PR does not include any logic to isolate font selection for the epub reader. I plan to tackle that at a later date with other epub-related changes

I will close this issue after I implement the above

aaronleopold avatar Aug 12 '24 14:08 aaronleopold

I think at least a sans serif and a serif would be nice to have. Maybe make a open call for fonts for the stump ui (non-epub).

hollisticated-horse avatar Oct 15 '24 16:10 hollisticated-horse

Actually, maybe just having the stump default and opendyslexique is enough.

hollisticated-horse avatar Oct 15 '24 16:10 hollisticated-horse

Yeah sorry, I haven't had the time to go through and add any additional fonts yet. There are a few other items in-flight at the moment, but I'll try to get them out in either 0.0.8 or 0.0.9

aaronleopold avatar Oct 15 '24 16:10 aaronleopold

Another fantastic font is Atkinson-Hyperlegible from the Braille Institute.

As the name says, it's a hyperlegible font tailored to

improve legibility and readability for individuals with low vision.

OFL1.1

hollisticated-horse avatar Feb 25 '25 02:02 hollisticated-horse

@hollisticated-horse I'm going to commit to getting at least one of your suggested fonts in nightly within 2 weeks. Sorry it's taking a bit!

aaronleopold avatar Feb 25 '25 02:02 aaronleopold

@aaronleopold While I truly appreciate it, there are no expectations on my end. You build wonderful free open-source software. I'm a person dropping in with some opinion/requests. I'm just happy to contribute a tiny bit.

hollisticated-horse avatar Feb 25 '25 02:02 hollisticated-horse

I've added the following during lunch today:

  • Atkinson Hyperlegible
  • Charis SIL
  • Literata

I'm open to adding 1-2 more, but can't find woff files for some of the original suggestions. If you can help me find some woffs for another you'd like me to add, I'll include it with those 3. I'm polishing a really basic way to set the font in the epub reader itself, I'll come back with a UI update once I have something viable.

Oh also I did add those 3 as well as Bitter and OpenDyslexic to the mobile app. The epub reader isn't ready there, though.

aaronleopold avatar Feb 26 '25 19:02 aaronleopold

Amazing !! So that makes 3 serifs (Bitter, Charis, Literata), 2 sans-serif (Atkinson Hyperlegible and Inter) and 1 special (OpenDyslexic). I'll have a look at another sans-serif.

hollisticated-horse avatar Feb 27 '25 01:02 hollisticated-horse

So that makes 3 serifs (Bitter, Charis, Literata), 2 sans-serif (Atkinson Hyperlegible and Inter) and 1 special (OpenDyslexic)

To be clear, I only added bitter to the mobile app. That app takes ttf or otf, the web app needs woff or woff2 files.

aaronleopold avatar Feb 27 '25 22:02 aaronleopold

If you download them from google fonts, there should be woff/woff2, as well as ttf/otf.

  • https://fonts.google.com/specimen/Charis+SIL
  • https://fonts.google.com/specimen/Literata
  • https://fonts.google.com/specimen/Libre+Baskerville
  • https://fonts.google.com/specimen/Atkinson+Hyperlegible+Next

and here is an arbitrary sans serif font:

  • https://fonts.google.com/specimen/Nunito

hollisticated-horse avatar Feb 28 '25 10:02 hollisticated-horse

For whatever reason I seem to only be able to download ttf from Google, however I can go to their embedded code section and manually download the woffs that way. Maybe that's what you meant? Edit to add I also found https://github.com/google/fonts/

Regardless, I'll add the Libre and Nunito fonts and finalize the changes into a PR sometime later today 🙂

aaronleopold avatar Feb 28 '25 14:02 aaronleopold

The additional fonts are available in nightly

aaronleopold avatar Mar 01 '25 22:03 aaronleopold