Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff86bcd0 authored by Raph Levien's avatar Raph Levien
Browse files

Resolve invalid Typeface style to default

Setting a textAppearance that specified a fontFamily but not a textStyle
results in a styleIndex of -1 being passed to the Typeface.create()
call. This patch resolves such invalid style indices to the default.

Fix for bug 16880318 "Applying TextAppearance To TextView with custom
font family incorrectly adds italics style on LMP"

Change-Id: I05c9cfc4d76161be21b58abdb4037c51a23cae37
parent 1584609f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -132,6 +132,9 @@ public class Typeface {
     * @return The best matching typeface.
     */
    public static Typeface create(Typeface family, int style) {
        if (style < 0 || style > 3) {
            style = 0;
        }
        long ni = 0;
        if (family != null) {
            // Return early if we're asked for the same face/style