Skip to content

Commit

Permalink
Fix getalt and getactualText in GFOpMarkedContent
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximPlusov committed Mar 28, 2024
1 parent 46f2683 commit 1c2da06
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@

import org.verapdf.as.ASAtom;
import org.verapdf.cos.*;
import org.verapdf.gf.model.impl.containers.StaticContainers;
import org.verapdf.gf.model.impl.cos.*;
import org.verapdf.gf.model.impl.operator.base.GFOperator;
import org.verapdf.gf.model.impl.pd.util.PDResourcesHandler;
import org.verapdf.model.baselayer.Object;
import org.verapdf.model.coslayer.*;
import org.verapdf.model.operator.OpMarkedContent;
import org.verapdf.pd.PDResource;
import org.verapdf.pdfa.flavours.PDFAFlavour;

import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -227,7 +229,8 @@ public int hashCode() {

private List<CosActualText> getactualText() {
COSString actualText = getActualText();
if (isRealContent && actualText != null) {
if (actualText != null && (isRealContent || StaticContainers.getFlavour() == null ||
StaticContainers.getFlavour().getPart().getFamily() != PDFAFlavour.SpecificationFamily.PDF_UA)) {
List<CosActualText> list = new ArrayList<>(MAX_NUMBER_OF_ELEMENTS);
list.add(new GFCosActualText(actualText));
return list;
Expand All @@ -237,7 +240,8 @@ private List<CosActualText> getactualText() {

private List<CosAlt> getalt() {
COSString alt = getAlt();
if (isRealContent && alt != null) {
if (alt != null && (isRealContent || StaticContainers.getFlavour() == null ||
StaticContainers.getFlavour().getPart().getFamily() != PDFAFlavour.SpecificationFamily.PDF_UA)) {
List<CosAlt> list = new ArrayList<>(MAX_NUMBER_OF_ELEMENTS);
list.add(new GFCosAlt(alt));
return list;
Expand Down

0 comments on commit 1c2da06

Please sign in to comment.