1818
1919import android .text .Spanned ;
2020
21- import com .mta .tehreer .collections .IntList ;
2221import com .mta .tehreer .internal .collections .JFloatArrayList ;
2322import com .mta .tehreer .internal .collections .JFloatArrayPointList ;
2423import com .mta .tehreer .internal .collections .JIntArrayList ;
2827import com .mta .tehreer .internal .layout .IntrinsicRun ;
2928import com .mta .tehreer .internal .layout .ParagraphCollection ;
3029import com .mta .tehreer .internal .layout .RunCollection ;
31- import com .mta .tehreer .internal .util .Clusters ;
3230import com .mta .tehreer .internal .util .StringUtils ;
3331import com .mta .tehreer .unicode .BidiRun ;
3432
@@ -52,25 +50,19 @@ void reset(Spanned spanned, ParagraphCollection paragraphs, RunCollection runs)
5250 }
5351
5452 static GlyphRun createGlyphRun (IntrinsicRun intrinsicRun , int spanStart , int spanEnd , Object [] spans ) {
55- IntList clusterMap = IntList .of (intrinsicRun .clusterMap );
56- boolean isBackward = intrinsicRun .isBackward ;
57- int intrinsicStart = intrinsicRun .charStart ;
58- int totalGlyphs = intrinsicRun .glyphCount ();
53+ int clusterStart = intrinsicRun .clusterStart (spanStart );
54+ int clusterEnd = intrinsicRun .clusterEnd (spanEnd - 1 );
5955
60- int firstIndex = spanStart - intrinsicStart ;
61- int lastIndex = spanEnd - intrinsicStart - 1 ;
62-
63- int clusterStart = Clusters .actualClusterStart (clusterMap , firstIndex ) + intrinsicStart ;
64- int clusterEnd = Clusters .actualClusterEnd (clusterMap , lastIndex ) + intrinsicStart ;
6556 int startExtra = spanStart - clusterStart ;
6657 int endExtra = clusterEnd - spanEnd ;
6758
68- int leadingIndex = Clusters .leadingGlyphIndex (clusterMap , firstIndex , isBackward , totalGlyphs );
69- int trailingIndex = Clusters .trailingGlyphIndex (clusterMap , lastIndex , isBackward , totalGlyphs );
70- int glyphOffset = Math .min (leadingIndex , trailingIndex );
71- int glyphCount = Math .max (leadingIndex , trailingIndex ) - glyphOffset + 1 ;
59+ int [] glyphRange = new int [2 ];
60+ intrinsicRun .loadGlyphRange (spanStart , spanEnd , glyphRange );
61+
62+ int glyphOffset = glyphRange [0 ];
63+ int glyphCount = glyphRange [1 ] - glyphOffset ;
7264
73- int chunkOffset = clusterStart - intrinsicStart ;
65+ int chunkOffset = clusterStart - intrinsicRun . charStart ;
7466 int chunkLength = clusterEnd - clusterStart ;
7567
7668 return new GlyphRun (spanStart , spanEnd , startExtra , endExtra , Arrays .asList (spans ),
0 commit comments