diff --git a/openhtmltopdf-core/src/main/java/com/openhtmltopdf/render/ListItemPainter.java b/openhtmltopdf-core/src/main/java/com/openhtmltopdf/render/ListItemPainter.java index a2f146ecc..e4025bedc 100755 --- a/openhtmltopdf-core/src/main/java/com/openhtmltopdf/render/ListItemPainter.java +++ b/openhtmltopdf-core/src/main/java/com/openhtmltopdf/render/ListItemPainter.java @@ -134,6 +134,9 @@ private static void drawText(RenderingContext c, BlockBox box, IdentValue listSt c.getOutputDevice().setColor(box.getStyle().getColor()); c.getOutputDevice().setFont(box.getStyle().getFSFont(c)); + if (c.getOutputDevice() instanceof AbstractOutputDevice) { + ((AbstractOutputDevice) c.getOutputDevice()).setFontSpecification(box.getStyle().getFontSpecification()); + } c.getTextRenderer().drawString( c.getOutputDevice(), text.getText(), x, y); } diff --git a/openhtmltopdf-examples/src/main/resources/visualtest/expected/list-counter-after-page-break.pdf b/openhtmltopdf-examples/src/main/resources/visualtest/expected/list-counter-after-page-break.pdf new file mode 100644 index 000000000..f4dfeb1ce Binary files /dev/null and b/openhtmltopdf-examples/src/main/resources/visualtest/expected/list-counter-after-page-break.pdf differ diff --git a/openhtmltopdf-examples/src/main/resources/visualtest/html/list-counter-after-page-break.html b/openhtmltopdf-examples/src/main/resources/visualtest/html/list-counter-after-page-break.html new file mode 100644 index 000000000..cbabf7a48 --- /dev/null +++ b/openhtmltopdf-examples/src/main/resources/visualtest/html/list-counter-after-page-break.html @@ -0,0 +1,17 @@ + + + + + +

+ bolded text +

+
    +
  1. counter should not be bold
  2. +
+ + diff --git a/openhtmltopdf-examples/src/test/java/com/openhtmltopdf/visualregressiontests/VisualRegressionTest.java b/openhtmltopdf-examples/src/test/java/com/openhtmltopdf/visualregressiontests/VisualRegressionTest.java index 20b45b5e9..ad15ecea7 100644 --- a/openhtmltopdf-examples/src/test/java/com/openhtmltopdf/visualregressiontests/VisualRegressionTest.java +++ b/openhtmltopdf-examples/src/test/java/com/openhtmltopdf/visualregressiontests/VisualRegressionTest.java @@ -890,6 +890,15 @@ public void testFloatClearBoth() throws IOException { public void testBorderRadius() throws IOException { assertTrue(vt.runTest("border-radius")); } + + /** + * Check counter style after page break, it should not be affected by a previous bolded text, see issue + * https://github.com/danfickle/openhtmltopdf/issues/366 + */ + @Test + public void testListCounterAfterPageBreak() throws IOException { + assertTrue(vt.runTest("list-counter-after-page-break")); + } // TODO: // + Elements that appear just on generated overflow pages.