package m3; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Typeface; import android.text.TextPaint; import android.util.Log; import c3.j; import p.h; /* loaded from: classes2.dex */ public class d { /* renamed from: a, reason: collision with root package name */ public final float f11813a; /* renamed from: b, reason: collision with root package name */ public final ColorStateList f11814b; /* renamed from: c, reason: collision with root package name */ public final ColorStateList f11815c; /* renamed from: d, reason: collision with root package name */ public final ColorStateList f11816d; /* renamed from: e, reason: collision with root package name */ public final int f11817e; /* renamed from: f, reason: collision with root package name */ public final int f11818f; /* renamed from: g, reason: collision with root package name */ public final String f11819g; /* renamed from: h, reason: collision with root package name */ public final boolean f11820h; /* renamed from: i, reason: collision with root package name */ public final ColorStateList f11821i; /* renamed from: j, reason: collision with root package name */ public final float f11822j; /* renamed from: k, reason: collision with root package name */ public final float f11823k; /* renamed from: l, reason: collision with root package name */ public final float f11824l; /* renamed from: m, reason: collision with root package name */ private final int f11825m; /* renamed from: n, reason: collision with root package name */ private boolean f11826n = false; /* renamed from: o, reason: collision with root package name */ private Typeface f11827o; class a extends h.d { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ f f11828a; a(f fVar) { this.f11828a = fVar; } @Override // p.h.d public void d(int i10) { d.this.f11826n = true; this.f11828a.a(i10); } @Override // p.h.d public void e(Typeface typeface) { d dVar = d.this; dVar.f11827o = Typeface.create(typeface, dVar.f11817e); d.this.f11826n = true; this.f11828a.b(d.this.f11827o, false); } } class b extends f { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ TextPaint f11830a; /* renamed from: b, reason: collision with root package name */ final /* synthetic */ f f11831b; b(TextPaint textPaint, f fVar) { this.f11830a = textPaint; this.f11831b = fVar; } @Override // m3.f public void a(int i10) { this.f11831b.a(i10); } @Override // m3.f public void b(Typeface typeface, boolean z10) { d.this.k(this.f11830a, typeface); this.f11831b.b(typeface, z10); } } public d(Context context, int i10) { TypedArray obtainStyledAttributes = context.obtainStyledAttributes(i10, j.X2); this.f11813a = obtainStyledAttributes.getDimension(j.Y2, 0.0f); this.f11814b = c.a(context, obtainStyledAttributes, j.f3573b3); this.f11815c = c.a(context, obtainStyledAttributes, j.f3579c3); this.f11816d = c.a(context, obtainStyledAttributes, j.f3585d3); this.f11817e = obtainStyledAttributes.getInt(j.f3567a3, 0); this.f11818f = obtainStyledAttributes.getInt(j.Z2, 1); int e10 = c.e(obtainStyledAttributes, j.f3621j3, j.f3615i3); this.f11825m = obtainStyledAttributes.getResourceId(e10, 0); this.f11819g = obtainStyledAttributes.getString(e10); this.f11820h = obtainStyledAttributes.getBoolean(j.f3627k3, false); this.f11821i = c.a(context, obtainStyledAttributes, j.f3591e3); this.f11822j = obtainStyledAttributes.getFloat(j.f3597f3, 0.0f); this.f11823k = obtainStyledAttributes.getFloat(j.f3603g3, 0.0f); this.f11824l = obtainStyledAttributes.getFloat(j.f3609h3, 0.0f); obtainStyledAttributes.recycle(); } private void d() { String str; if (this.f11827o == null && (str = this.f11819g) != null) { this.f11827o = Typeface.create(str, this.f11817e); } if (this.f11827o == null) { int i10 = this.f11818f; if (i10 == 1) { this.f11827o = Typeface.SANS_SERIF; } else if (i10 == 2) { this.f11827o = Typeface.SERIF; } else if (i10 != 3) { this.f11827o = Typeface.DEFAULT; } else { this.f11827o = Typeface.MONOSPACE; } this.f11827o = Typeface.create(this.f11827o, this.f11817e); } } public Typeface e() { d(); return this.f11827o; } public Typeface f(Context context) { if (this.f11826n) { return this.f11827o; } if (!context.isRestricted()) { try { Typeface e10 = h.e(context, this.f11825m); this.f11827o = e10; if (e10 != null) { this.f11827o = Typeface.create(e10, this.f11817e); } } catch (Resources.NotFoundException | UnsupportedOperationException unused) { } catch (Exception e11) { Log.d("TextAppearance", "Error loading font " + this.f11819g, e11); } } d(); this.f11826n = true; return this.f11827o; } public void g(Context context, TextPaint textPaint, f fVar) { k(textPaint, e()); h(context, new b(textPaint, fVar)); } public void h(Context context, f fVar) { if (e.a()) { f(context); } else { d(); } int i10 = this.f11825m; if (i10 == 0) { this.f11826n = true; } if (this.f11826n) { fVar.b(this.f11827o, true); return; } try { h.g(context, i10, new a(fVar), null); } catch (Resources.NotFoundException unused) { this.f11826n = true; fVar.a(1); } catch (Exception e10) { Log.d("TextAppearance", "Error loading font " + this.f11819g, e10); this.f11826n = true; fVar.a(-3); } } public void i(Context context, TextPaint textPaint, f fVar) { j(context, textPaint, fVar); ColorStateList colorStateList = this.f11814b; textPaint.setColor(colorStateList != null ? colorStateList.getColorForState(textPaint.drawableState, colorStateList.getDefaultColor()) : -16777216); float f10 = this.f11824l; float f11 = this.f11822j; float f12 = this.f11823k; ColorStateList colorStateList2 = this.f11821i; textPaint.setShadowLayer(f10, f11, f12, colorStateList2 != null ? colorStateList2.getColorForState(textPaint.drawableState, colorStateList2.getDefaultColor()) : 0); } public void j(Context context, TextPaint textPaint, f fVar) { if (e.a()) { k(textPaint, f(context)); } else { g(context, textPaint, fVar); } } public void k(TextPaint textPaint, Typeface typeface) { textPaint.setTypeface(typeface); int i10 = (~typeface.getStyle()) & this.f11817e; textPaint.setFakeBoldText((i10 & 1) != 0); textPaint.setTextSkewX((i10 & 2) != 0 ? -0.25f : 0.0f); textPaint.setTextSize(this.f11813a); } }