@@ -30,7 +30,7 @@ public GlyphLine(List<Glyph> glyphs, int start, int end) {
3030 this .end = end ;
3131 }
3232
33- public GlyphLine (List <Glyph > glyphs , List <ActualText > actualText , int start , int end ) {
33+ protected GlyphLine (List <Glyph > glyphs , List <ActualText > actualText , int start , int end ) {
3434 this (glyphs , start , end );
3535 this .actualText = actualText ;
3636 }
@@ -217,8 +217,8 @@ public GlyphLine filter(GlyphLineFilter filter) {
217217 public void setActualText (int left , int right , String text ) {
218218 if (this .actualText == null ) {
219219 this .actualText = new ArrayList <>(glyphs .size ());
220- List < ActualText > actualText = Collections . nCopies ( glyphs .size (), null );
221- this .actualText .addAll ( actualText );
220+ for ( int i = 0 ; i < glyphs .size (); i ++)
221+ this .actualText .add ( null );
222222 }
223223 ActualText actualText = new ActualText (text );
224224 for (int i = left ; i < right ; i ++) {
@@ -241,8 +241,9 @@ private void removeGlyph(int index) {
241241 private void addAllGlyphs (int index , List <Glyph > additionalGlyphs ) {
242242 glyphs .addAll (index , additionalGlyphs );
243243 if (actualText != null ) {
244- List <ActualText > actualTexts = Collections .nCopies (additionalGlyphs .size (), null );
245- actualText .addAll (index , actualTexts );
244+ for (int i = 0 ; i < additionalGlyphs .size (); i ++) {
245+ this .actualText .add (index , null );
246+ }
246247 }
247248 }
248249
0 commit comments