Skip to content

Commit 4da8fb3

Browse files
BlackEgoistiText-CI
authored andcommitted
Fix preserveAspectRatio application
Add support for different preserveAspectRatio attribute values Add unit tests DEVSIX-2240
1 parent 8c3b1b7 commit 4da8fb3

File tree

490 files changed

+2401
-304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

490 files changed

+2401
-304
lines changed

forms/src/main/java/com/itextpdf/forms/xfdf/XfdfObject.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ public void setFields(FieldsObject fields) {
8383
this.fields = fields;
8484
}
8585

86-
8786
public AnnotsObject getAnnots() {
8887
return annots;
8988
}

svg/src/main/java/com/itextpdf/svg/SvgConstants.java

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -849,18 +849,13 @@ public static final class Values {
849849
/**
850850
* Value representing the default aspect ratio: xmidymid.
851851
*/
852-
public static final String DEFAULT_ASPECT_RATIO = "xmidymid";
852+
public static final String DEFAULT_ASPECT_RATIO = Values.XMID_YMID;
853853

854854
/**
855855
* Value representing how to preserve the aspect ratio when dealing with images.
856856
*/
857857
public static final String DEFER = "defer";
858858

859-
/**
860-
* Value representing the text-alignment end for text objects
861-
*/
862-
public static final String TEXT_ANCHOR_END = "end";
863-
864859
/**
865860
* Value representing the fill rule "even odd".
866861
*/
@@ -872,25 +867,41 @@ public static final class Values {
872867
public static final String FILL_RULE_NONZERO = "nonzero";
873868

874869
/**
875-
* Value representing the text-alignment middle for text objects
870+
* Value representing the meet for preserve aspect ratio calculations.
876871
*/
877-
public static final String TEXT_ANCHOR_MIDDLE = "middle";
872+
public static final String MEET = "meet";
878873

879874
/**
880875
* Value representing the "none" value".
881876
*/
882877
public static final String NONE = "none";
883878

884879
/**
885-
* Value representing the text-alignment start for text objects
880+
* The value representing slice for the preserve aspect ratio calculations;
886881
*/
887-
public static final String TEXT_ANCHOR_START = "start";
882+
public static final String SLICE = "slice";
888883

889884
/**
890-
* The value corresponding with the namespace url for SVG
885+
* The value corresponding with the namespace url for SVG. Will be removed since version 7.2.
891886
*/
887+
@Deprecated
892888
public static final String SVGNAMESPACEURL = "http://www.w3.org/2000/svg";
893889

890+
/**
891+
* Value representing the text-alignment end for text objects
892+
*/
893+
public static final String TEXT_ANCHOR_END = "end";
894+
895+
/**
896+
* Value representing the text-alignment middle for text objects
897+
*/
898+
public static final String TEXT_ANCHOR_MIDDLE = "middle";
899+
900+
/**
901+
* Value representing the text-alignment start for text objects
902+
*/
903+
public static final String TEXT_ANCHOR_START = "start";
904+
894905
/**
895906
* Value representing how to align when scaling.
896907
*/
@@ -906,6 +917,11 @@ public static final class Values {
906917
*/
907918
public static final String XMIN_YMAX = "xminymax";
908919

920+
/**
921+
* Value representing how to align when scaling.
922+
*/
923+
public static final String XMID_YMID = "xmidymid";
924+
909925
/**
910926
* Value representing how to align when scaling.
911927
*/

svg/src/main/java/com/itextpdf/svg/converter/SvgConverter.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,9 @@ public static PdfFormXObject convertToXObject(InputStream stream, PdfDocument do
667667
//Private converter for unification
668668
private static PdfFormXObject convertToXObject(ISvgProcessorResult processorResult, PdfDocument document, ISvgConverterProperties props) {
669669
String baseUri = "";
670-
if (props != null) baseUri = props.getBaseUri();
670+
if (props != null) {
671+
baseUri = props.getBaseUri();
672+
}
671673
SvgDrawContext drawContext = new SvgDrawContext(new ResourceResolver(baseUri), processorResult.getFontProvider());
672674
drawContext.setTempFonts(processorResult.getTempFonts());
673675
drawContext.addNamedObjects(processorResult.getNamedObjects());

0 commit comments

Comments
 (0)