diff --git a/CHANGELOG.md b/CHANGELOG.md index ce55c18e4..8868fbe0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ This can also be enabled programmatically with `warnings.simplefilter('default', * In [text_columns()](https://py-pdf.github.io/fpdf2/extColumns.html), paragraph top/bottom margins didn't correctly trigger column breaks; [issue #1214](https://github.com/py-pdf/fpdf2/issues/1214) * [`fpdf.drawing.color_from_hex_string`](https://py-pdf.github.io/fpdf2/fpdf/drawing.html#fpdf.drawing.color_from_hex_string) did not test or mention accepting lowercase hex values. * handling of bidirectional text on `FPDF.get_string_width()` [issue #1231] +* pdf.font_style now behaves like pdf.set_font() `FPDF.font_style` [issue #1223] * new translation of the tutorial in [Indonesian](https://py-pdf.github.io/fpdf2/Tutorial-id.html) - thanks to @odhyp ### Removed * an obscure and undocumented [feature](https://github.com/py-pdf/fpdf2/issues/1198) of [`FPDF.write_html()`](https://py-pdf.github.io/fpdf2/fpdf/fpdf.html#fpdf.fpdf.FPDF.write_html), which used to magically pass instance attributes as arguments. diff --git a/test/fonts/fonts_issue_1223.pdf b/test/fonts/fonts_issue_1223.pdf new file mode 100644 index 000000000..2abbf4cb1 Binary files /dev/null and b/test/fonts/fonts_issue_1223.pdf differ diff --git a/test/fonts/test_set_font.py b/test/fonts/test_set_font.py index e62581eac..4ad1efcd6 100644 --- a/test/fonts/test_set_font.py +++ b/test/fonts/test_set_font.py @@ -55,6 +55,19 @@ def test_set_builtin_font(tmp_path): pdf.text(0, 10 + 40 * i + 10 * j, "Hello World!") assert_pdf_equal(pdf, HERE / "fonts_set_builtin_font.pdf", tmp_path) +def test_issue_1223(tmp_path): + pdf = FPDF() + pdf.add_page() + pdf.set_font("Helvetica", size=32) + with pdf.text_columns() as cols: + with cols.paragraph() as par: + par.write(text="Un.") + pdf.font_style = "B" + with cols.paragraph() as par: + par.write(text="Deux.") + pdf.font_style = "I" + par.write(text="Trois.") + assert_pdf_equal(pdf, HERE / "fonts_issue_1223.pdf", tmp_path) def test_issue_66(tmp_path): pdf = FPDF()