@@ -2390,8 +2390,10 @@ class Field extends XFAObject {
2390
2390
2391
2391
const caption = this . caption ? this . caption [ $toHTML ] ( ) . html : null ;
2392
2392
if ( ! caption ) {
2393
- // Even if no caption this class will help to center the ui.
2394
- ui . attributes . class . push ( "xfaLeft" ) ;
2393
+ if ( ui . attributes . class ) {
2394
+ // Even if no caption this class will help to center the ui.
2395
+ ui . attributes . class . push ( "xfaLeft" ) ;
2396
+ }
2395
2397
return HTMLResult . success ( createWrapper ( this , html ) , bbox ) ;
2396
2398
}
2397
2399
@@ -2625,13 +2627,8 @@ class Font extends XFAObject {
2625
2627
// TODO: fontHorizontalScale
2626
2628
// TODO: fontVerticalScale
2627
2629
2628
- if ( this . kerningMode !== "none" ) {
2629
- style . fontKerning = "normal" ;
2630
- }
2631
-
2632
- if ( this . letterSpacing ) {
2633
- style . letterSpacing = measureToString ( this . letterSpacing ) ;
2634
- }
2630
+ style . fontKerning = this . kerningMode === "none" ? "none" : "normal" ;
2631
+ style . letterSpacing = measureToString ( this . letterSpacing ) ;
2635
2632
2636
2633
if ( this . lineThrough !== 0 ) {
2637
2634
style . textDecoration = "line-through" ;
@@ -2651,9 +2648,7 @@ class Font extends XFAObject {
2651
2648
2652
2649
// TODO: overlinePeriod
2653
2650
2654
- if ( this . posture !== "normal" ) {
2655
- style . fontStyle = this . posture ;
2656
- }
2651
+ style . fontStyle = this . posture ;
2657
2652
2658
2653
const fontSize = measureToString ( 0.99 * this . size ) ;
2659
2654
if ( fontSize !== "10px" ) {
@@ -2671,9 +2666,7 @@ class Font extends XFAObject {
2671
2666
2672
2667
// TODO: underlinePeriod
2673
2668
2674
- if ( this . weight !== "normal" ) {
2675
- style . fontWeight = this . weight ;
2676
- }
2669
+ style . fontWeight = this . weight ;
2677
2670
2678
2671
return style ;
2679
2672
}
@@ -4630,19 +4623,26 @@ class Template extends XFAObject {
4630
4623
}
4631
4624
4632
4625
if ( node . targetType === "pageArea" ) {
4626
+ if ( ! ( target instanceof PageArea ) ) {
4627
+ target = null ;
4628
+ }
4629
+
4633
4630
if ( startNew ) {
4631
+ targetPageArea = target || pageArea ;
4634
4632
flush ( i ) ;
4635
4633
i = Infinity ;
4636
- } else if ( target === pageArea || ! ( target instanceof PageArea ) ) {
4637
- // Just ignore the break and do layout again.
4638
- i -- ;
4639
- } else {
4640
- // We must stop the contentAreas filling and go to the next page.
4634
+ } else if ( target && target !== pageArea ) {
4641
4635
targetPageArea = target ;
4642
4636
flush ( i ) ;
4643
4637
i = Infinity ;
4638
+ } else {
4639
+ i -- ;
4644
4640
}
4645
4641
} else if ( node . targetType === "contentArea" ) {
4642
+ if ( ! ( target instanceof ContentArea ) ) {
4643
+ target = null ;
4644
+ }
4645
+
4646
4646
const index = contentAreas . findIndex ( e => e === target ) ;
4647
4647
if ( index !== - 1 ) {
4648
4648
flush ( i ) ;
0 commit comments