Skip to content

Commit 1597c3a

Browse files
committed
line spacng support in text overlay
1 parent 9d301aa commit 1597c3a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

cloudinary-core/src/main/java/com/cloudinary/transformation/TextLayerBuilder.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class TextLayerBuilder extends AbstractLayerBuilder<TextLayerBuilder> {
1515
protected String textAlign = null;
1616
protected String stroke = null;
1717
protected String letterSpacing = null;
18+
protected Integer lineSpacing = null;
1819
protected String text = null;
1920

2021
@Override
@@ -73,6 +74,11 @@ public TextLayerBuilder letterSpacing(String letterSpacing) {
7374
this.letterSpacing = letterSpacing;
7475
return self();
7576
}
77+
78+
public TextLayerBuilder lineSpacing(Integer lineSpacing) {
79+
this.lineSpacing = lineSpacing;
80+
return self();
81+
}
7682

7783
public TextLayerBuilder text(String text) {
7884
this.text = SmartUrlEncoder.encode(text).replace("%2C", "%E2%80%9A").replace("/", "%E2%81%84");
@@ -119,6 +125,8 @@ protected String textStyleIdentifier() {
119125
components.add(this.stroke);
120126
if (StringUtils.isNotBlank(this.letterSpacing))
121127
components.add("letter_spacing_" + this.letterSpacing);
128+
if (this.lineSpacing != null)
129+
components.add("line_spacing_" + this.lineSpacing.toString());
122130

123131
if (this.fontFamily == null && this.fontSize == null && components.isEmpty()) {
124132
return null;

cloudinary-core/src/test/java/com/cloudinary/test/CloudinaryTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,8 +919,8 @@ public void testOverlayOptions() {
919919
new TextLayerBuilder().text("Hello World, Nice to meet you?").fontFamily("Arial").fontSize(18),
920920
"text:Arial_18:Hello%20World%E2%80%9A%20Nice%20to%20meet%20you%3F",
921921
new TextLayerBuilder().text("Hello World, Nice to meet you?").fontFamily("Arial").fontSize(18)
922-
.fontWeight("bold").fontStyle("italic").letterSpacing("4"),
923-
"text:Arial_18_bold_italic_letter_spacing_4:Hello%20World%E2%80%9A%20Nice%20to%20meet%20you%3F",
922+
.fontWeight("bold").fontStyle("italic").letterSpacing("4").lineSpacing(3),
923+
"text:Arial_18_bold_italic_letter_spacing_4_line_spacing_3:Hello%20World%E2%80%9A%20Nice%20to%20meet%20you%3F",
924924
new SubtitlesLayerBuilder().publicId("sample_sub_en.srt"), "subtitles:sample_sub_en.srt",
925925
new SubtitlesLayerBuilder().publicId("sample_sub_he.srt").fontFamily("Arial").fontSize(40),
926926
"subtitles:Arial_40:sample_sub_he.srt" };

0 commit comments

Comments
 (0)