markwon-core/src/main/java/ru/noties/markwon/core/spans/OrderedListItemSpan.java
public static void measure(@NonNull TextView textView, @NonNull CharSequence text) {

        if (!(text instanceof Spanned)) {
            // nothing to do here
            return;
        }

        final OrderedListItemSpan[] spans = ((Spanned) text).getSpans(
                0,
                text.length(),
                OrderedListItemSpan.class);

        if (spans != null) {
            final TextPaint paint = textView.getPaint();
            for (OrderedListItemSpan span : spans) {
                span.margin = (int) (paint.measureText(span.number) + .5F);
            }
        }
    }
public static void measure(@NonNull TextView textView, @NonNull CharSequence text) {

        if (!(text instanceof Spanned)) {
            // nothing to do here
            return;
        }

        final OrderedListItemSpan[] spans = ((Spanned) text).getSpans(
                0,
                text.length(),
                OrderedListItemSpan.class);

        if (spans != null) {
            final TextPaint paint = textView.getPaint();
            for (OrderedListItemSpan span : spans) {
                span.margin = (int) (paint.measureText(span.number) + .5F);
            }
        }
    }
Process supplied `text` argument and supply TextView paint to all OrderedListItemSpans
in order for them to measure number.
<p>
NB, this method must be called <em>before</em> setting text to a TextView (`TextView#setText`
internally can trigger new Layout creation which will ask for leading margins right away)

@param textView to which markdown will be applied
@param text     parsed markdown to process
@since 2.0.1