mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix: Corrected font-weight support for span
This commit is contained in:
committed by
Nathan Walker
parent
b12c41532a
commit
045986de8f
@@ -7,15 +7,12 @@ import android.text.style.TypefaceSpan;
|
||||
|
||||
/**
|
||||
* Created by hhristov on 2/27/17.
|
||||
* Updated by CatchABus on 1/26/25.
|
||||
*/
|
||||
|
||||
@SuppressLint("ParcelCreator")
|
||||
public class CustomTypefaceSpan extends TypefaceSpan {
|
||||
private final Typeface typeface;
|
||||
|
||||
public CustomTypefaceSpan(String family, Typeface typeface) {
|
||||
super(family);
|
||||
this.typeface = typeface;
|
||||
public CustomTypefaceSpan(Typeface typeface) {
|
||||
super(typeface);
|
||||
}
|
||||
|
||||
public void updateDrawState(TextPaint ds) {
|
||||
@@ -30,7 +27,7 @@ public class CustomTypefaceSpan extends TypefaceSpan {
|
||||
final Typeface old = paint.getTypeface();
|
||||
final int oldStyle = (old == null) ? 0 : old.getStyle();
|
||||
|
||||
Typeface typeface = this.typeface;
|
||||
Typeface typeface = this.getTypeface();
|
||||
int fake = oldStyle & ~typeface.getStyle();
|
||||
if ((fake & android.graphics.Typeface.BOLD) != 0) {
|
||||
paint.setFakeBoldText(true);
|
||||
|
||||
Reference in New Issue
Block a user