]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-131204: Fix `difflib.HtmlDiff` may not use monospaced font (GH-131221)...
authorWulian233 <1055917385@qq.com>
Fri, 14 Mar 2025 12:23:39 +0000 (20:23 +0800)
committerGitHub <noreply@github.com>
Fri, 14 Mar 2025 12:23:39 +0000 (12:23 +0000)
(cherry picked from commit 7fd6160)

Lib/difflib.py
Lib/test/test_difflib_expect.html
Misc/NEWS.d/next/Library/2025-03-14-09-28-13.gh-issue-131204.wogNEX.rst [new file with mode: 0644]

index ba0b256969ebff7cdc23ef2c51df29107ad2d867..33e7e6c165aa0c12c779331927c3a40f3b09d9e2 100644 (file)
@@ -1628,7 +1628,7 @@ _file_template = """
 </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}
index 3e6a7b7a9933d68b2aca2bd390a50b26442312e5..12091206a2856d00aee4c7e8054fd31c6e81212d 100644 (file)
@@ -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 (file)
index 0000000..e821e61
--- /dev/null
@@ -0,0 +1 @@
+Use monospace font from System Font Stack for cross-platform support in  :class:`difflib.HtmlDiff`.