Skip to content

Commit

Permalink
Merge pull request #1443 from cemrich/bugfix/1428-wrong-text-size-in-…
Browse files Browse the repository at this point in the history
…webview

Fix text display too small inside webviews for non English locales #1428
  • Loading branch information
David-Development authored Jun 27, 2024
2 parents cd7ba50 + e10b5ee commit 1839c1d
Showing 1 changed file with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package de.luhmer.owncloudnewsreader.async_tasks;

import static java.lang.reflect.Modifier.PRIVATE;
import static de.luhmer.owncloudnewsreader.NewsDetailActivity.INCOGNITO_MODE_ENABLED;
import static de.luhmer.owncloudnewsreader.helper.ThemeChooser.THEME;

Expand All @@ -24,9 +23,11 @@

import java.io.File;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -280,16 +281,19 @@ private static String getCachedFavIcon(RequestManager glide, String favIconUrl)
private static String getFontSizeScalingCss(SharedPreferences mPrefs) {
// font size scaling
double scalingFactor = Float.parseFloat(mPrefs.getString(SettingsActivity.SP_FONT_SIZE, "1.0"));
DecimalFormat fontFormat = new DecimalFormat("#.#");
DecimalFormat fontFormat = new DecimalFormat("#.##", new DecimalFormatSymbols(Locale.US));
return String.format(
":root { \n" +
"--fontsize-body: %sem; \n" +
"--fontsize-header: %sem; \n" +
"--fontsize-subscript: %sem; \n" +
"}",
fontFormat.format(scalingFactor*BODY_FONT_SIZE),
fontFormat.format(scalingFactor*HEADING_FONT_SIZE),
fontFormat.format(scalingFactor*SUBSCRIPT_FONT_SIZE)
Locale.US,
"""
:root {\s
--fontsize-body: %sem;\s
--fontsize-header: %sem;\s
--fontsize-subscript: %sem;\s
}
""",
fontFormat.format(scalingFactor * BODY_FONT_SIZE),
fontFormat.format(scalingFactor * HEADING_FONT_SIZE),
fontFormat.format(scalingFactor * SUBSCRIPT_FONT_SIZE)
);
}

Expand Down

0 comments on commit 1839c1d

Please sign in to comment.