Skip to content

Commit

Permalink
Added Croscore and Crosextra fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
M66B committed Feb 10, 2022
1 parent 46e0b09 commit e26725b
Show file tree
Hide file tree
Showing 30 changed files with 155 additions and 10 deletions.
5 changes: 5 additions & 0 deletions ATTRIBUTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ FairEmail uses:
* [Public Suffix List](https://publicsuffix.org/). Copyright © 2007–20 Mozilla Foundation. [Mozilla Public License, v. 2.0](https://mozilla.org/MPL/2.0/).
* [Outlook Message Parser](https://github.com/bbottema/outlook-message-parser). Copyright (C) 2017 Benny Bottema. [Apache License 2.0](https://github.com/bbottema/outlook-message-parser/blob/master/LICENSE-2.0.txt).
* [ez-vcard](https://github.com/mangstadt/ez-vcard). Copyright (c) 2012-2021, Michael Angstadt. All rights reserved. [FreeBSD License](https://github.com/mangstadt/ez-vcard/blob/master/LICENSE).
* [Arimo font](https://fonts.google.com/specimen/Arimo). By Steve Matteson. [Apache License, Version 2.0](https://fonts.google.com/specimen/Arimo#license)
* [Tinos font](https://fonts.google.com/specimen/Tinos). By Steve Matteson. [Apache License, Version 2.0](https://fonts.google.com/specimen/Tinos#license)
* [Cousine font](https://fonts.google.com/specimen/Cousine). By Steve Matteson. [Apache License, Version 2.0](https://fonts.google.com/specimen/Cousine#license)
* [Lato font](https://fonts.google.com/specimen/Lato). By Łukasz Dziedzic. [Apache License, Version 2.0](https://fonts.google.com/specimen/Lato#license)
* [Cambo font](https://fonts.google.com/specimen/Cambo). By Huerta Tipográfica. [Apache License, Version 2.0](https://fonts.google.com/specimen/Cambo#license)
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

### [Fulgurotherium](https://en.wikipedia.org/wiki/Fulgurotherium)

### Next version

* Added Croscore and Crosextra fonts

### 1.1833 - 2022-02-07

* Added view original signature
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ FairEmail might be for you if you value your privacy.
* Common text style options (size, color, lists, etc)
* Battery friendly
* Low data usage
* Small (~20 MB)
* Small (~25 MB)
* Material design (including dark/black theme)
* Maintained and supported

Expand Down
5 changes: 5 additions & 0 deletions app/src/main/assets/ATTRIBUTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ FairEmail uses:
* [Public Suffix List](https://publicsuffix.org/). Copyright © 2007–20 Mozilla Foundation. [Mozilla Public License, v. 2.0](https://mozilla.org/MPL/2.0/).
* [Outlook Message Parser](https://github.com/bbottema/outlook-message-parser). Copyright (C) 2017 Benny Bottema. [Apache License 2.0](https://github.com/bbottema/outlook-message-parser/blob/master/LICENSE-2.0.txt).
* [ez-vcard](https://github.com/mangstadt/ez-vcard). Copyright (c) 2012-2021, Michael Angstadt. All rights reserved. [FreeBSD License](https://github.com/mangstadt/ez-vcard/blob/master/LICENSE).
* [Arimo font](https://fonts.google.com/specimen/Arimo). By Steve Matteson. [Apache License, Version 2.0](https://fonts.google.com/specimen/Arimo#license)
* [Tinos font](https://fonts.google.com/specimen/Tinos). By Steve Matteson. [Apache License, Version 2.0](https://fonts.google.com/specimen/Tinos#license)
* [Cousine font](https://fonts.google.com/specimen/Cousine). By Steve Matteson. [Apache License, Version 2.0](https://fonts.google.com/specimen/Cousine#license)
* [Lato font](https://fonts.google.com/specimen/Lato). By Łukasz Dziedzic. [Apache License, Version 2.0](https://fonts.google.com/specimen/Lato#license)
* [Cambo font](https://fonts.google.com/specimen/Cambo). By Huerta Tipográfica. [Apache License, Version 2.0](https://fonts.google.com/specimen/Cambo#license)
4 changes: 4 additions & 0 deletions app/src/main/assets/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

### [Fulgurotherium](https://en.wikipedia.org/wiki/Fulgurotherium)

### Next version

* Added Croscore and Crosextra fonts

### 1.1833 - 2022-02-07

* Added view original signature
Expand Down
56 changes: 48 additions & 8 deletions app/src/main/java/eu/faircode/email/StyleHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class StyleHelper {
QuoteSpan.class, IndentSpan.class,
StrikethroughSpan.class,
URLSpan.class,
TypefaceSpan.class
TypefaceSpan.class, CustomTypefaceSpan.class
));

static boolean apply(int action, LifecycleOwner owner, View anchor, EditText etBody, Object... args) {
Expand Down Expand Up @@ -930,26 +930,57 @@ else if (span instanceof BulletSpanEx)

static TypefaceSpan getTypefaceSpan(String family, Context context) {
String faces = family.toLowerCase(Locale.ROOT);
if (faces.contains("arimo"))
family = "Arimo, Arial, Verdana, sans-serif";
if (faces.contains("tinos"))
family = "Tinos, Times New Roman, serif";
if (faces.contains("cousine"))
family = "Cousine, Courier New, monospace";
if (faces.contains("lato"))
family = "Lato, Calibri, sans-serif";
if (faces.contains("cambo"))
family = "Cambo, Cambria, serif";
if (faces.contains("comic sans"))
family = "comic sans ms, sans-serif";
family = "Comic Sans, Comic Sans MS, sans-serif";

return new CustomTypefaceSpan(family, getTypeface(family, context));
}

static Typeface getTypeface(String family, Context context) {
String faces = family.toLowerCase(Locale.ROOT);

if (faces.equals("fairemail"))
List<String> faces = new ArrayList<>();
for (String face : family.split(","))
faces.add(face
.trim()
.toLowerCase(Locale.ROOT)
.replace("\"", ""));

if (faces.contains("fairemail"))
return ResourcesCompat.getFont(context, R.font.fantasy);

if (faces.contains("comic sans"))
if (faces.contains("arimo") || faces.contains("arial") || faces.contains("verdana"))
return ResourcesCompat.getFont(context, R.font.arimo);

if (faces.contains("tinos") || faces.contains("times new roman"))
return ResourcesCompat.getFont(context, R.font.tinos);

if (faces.contains("cousine") || faces.contains("courier new"))
return ResourcesCompat.getFont(context, R.font.cousine);

if (faces.contains("lato") || faces.contains("calibri"))
return ResourcesCompat.getFont(context, R.font.lato);

if (faces.contains("cambo") || faces.contains("cambria"))
return ResourcesCompat.getFont(context, R.font.cambo);

if (faces.contains("comic sans") || faces.contains("comic sans ms"))
return ResourcesCompat.getFont(context, R.font.opendyslexic);

for (String face : faces.split(",")) {
face = face.trim().replace("\"", "");
for (String face : faces) {
Typeface tf = Typeface.create(face, Typeface.NORMAL);
if (!tf.equals(Typeface.DEFAULT))
return tf;
}

return Typeface.DEFAULT;
}

Expand All @@ -959,7 +990,16 @@ public static List<FontDescriptor> getFonts(Context context) {
String[] fontNameValues = context.getResources().getStringArray(R.array.fontNameValues);
for (int i = 0; i < fontNameNames.length; i++)
result.add(new FontDescriptor(fontNameValues[i], fontNameNames[i]));

// https://en.wikipedia.org/wiki/Croscore_fonts
result.add(new FontDescriptor("arimo", "Arimo (Arial, Verdana)", true));
result.add(new FontDescriptor("tinos", "Tinos (Times New Roman)", true));
result.add(new FontDescriptor("cousine", "Cousine (Courier New)", true));
result.add(new FontDescriptor("lato", "Lato (Calibri)", true));
result.add(new FontDescriptor("cambo", "Cambo (Cambria)", true));

result.add(new FontDescriptor("comic sans", "OpenDyslexic", true));

return result;
}

Expand Down
19 changes: 19 additions & 0 deletions app/src/main/res/font/arimo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto">
<font
app:font="@font/arimo_regular"
app:fontStyle="normal"
app:fontWeight="400" />
<font
app:font="@font/arimo_italic"
app:fontStyle="italic"
app:fontWeight="400" />
<font
app:font="@font/arimo_bold"
app:fontStyle="normal"
app:fontWeight="700" />
<font
app:font="@font/arimo_bolditalic"
app:fontStyle="italic"
app:fontWeight="700" />
</font-family>
Binary file added app/src/main/res/font/arimo_bold.ttf
Binary file not shown.
Binary file added app/src/main/res/font/arimo_bolditalic.ttf
Binary file not shown.
Binary file added app/src/main/res/font/arimo_italic.ttf
Binary file not shown.
Binary file added app/src/main/res/font/arimo_regular.ttf
Binary file not shown.
7 changes: 7 additions & 0 deletions app/src/main/res/font/cambo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto">
<font
app:font="@font/cambo_regular"
app:fontStyle="normal"
app:fontWeight="400" />
</font-family>
Binary file added app/src/main/res/font/cambo_regular.ttf
Binary file not shown.
19 changes: 19 additions & 0 deletions app/src/main/res/font/cousine.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto">
<font
app:font="@font/cousine_regular"
app:fontStyle="normal"
app:fontWeight="400" />
<font
app:font="@font/cousine_italic"
app:fontStyle="italic"
app:fontWeight="400" />
<font
app:font="@font/cousine_bold"
app:fontStyle="normal"
app:fontWeight="700" />
<font
app:font="@font/cousine_bolditalic"
app:fontStyle="italic"
app:fontWeight="700" />
</font-family>
Binary file added app/src/main/res/font/cousine_bold.ttf
Binary file not shown.
Binary file added app/src/main/res/font/cousine_bolditalic.ttf
Binary file not shown.
Binary file added app/src/main/res/font/cousine_italic.ttf
Binary file not shown.
Binary file added app/src/main/res/font/cousine_regular.ttf
Binary file not shown.
19 changes: 19 additions & 0 deletions app/src/main/res/font/lato.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto">
<font
app:font="@font/lato_regular"
app:fontStyle="normal"
app:fontWeight="400" />
<font
app:font="@font/lato_italic"
app:fontStyle="italic"
app:fontWeight="400" />
<font
app:font="@font/lato_bold"
app:fontStyle="normal"
app:fontWeight="700" />
<font
app:font="@font/lato_bold_italic"
app:fontStyle="italic"
app:fontWeight="700" />
</font-family>
Binary file added app/src/main/res/font/lato_bold.ttf
Binary file not shown.
Binary file added app/src/main/res/font/lato_bold_italic.ttf
Binary file not shown.
Binary file added app/src/main/res/font/lato_italic.ttf
Binary file not shown.
Binary file added app/src/main/res/font/lato_regular.ttf
Binary file not shown.
19 changes: 19 additions & 0 deletions app/src/main/res/font/tinos.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto">
<font
app:font="@font/tinos_regular"
app:fontStyle="normal"
app:fontWeight="400" />
<font
app:font="@font/tinos_italic"
app:fontStyle="italic"
app:fontWeight="400" />
<font
app:font="@font/tinos_bold"
app:fontStyle="normal"
app:fontWeight="700" />
<font
app:font="@font/tinos_bolditalic"
app:fontStyle="italic"
app:fontWeight="700" />
</font-family>
Binary file added app/src/main/res/font/tinos_bold.ttf
Binary file not shown.
Binary file added app/src/main/res/font/tinos_bolditalic.ttf
Binary file not shown.
Binary file added app/src/main/res/font/tinos_italic.ttf
Binary file not shown.
Binary file added app/src/main/res/font/tinos_regular.ttf
Binary file not shown.
4 changes: 4 additions & 0 deletions metadata/en-US/changelogs/1833.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

### [Fulgurotherium](https://en.wikipedia.org/wiki/Fulgurotherium)

### Next version

* Added Croscore and Crosextra fonts

### 1.1833 - 2022-02-07

* Added view original signature
Expand Down
2 changes: 1 addition & 1 deletion metadata/en-US/full_description.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ FairEmail might be for you if you value your privacy.
* Common text style options (size, color, lists, etc)
* Battery friendly
* Low data usage
* Small (~20 MB)
* Small (~25 MB)
* Material design (including dark/black theme)
* Maintained and supported

Expand Down

0 comments on commit e26725b

Please sign in to comment.