change int to double in font size#141
Open
buihongvinh wants to merge 2 commits into
Open
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
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.
The app stores reader font size as a percentage for UI/persistence, but Readium Android/Web expects fontSize as a scale value. Passing 100.0 compiles but does not behave correctly; it should be sent as 1.0. iOS currently divides fontSize by 100 in the native bridge, so it still receives the percentage value. typeScale should also be updated from the same scale so the rendered text actually changes with the slider.
EPUBPreferences buildPreferences(TextSettingsState settings) {
final clampedFontSize = settings.fontSize.clamp(70, 200);
final fontScale = clampedFontSize / 100.0;
return EPUBPreferences(
// UI stores font size as percent: 70, 100, 150, 200.
// Android/Web Readium expects scale: 0.7, 1.0, 1.5, 2.0.
// iOS bridge currently divides fontSize by 100 internally.
fontSize: defaultTargetPlatform == TargetPlatform.iOS
? clampedFontSize.toDouble()
: fontScale,
);
}