-
-
Notifications
You must be signed in to change notification settings - Fork 89
✨Implement epub reader fonts #663
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Introduced a new LineHeightControl component for adjusting line height in the EPUB reader. - Updated the ThemeControls to include the new LineHeightControl. - Enhanced the applyTheme function to apply line height from user preferences. - Added lineHeight property to BookPreferences in the reader store with a default value of 1.5.
- Added a new ReadingMode component for selecting between paged and continuous reading modes. - Updated EpubNavigationControls to handle swipe gestures based on the selected reading mode. - Modified EpubJsReader to set the flow based on the chosen reading mode. - Integrated ReadingMode component into ThemeControls.
- Introduced DefaultLineHeight component to allow users to set line height in the reader settings. - Integrated DefaultLineHeight into ReaderDefaultSettingsScene. - Updated tailwind preset to include a default line height value.
- Added localization entries for line height settings in the English language JSON file, including label and description for user interface consistency.
- Simplified line height validation in LineHeightControl - Updated DefaultLineHeight component to match values in LineHeightControl - Updated ReadingMode component to use explicit reading mode type rather than any
- Moved SUPPORTED_FONT_OPTIONS to a new utility file for better organization. - Updated FontFamily, FontSelect, and DefaultFontFamily components to import font options from the new utility file. - This aims to better align font names with their css style conterparts
- Introduced utility functions for font path and CSS retrieval to streamline font handling. - Updated EpubJsReader to register and apply font themes dynamically based on user preferences. - Doesn't download the fonts properly just yet.
- Removed deprecated font theme registration and streamlined font injection logic in EpubJsReader. - Introduced a new helper function to manage font CSS injection for rendered contents based on user preferences. - Updated FontFamily component to ensure proper type handling for font family selections. - Enhanced useBookPreferences to maintain consistent state management for book preferences. - This is still an absolute mess and needs refactoring BADLY... - While the reader can now switch fonts, it will sometimes require a reload of the book to properly swap over. Need to figure out why still...
- Still an absolute hot mess, but you can change fonts now - Added state management for font changes in EpubJsReader to trigger a remount when the font family is updated. - Enhanced the FontFamily component to log font changes and ensure proper updates to book preferences. - Updated useBookPreferences to include debug logging for better tracking of preferences retrieval and updates. - Introduced a cleanup function to properly destroy the current reader instance before remounting.
- Added a fontCssRef to cache CSS for each font family - Added a useEffect that preloads tdhe font css when modified - Created a loadFontCss function that will handle cacheing and loading of the font css
- Added cancellation logic to prevent state updates after component unmount. - Added rendition destroy on preference change to prevent duplicate readers being rendered
- Previous raw font file location was not accessible to the browser due to vite bundler, without adding the font hash to the file name - If anyone knows a way around this please let me know...
84f9c8a to
e114b9d
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Aims to add proper loading of fonts within the epub reader. This applies to current book defaults, library defaults, and global font defaults. This also aims to resolve #660.
While the feature is nearly fully functional, I'm starting this off as a draft because this code is honestly painful to read and I'm looking for feedback on how to not make it as much of a mess. Also making the PR against experimental due to changes that might have unintended side effects.
What is changed
What still needs to happen
Sidenote: I based this PR off of the current development branch before I rebased due to the amount of changes. Experimental is slightly behind develop at the moment, which is why there are a couple extra commits.