https://github.com/python/cpython/commit/e364a4212ec557ac04ecf9fe83ac482b72c1a47a commit: e364a4212ec557ac04ecf9fe83ac482b72c1a47a branch: 3.12 author: Wulian233 <1055917...@qq.com> committer: hugovk <1324225+hug...@users.noreply.github.com> date: 2025-03-14T12:23:39Z summary:
[3.12] gh-131204: Fix `difflib.HtmlDiff` may not use monospaced font (GH-131221) (#131243) (cherry picked from commit 7fd6160) files: A Misc/NEWS.d/next/Library/2025-03-14-09-28-13.gh-issue-131204.wogNEX.rst M Lib/difflib.py M Lib/test/test_difflib_expect.html diff --git a/Lib/difflib.py b/Lib/difflib.py index ba0b256969ebff..33e7e6c165aa0c 100644 --- a/Lib/difflib.py +++ b/Lib/difflib.py @@ -1628,7 +1628,7 @@ def _line_pair_iterator(): </html>""" _styles = """ - table.diff {font-family:Courier; border:medium;} + table.diff {font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace; border:medium} .diff_header {background-color:#e0e0e0} td.diff_header {text-align:right} .diff_next {background-color:#c0c0c0} diff --git a/Lib/test/test_difflib_expect.html b/Lib/test/test_difflib_expect.html index 3e6a7b7a9933d6..12091206a2856d 100644 --- a/Lib/test/test_difflib_expect.html +++ b/Lib/test/test_difflib_expect.html @@ -9,7 +9,7 @@ content="text/html; charset=utf-8" /> <title></title> <style type="text/css"> - table.diff {font-family:Courier; border:medium;} + table.diff {font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace; border:medium} .diff_header {background-color:#e0e0e0} td.diff_header {text-align:right} .diff_next {background-color:#c0c0c0} diff --git a/Misc/NEWS.d/next/Library/2025-03-14-09-28-13.gh-issue-131204.wogNEX.rst b/Misc/NEWS.d/next/Library/2025-03-14-09-28-13.gh-issue-131204.wogNEX.rst new file mode 100644 index 00000000000000..e821e61a0ca5ed --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-03-14-09-28-13.gh-issue-131204.wogNEX.rst @@ -0,0 +1 @@ +Use monospace font from System Font Stack for cross-platform support in :class:`difflib.HtmlDiff`. _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com