diff --git a/gnucash/report/html-fonts.scm b/gnucash/report/html-fonts.scm
index 0cd86c1760..ea5a3126fc 100644
--- a/gnucash/report/html-fonts.scm
+++ b/gnucash/report/html-fonts.scm
@@ -37,6 +37,7 @@
(define (font-name-to-style-info font-name)
(let* ((font-style "")
(font-weight "")
+ (font-stretch "")
(idx (string-index-right font-name #\space))
(font-size (substring font-name (1+ idx) (string-length font-name)))
(font-name (string-take font-name idx)))
@@ -54,9 +55,18 @@
(set! font-style "font-style: oblique; ")
(set! font-name (string-strip font-name " oblique"))))
- (string-append "font-family: " font-name ", Sans-Serif; "
+ (cond
+ ((string-contains-ci font-name " expanded")
+ (set! font-stretch "font-stretch: expanded; ")
+ (set! font-name (string-strip font-name " expanded")))
+
+ ((string-contains-ci font-name " condensed")
+ (set! font-stretch "font-stretch: condensed; ")
+ (set! font-name (string-strip font-name " condensed"))))
+
+ (string-append "font-family: \"" font-name "\", sans-serif; "
"font-size: " font-size "pt; "
- font-style font-weight)))
+ font-style font-weight font-stretch)))
;; Registers font options
(define (register-font-options options)
diff --git a/gnucash/report/test/test-html-fonts.scm b/gnucash/report/test/test-html-fonts.scm
index 65352f9a67..0a6df2ca77 100644
--- a/gnucash/report/test/test-html-fonts.scm
+++ b/gnucash/report/test/test-html-fonts.scm
@@ -14,23 +14,23 @@
(test-begin "font-name-to-style-info")
(test-equal "basic"
- "font-family: Courier Regular, Sans-Serif; font-size: 20pt; "
+ "font-family: \"Courier Regular\", sans-serif; font-size: 20pt; "
(font-name-to-style-info "Courier Regular 20"))
(test-equal "basic size 50"
- "font-family: Courier Regular, Sans-Serif; font-size: 50pt; "
+ "font-family: \"Courier Regular\", sans-serif; font-size: 50pt; "
(font-name-to-style-info "Courier Regular 50"))
(test-equal "basic size 50 bold"
- "font-family: Courier, Sans-Serif; font-size: 50pt; font-weight: bold; "
+ "font-family: \"Courier\", sans-serif; font-size: 50pt; font-weight: bold; "
(font-name-to-style-info "Courier bold 50"))
(test-equal "basic size 50 italic"
- "font-family: Courier, Sans-Serif; font-size: 50pt; font-style: italic; "
+ "font-family: \"Courier\", sans-serif; font-size: 50pt; font-style: italic; "
(font-name-to-style-info "Courier italic 50"))
(test-equal "basic size 15 oblique"
- "font-family: Courier, Sans-Serif; font-size: 15pt; font-style: oblique; "
+ "font-family: \"Courier\", sans-serif; font-size: 15pt; font-style: oblique; "
(font-name-to-style-info "Courier oblique 15"))
(test-end "font-name-to-style-info"))