Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature]: Support using system fonts #304

Merged

Conversation

kgarner7
Copy link
Collaborator

@kgarner7 kgarner7 commented Oct 14, 2023

Uses the experimental queryLocalFonts API, when prompted, to get the fonts and do CSS. Resolves #270 and also resolves #288 (by proxy)

Caveats/notes:

  • This is experimental, and is only supported by Chrome/Chromium/Edgeium (see https://caniuse.com/?search=querylocalfonts)
  • As far as I can tell, the only way to dynamically change the font (shown in https://wicg.github.io/local-font-access/#example-style-with-local-fonts) was by DOM manipulation; css variables did not seem to work
  • This shows all fonts, including their variants (bold/italic/etc); given that the style names could be localized, not sure of a way to parse this (on my system, for instance, I had 859 different combinations)
  • I made fonts a separate top-level setting because it was easier to manipulate without causing as many rerenders; feel free to put that back

Uses the **experimental** queryLocalFonts API, when prompted, to get the fonts and do CSS.
Resolves jeffvli#270 and jeffvli#288 (by proxy)

Caveats/notes:
- This is experimental, and is only supported by Chrome/Chromium/Edgeium (see https://caniuse.com/?search=querylocalfonts)
- As far as I can tell, the only way to dynamically change the font (shown in https://wicg.github.io/local-font-access/#example-style-with-local-fonts) was by DOM manipulation; css variables did not seem to work
- This shows **all** fonts, including their variants (bold/italic/etc); given that the style names could be localized, not sure of a way to parse this (on my system, for instance, I had 859 different combinations)
- I made fonts a separate top-level setting because it was easier to manipulate without causing as many rerenders; feel free to put that back
@vercel
Copy link

vercel bot commented Oct 14, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
feishin ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 17, 2023 4:09am

@Nik-mmzd
Copy link

Is it possible to add option to use "System default" font instead of choosing from every font installed? Or this option is already included to this PR?
After all, most operating systems allow the user to select a default font, and this font usually contains all the necessary characters (e.g. Cyrillic characters).

@kgarner7
Copy link
Collaborator Author

As far as I can tell, there's no way for the browser to tell this. Draft spec here: https://wicg.github.io/local-font-access/#dom-window-querylocalfonts.

@Nik-mmzd
Copy link

Perhaps it would be better to give the user the option to "upload" a custom font(s) to the app rather than querying all installing fonts using unstable API?

@kgarner7
Copy link
Collaborator Author

Since the font api has been in chrome since 103 (last year), I'd say it's stable there. I've added an Electron-only workaround that will allow providing a custom font by adding a custom protocol (feishin) that will proxy font files.

@jeffvli jeffvli merged commit 74cab01 into jeffvli:development Oct 22, 2023
2 checks passed
spiceratops referenced this pull request in spiceratops/k8s-gitops Oct 31, 2023
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [ghcr.io/jeffvli/feishin](https://togithub.com/jeffvli/feishin) |
minor | `0.4.1` -> `0.5.0` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>jeffvli/feishin (ghcr.io/jeffvli/feishin)</summary>

###
[`v0.5.0`](https://togithub.com/jeffvli/feishin/releases/tag/v0.5.0):
0.5.0

[Compare
Source](https://togithub.com/jeffvli/feishin/compare/v0.4.1...v0.5.0)

0.5.0 is here!

This release introduces localization (multi-language) support which is
now hosted on [weblate](https://hosted.weblate.org/projects/feishin/).
Visit the link if you would like to contribute a translation.

##### Added

- Added localization support via weblate
([#&#8203;74](https://togithub.com/jeffvli/feishin/issues/74))
- Added discord rich presence
([#&#8203;72](https://togithub.com/jeffvli/feishin/issues/72))
- Added `amd64`, `arm64`, and `armv7` Docker images
([#&#8203;336](https://togithub.com/jeffvli/feishin/issues/336)) (Thanks
[@&#8203;bubylou](https://togithub.com/bubylou))
- Added animated play indicator to currently playing track
([#&#8203;237](https://togithub.com/jeffvli/feishin/issues/237)) (Thanks
[@&#8203;kgarner7](https://togithub.com/kgarner7))
- Added `PUBLIC_PATH` Docker environment variable to allow customizing
the path Feishin is served from
([#&#8203;307](https://togithub.com/jeffvli/feishin/issues/307)) (Thanks
[@&#8203;kgarner7](https://togithub.com/kgarner7))
- Added system and custom font support
([#&#8203;270](https://togithub.com/jeffvli/feishin/issues/270),
[#&#8203;288](https://togithub.com/jeffvli/feishin/issues/288)) (Thanks
[@&#8203;kgarner7](https://togithub.com/kgarner7))
- Added customizable primary accent color
([#&#8203;282](https://togithub.com/jeffvli/feishin/issues/282)) (Thanks
[@&#8203;kgarner7](https://togithub.com/kgarner7))
- Added customizable playback speed
([#&#8203;94](https://togithub.com/jeffvli/feishin/issues/94)) (Thanks
[@&#8203;kgarner7](https://togithub.com/kgarner7))
- Added additional hotkeys
([#&#8203;326](https://togithub.com/jeffvli/feishin/issues/326)) (Thanks
[@&#8203;GermanDarknes](https://togithub.com/GermanDarknes))
    -   Favorite/unfavorite current song
    -   Favorite/unfavorite previous song

##### Changed

- Changed `Rating` component functionality from \[double click to clear]
-> \[click on the same rating to clear]
([#&#8203;332](https://togithub.com/jeffvli/feishin/issues/332)) (Thanks
[@&#8203;kgarner7](https://togithub.com/kgarner7))
- (Jellyfin) Change hardcoded Jellyfin DeviceID values to include
hostname and username
([#&#8203;312](https://togithub.com/jeffvli/feishin/issues/312)) (Thanks
[@&#8203;LilyRose2798](https://togithub.com/LilyRose2798))
- Fullscreen player now uses dynamic image resolution based on window
size ([#&#8203;290](https://togithub.com/jeffvli/feishin/issues/290))
(Thanks [@&#8203;TacoCake](https://togithub.com/TacoCake))
- Poster carousel now resets to initial position on data refresh
([#&#8203;285](https://togithub.com/jeffvli/feishin/issues/285)) (Thanks
[@&#8203;kgarner7](https://togithub.com/kgarner7))
- (Navidrome) Artist images are now always attmepted to be fetched even
when it is potentially unvailable
([#&#8203;317](https://togithub.com/jeffvli/feishin/issues/317)) (Thanks
[@&#8203;kgarner7](https://togithub.com/kgarner7))
- Window title now displays `SONG_NAME — ARTIST_NAME` instead of
`SONG_NAME`

##### Fixed

- (MPV player) Fixed MPV playing the same track twice after toggling
repeat ([#&#8203;292](https://togithub.com/jeffvli/feishin/issues/292))
(Thanks [@&#8203;kgarner7](https://togithub.com/kgarner7))
- (WEB player) Fixed queue not pausing on the last track when repeat is
disabled
([#&#8203;291](https://togithub.com/jeffvli/feishin/issues/291))
- (Navidrome) Fixed artist year filter becoming stuck
([#&#8203;299](https://togithub.com/jeffvli/feishin/issues/299)) (Thanks
[@&#8203;kgarner7](https://togithub.com/kgarner7))
- (Navidrome) Fixed smart playlist query editor unable to scroll
([#&#8203;322](https://togithub.com/jeffvli/feishin/issues/322))
- (Jellyfin) Fixed playing songs from global search menu
([#&#8203;294](https://togithub.com/jeffvli/feishin/issues/294)) (Thanks
[@&#8203;kgarner7](https://togithub.com/kgarner7))
- (Jellyfin) Fixed playlist fetch implementation (reverted to previous)
-   (Jellyfin) Fixed missing `Play count` filter on Jellyfin album sort
- (Jellyfin) Fixed "edit playlist" form not working due to invalid fetch
([#&#8203;327](https://togithub.com/jeffvli/feishin/issues/327))
- Removed unused CORS and SSL toggle from web UI
([#&#8203;305](https://togithub.com/jeffvli/feishin/issues/305)) (Thanks
[@&#8203;kgarner7](https://togithub.com/kgarner7))
- Fixed add to playlist logic when attempting to skip duplicates
([#&#8203;300](https://togithub.com/jeffvli/feishin/issues/300)) (Thanks
[@&#8203;kgarner7](https://togithub.com/kgarner7))
- Fixed current track queue position when removing songs from the queue
([#&#8203;226](https://togithub.com/jeffvli/feishin/issues/226)) (Thanks
[@&#8203;kgarner7](https://togithub.com/kgarner7))
- Fixed `rate 0` hotkey not working
([#&#8203;338](https://togithub.com/jeffvli/feishin/issues/338)) (Thanks
[@&#8203;GermanDarknes](https://togithub.com/GermanDarknes))

**Full Changelog**:
jeffvli/feishin@v0.4.0...v0.4.1

#### What's Changed

- \[bugfix]: Fix MPV player playing the same track twice after toggling
repeat by [@&#8203;kgarner7](https://togithub.com/kgarner7) in
[https://github.com/jeffvli/feishin/pull/292](https://togithub.com/jeffvli/feishin/pull/292)
- \[bugfix]: fix artist discography year filter not clearing by
[@&#8203;kgarner7](https://togithub.com/kgarner7) in
[https://github.com/jeffvli/feishin/pull/299](https://togithub.com/jeffvli/feishin/pull/299)
- \[bugfix]: Replace hardcoded Jellyfin authentication DeviceId to
include hostname and username by
[@&#8203;LilyRose2798](https://togithub.com/LilyRose2798) in
[https://github.com/jeffvli/feishin/pull/312](https://togithub.com/jeffvli/feishin/pull/312)
- \[bugfix]: remove ignore CORS/SSL switches from web version by
[@&#8203;kgarner7](https://togithub.com/kgarner7) in
[https://github.com/jeffvli/feishin/pull/305](https://togithub.com/jeffvli/feishin/pull/305)
- In the fullscreen player use dynamic resolution for the main image by
[@&#8203;TacoCake](https://togithub.com/TacoCake) in
[https://github.com/jeffvli/feishin/pull/290](https://togithub.com/jeffvli/feishin/pull/290)
- \[bugfix]: properly implement Jellyfin getSongDetail by
[@&#8203;kgarner7](https://togithub.com/kgarner7) in
[https://github.com/jeffvli/feishin/pull/298](https://togithub.com/jeffvli/feishin/pull/298)
- \[bugfix]: do not duplicate tracks when adding to multiple playlists
by [@&#8203;kgarner7](https://togithub.com/kgarner7) in
[https://github.com/jeffvli/feishin/pull/300](https://togithub.com/jeffvli/feishin/pull/300)
- \[feature]: support running feishin on custom path by
[@&#8203;kgarner7](https://togithub.com/kgarner7) in
[https://github.com/jeffvli/feishin/pull/307](https://togithub.com/jeffvli/feishin/pull/307)
- Reset Carousel position on data refresh by
[@&#8203;kgarner7](https://togithub.com/kgarner7) in
[https://github.com/jeffvli/feishin/pull/303](https://togithub.com/jeffvli/feishin/pull/303)
- \[Remote] Full PWA support, misc bugfixes by
[@&#8203;kgarner7](https://togithub.com/kgarner7) in
[https://github.com/jeffvli/feishin/pull/280](https://togithub.com/jeffvli/feishin/pull/280)
- add more emphasis to current song by
[@&#8203;kgarner7](https://togithub.com/kgarner7) in
[https://github.com/jeffvli/feishin/pull/283](https://togithub.com/jeffvli/feishin/pull/283)
- \[bugfix]: fix queue offset when removing tracks by
[@&#8203;kgarner7](https://togithub.com/kgarner7) in
[https://github.com/jeffvli/feishin/pull/301](https://togithub.com/jeffvli/feishin/pull/301)
- \[feature]: Support using system fonts by
[@&#8203;kgarner7](https://togithub.com/kgarner7) in
[https://github.com/jeffvli/feishin/pull/304](https://togithub.com/jeffvli/feishin/pull/304)
- \[bugfix/feat]: always fetch artist image for Navidrome by
[@&#8203;kgarner7](https://togithub.com/kgarner7) in
[https://github.com/jeffvli/feishin/pull/317](https://togithub.com/jeffvli/feishin/pull/317)
- \[Feature] Support changing accent/primary color by
[@&#8203;kgarner7](https://togithub.com/kgarner7) in
[https://github.com/jeffvli/feishin/pull/282](https://togithub.com/jeffvli/feishin/pull/282)
- Support changing playback rate by
[@&#8203;kgarner7](https://togithub.com/kgarner7) in
[https://github.com/jeffvli/feishin/pull/275](https://togithub.com/jeffvli/feishin/pull/275)
- Add favorite hotkey options by
[@&#8203;GermanDarknes](https://togithub.com/GermanDarknes) in
[https://github.com/jeffvli/feishin/pull/326](https://togithub.com/jeffvli/feishin/pull/326)
- \[bugfix/feature]: Improve ratings by
[@&#8203;kgarner7](https://togithub.com/kgarner7) in
[https://github.com/jeffvli/feishin/pull/332](https://togithub.com/jeffvli/feishin/pull/332)
- \[bugfix]: prevent default by
[@&#8203;kgarner7](https://togithub.com/kgarner7) in
[https://github.com/jeffvli/feishin/pull/334](https://togithub.com/jeffvli/feishin/pull/334)
- Build docker container for arm by
[@&#8203;bubylou](https://togithub.com/bubylou) in
[https://github.com/jeffvli/feishin/pull/336](https://togithub.com/jeffvli/feishin/pull/336)
- Fix clear rating hotkey by
[@&#8203;GermanDarknes](https://togithub.com/GermanDarknes) in
[https://github.com/jeffvli/feishin/pull/338](https://togithub.com/jeffvli/feishin/pull/338)
- Add localization support by
[@&#8203;jeffvli](https://togithub.com/jeffvli) in
[https://github.com/jeffvli/feishin/pull/333](https://togithub.com/jeffvli/feishin/pull/333)

#### New Contributors

- [@&#8203;LilyRose2798](https://togithub.com/LilyRose2798) made their
first contribution in
[https://github.com/jeffvli/feishin/pull/312](https://togithub.com/jeffvli/feishin/pull/312)
- [@&#8203;TacoCake](https://togithub.com/TacoCake) made their first
contribution in
[https://github.com/jeffvli/feishin/pull/290](https://togithub.com/jeffvli/feishin/pull/290)
- [@&#8203;GermanDarknes](https://togithub.com/GermanDarknes) made their
first contribution in
[https://github.com/jeffvli/feishin/pull/326](https://togithub.com/jeffvli/feishin/pull/326)
- [@&#8203;bubylou](https://togithub.com/bubylou) made their first
contribution in
[https://github.com/jeffvli/feishin/pull/336](https://togithub.com/jeffvli/feishin/pull/336)

**Full Changelog**:
jeffvli/feishin@v0.4.1...v0.5.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNi4zIiwidXBkYXRlZEluVmVyIjoiMzcuMzYuMyIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cyrillic font support [Feature Request] Support adding custom fonts
3 participants