stumpapp / stump

A free and open source comics, manga and digital book server with OPDS support (WIP)
https://stumpapp.dev
MIT License
919 stars 40 forks source link

[FEATURE] More fonts #377

Open hollisticated-horse opened 1 month ago

hollisticated-horse commented 1 month ago

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 :

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 commented 1 month ago

Font Licensing

Fonts of interest

KOReader default Fonts

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

Some Nice Fonts Examples

JMicheli commented 1 month ago

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.

aaronleopold commented 1 month ago

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

JMicheli commented 1 month ago

Hey thanks for adding the font licenses. Very helpful!

hollisticated-horse commented 1 month ago

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

From what I understand, both OFL;

2) 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 ?

aaronleopold commented 1 month ago

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 commented 1 month ago

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