Add Noto Serif web font

This commit is contained in:
Mark Anderson 2017-04-22 22:53:36 +01:00
parent 7e2ec25df7
commit 0717c59fc4
3 changed files with 13 additions and 7 deletions

View file

@ -372,19 +372,22 @@
<string name="whitney_font">Whitney</string>
<string name="gotham_narrow_font">Gotham Narrow</string>
<string name="chronicle_font">Chronicle</string>
<string name="noto_font">Noto</string>
<string name="noto_sans_font">Noto Sans</string>
<string name="noto_serif_font">Noto Serif</string>
<string-array name="default_font_entries">
<item>@string/chronicle_font</item>
<item>@string/default_font</item>
<item>@string/gotham_narrow_font</item>
<item>@string/noto_font</item>
<item>@string/noto_sans_font</item>
<item>@string/noto_serif_font</item>
<item>@string/whitney_font</item>
</string-array>
<string-array name="default_font_values">
<item>CHRONICLE</item>
<item>DEFAULT</item>
<item>GOTHAM_NARROW</item>
<item>NOTO</item>
<item>NOTO_SANS</item>
<item>NOTO_SERIF</item>
<item>WHITNEY</item>
</string-array>
<string name="default_font_value">DEFAULT</string>

View file

@ -543,7 +543,7 @@ public class ReadingItemFragment extends NbFragment implements ClassifierDialogF
float currentSize = PrefsUtils.getTextSize(getActivity());
Font font = PrefsUtils.getFont(getActivity());
StringBuilder builder = new StringBuilder();
builder.append("<html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0\" />");
builder.append(font.forWebView(currentSize));

View file

@ -10,7 +10,8 @@ public class Font {
public static Font DEFAULT = new Font(Type.DEFAULT, null, null);
public static Font GOTHAM_NARROW = new Font(Type.OTF, "GothamNarrow-Book.otf", "'SelectedFont'");
public static Font WHITNEY = new Font(Type.OTF, "WhitneySSm-Book-Bas.otf", "'SelectedFont'");
public static Font NOTO = new Font(Type.WEB, "https://fonts.googleapis.com/css?family=Noto+Sans", "'Noto Sans', sans-serif");
public static Font NOTO_SANS = new Font(Type.WEB, "https://fonts.googleapis.com/css?family=Noto+Sans", "'Noto Sans', sans-serif");
public static Font NOTO_SERIF = new Font(Type.WEB, "https://fonts.googleapis.com/css?family=Noto+Serif", "'Noto Serif', serif");
private enum Type {
OTF,
@ -36,8 +37,10 @@ public class Font {
return GOTHAM_NARROW;
case "WHITNEY":
return WHITNEY;
case "NOTO":
return NOTO;
case "NOTO_SANS":
return NOTO_SANS;
case "NOTO_SERIF":
return NOTO_SERIF;
default:
return DEFAULT;
}