@@ -1141,11 +1141,16 @@ protected boolean resolveFonts(List<IRenderer> addTo) {
1141
1141
FontCharacteristics fc = createFontCharacteristics ();
1142
1142
FontSelectorStrategy strategy = provider .getStrategy (strToBeConverted ,
1143
1143
FontFamilySplitter .splitFontFamily ((String ) font ), fc , fontSet );
1144
- while (!strategy .endOfText ()) {
1145
- GlyphLine nextGlyphs = new GlyphLine (strategy .nextGlyphs ());
1146
- PdfFont currentFont = strategy .getCurrentFont ();
1147
- TextRenderer textRenderer = createCopy (replaceSpecialWhitespaceGlyphs (nextGlyphs , currentFont ), currentFont );
1148
- addTo .add (textRenderer );
1144
+ // process empty renderers because they can have borders or paddings with background to be drawn
1145
+ if (null != strToBeConverted && strToBeConverted .isEmpty ()) {
1146
+ addTo .add (this );
1147
+ } else {
1148
+ while (!strategy .endOfText ()) {
1149
+ GlyphLine nextGlyphs = new GlyphLine (strategy .nextGlyphs ());
1150
+ PdfFont currentFont = strategy .getCurrentFont ();
1151
+ TextRenderer textRenderer = createCopy (replaceSpecialWhitespaceGlyphs (nextGlyphs , currentFont ), currentFont );
1152
+ addTo .add (textRenderer );
1153
+ }
1149
1154
}
1150
1155
return true ;
1151
1156
} else {
@@ -1282,8 +1287,10 @@ private void updateFontAndText() {
1282
1287
}
1283
1288
catch (ClassCastException cce ) {
1284
1289
font = resolveFirstPdfFont ();
1285
- Logger logger = LoggerFactory .getLogger (TextRenderer .class );
1286
- logger .error (LogMessageConstant .FONT_PROPERTY_MUST_BE_PDF_FONT_OBJECT );
1290
+ if (!strToBeConverted .isEmpty ()) {
1291
+ Logger logger = LoggerFactory .getLogger (TextRenderer .class );
1292
+ logger .error (LogMessageConstant .FONT_PROPERTY_MUST_BE_PDF_FONT_OBJECT );
1293
+ }
1287
1294
}
1288
1295
text = convertToGlyphLine (strToBeConverted );
1289
1296
otfFeaturesApplied = false ;
0 commit comments