@@ -180,6 +180,9 @@ public LayoutResult layout(LayoutContext layoutContext) {
180
180
Border [] borders = getBorders ();
181
181
applyBorderBox (layoutBox , borders , false );
182
182
183
+ float [] paddings = getPaddings ();
184
+ applyPaddings (layoutBox , paddings , false );
185
+
183
186
MinMaxWidth countedMinMaxWidth = new MinMaxWidth (area .getBBox ().getWidth () - layoutBox .getWidth (), area .getBBox ().getWidth ());
184
187
AbstractWidthHandler widthHandler = new MaxSumWidthHandler (countedMinMaxWidth );
185
188
@@ -347,6 +350,7 @@ public LayoutResult layout(LayoutContext layoutContext) {
347
350
} else {
348
351
// check if line height exceeds the allowed height
349
352
if (Math .max (currentLineHeight , nonBreakablePartMaxHeight ) > layoutBox .getHeight () && (null == overflowY || OverflowPropertyValue .FIT .equals (overflowY ))) {
353
+ applyPaddings (occupiedArea .getBBox (), paddings , true );
350
354
applyBorderBox (occupiedArea .getBBox (), borders , true );
351
355
applyMargins (occupiedArea .getBBox (), margins , true );
352
356
// Force to place what we can
@@ -442,6 +446,7 @@ public LayoutResult layout(LayoutContext layoutContext) {
442
446
boolean isPlacingForcedWhileNothing = false ;
443
447
if (currentLineHeight > layoutBox .getHeight ()) {
444
448
if (!Boolean .TRUE .equals (getPropertyAsBoolean (Property .FORCED_PLACEMENT )) && (null == overflowY || OverflowPropertyValue .FIT .equals (overflowY ))) {
449
+ applyPaddings (occupiedArea .getBBox (), paddings , true );
445
450
applyBorderBox (occupiedArea .getBBox (), borders , true );
446
451
applyMargins (occupiedArea .getBBox (), margins , true );
447
452
return new TextLayoutResult (LayoutResult .NOTHING , occupiedArea , null , this , this );
@@ -459,6 +464,7 @@ public LayoutResult layout(LayoutContext layoutContext) {
459
464
layoutBox .setHeight (area .getBBox ().getHeight () - currentLineHeight );
460
465
461
466
occupiedArea .getBBox ().setWidth (occupiedArea .getBBox ().getWidth () + italicSkewAddition + boldSimulationAddition );
467
+ applyPaddings (occupiedArea .getBBox (), paddings , true );
462
468
applyBorderBox (occupiedArea .getBBox (), borders , true );
463
469
applyMargins (occupiedArea .getBBox (), margins , true );
464
470
@@ -594,6 +600,7 @@ public void draw(DrawContext drawContext) {
594
600
595
601
applyMargins (occupiedArea .getBBox (), getMargins (), false );
596
602
applyBorderBox (occupiedArea .getBBox (), false );
603
+ applyPaddings (occupiedArea .getBBox (), getPaddings (), false );
597
604
598
605
boolean isRelativePosition = isRelativePosition ();
599
606
if (isRelativePosition ) {
@@ -750,6 +757,7 @@ public boolean accept(Glyph glyph) {
750
757
applyRelativePositioningTranslation (false );
751
758
}
752
759
760
+ applyPaddings (occupiedArea .getBBox (), true );
753
761
applyBorderBox (occupiedArea .getBBox (), true );
754
762
applyMargins (occupiedArea .getBBox (), getMargins (), true );
755
763
@@ -1142,7 +1150,7 @@ protected boolean resolveFonts(List<IRenderer> addTo) {
1142
1150
FontSelectorStrategy strategy = provider .getStrategy (strToBeConverted ,
1143
1151
FontFamilySplitter .splitFontFamily ((String ) font ), fc , fontSet );
1144
1152
// process empty renderers because they can have borders or paddings with background to be drawn
1145
- if (null != strToBeConverted && strToBeConverted .isEmpty ()) {
1153
+ if (null == strToBeConverted || strToBeConverted .isEmpty ()) {
1146
1154
addTo .add (this );
1147
1155
} else {
1148
1156
while (!strategy .endOfText ()) {
0 commit comments