File tree Expand file tree Collapse file tree 2 files changed +44
-1
lines changed
io/src/main/java/com/itextpdf/io/font/otf Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -300,7 +300,7 @@ public boolean equals(Object obj) {
300
300
if (this == obj ) {
301
301
return true ;
302
302
}
303
- if (!( obj instanceof Glyph )) {
303
+ if (obj == null || getClass () != obj . getClass ( )) {
304
304
return false ;
305
305
}
306
306
Glyph other = (Glyph ) obj ;
Original file line number Diff line number Diff line change @@ -319,6 +319,37 @@ public Iterator<GlyphLinePart> iterator() {
319
319
return new ActualTextIterator (this );
320
320
}
321
321
322
+ @ Override
323
+ public boolean equals (Object obj ) {
324
+ if (this == obj ) {
325
+ return true ;
326
+ }
327
+ if (obj == null || getClass () != obj .getClass ()) {
328
+ return false ;
329
+ }
330
+ GlyphLine other = (GlyphLine )obj ;
331
+ if (end - start != other .end - other .start ) {
332
+ return false ;
333
+ }
334
+ if (actualText == null && other .actualText != null || actualText != null && other .actualText == null ) {
335
+ return false ;
336
+ }
337
+ for (int i = start ; i < end ; i ++) {
338
+ int otherPos = other .start + i - start ;
339
+ Glyph myGlyph = get (i );
340
+ Glyph otherGlyph = other .get (otherPos );
341
+ if (myGlyph == null && otherGlyph != null || !myGlyph .equals (otherGlyph )) {
342
+ return false ;
343
+ }
344
+ ActualText myAT = actualText == null ? null : actualText .get (i );
345
+ ActualText otherAT = other .actualText == null ? null : other .actualText .get (otherPos );
346
+ if (myAT == null && otherAT != null || !myAT .equals (otherAT )) {
347
+ return false ;
348
+ }
349
+ }
350
+ return true ;
351
+ }
352
+
322
353
private void removeGlyph (int index ) {
323
354
glyphs .remove (index );
324
355
if (actualText != null ) {
@@ -369,5 +400,17 @@ public ActualText(String value) {
369
400
}
370
401
371
402
public String value ;
403
+
404
+ @ Override
405
+ public boolean equals (Object obj ) {
406
+ if (this == obj ) {
407
+ return true ;
408
+ }
409
+ if (obj == null || getClass () != obj .getClass ()) {
410
+ return false ;
411
+ }
412
+ ActualText other = (ActualText ) obj ;
413
+ return value == null && other .value == null || value .equals (other .value );
414
+ }
372
415
}
373
416
}
You can’t perform that action at this time.
0 commit comments