code block:
public class MonospaceSpan extends TypefaceSpan{
private final Context context;
public MonospaceSpan(Context context){
super("monospace");
this.context=context;
}
@Override
public void updateDrawState(@NonNull TextPaint paint){
super.updateDrawState(paint);
paint.setColor(UiUtils.getThemeColor(context, R.attr.colorM3Tertiary));
paint.setTextSize(paint.getTextSize()*0.9375f);
paint.baselineShift=V.dp(-1);
}
@Override
public void updateMeasureState(@NonNull TextPaint paint){
super.updateMeasureState(paint);
paint.setTextSize(paint.getTextSize()*0.9375f);
paint.baselineShift=V.dp(-1);
}
}