use semibold font instead of font-weight: 600

This commit is contained in:
Gavin Nishizawa 2023-04-10 13:55:52 -07:00
parent 624b2a9a10
commit 423c7e88eb
No known key found for this signature in database
GPG key ID: AE3B177777CE55CD
2 changed files with 22 additions and 11 deletions

View file

@ -1434,6 +1434,22 @@ func EmbedFonts(buf *bytes.Buffer, diagramHash, source string, fontFamily *d2fon
), ),
) )
if fontFamily != nil && *fontFamily == d2fonts.SourceSansPro {
appendOnTrigger(
buf,
source,
[]string{`class="md"`},
fmt.Sprintf(`
@font-face {
font-family: %s-font-semibold;
src: url("%s");
}`,
diagramHash,
fontFamily.Font(0, d2fonts.FONT_STYLE_SEMIBOLD).GetEncodedSubset(corpus),
),
)
}
appendOnTrigger( appendOnTrigger(
buf, buf,
source, source,
@ -1769,6 +1785,7 @@ func Render(diagram *d2target.Diagram, opts *RenderOpts) ([]byte, error) {
css = strings.ReplaceAll(css, "font-bold", fmt.Sprintf("%s-font-bold", diagramHash)) css = strings.ReplaceAll(css, "font-bold", fmt.Sprintf("%s-font-bold", diagramHash))
css = strings.ReplaceAll(css, "font-mono", fmt.Sprintf("%s-font-mono", diagramHash)) css = strings.ReplaceAll(css, "font-mono", fmt.Sprintf("%s-font-mono", diagramHash))
css = strings.ReplaceAll(css, "font-regular", fmt.Sprintf("%s-font-regular", diagramHash)) css = strings.ReplaceAll(css, "font-regular", fmt.Sprintf("%s-font-regular", diagramHash))
css = strings.ReplaceAll(css, "font-semibold", fmt.Sprintf("%s-font-semibold", diagramHash))
fmt.Fprintf(upperBuf, `<style type="text/css">%s</style>`, css) fmt.Fprintf(upperBuf, `<style type="text/css">%s</style>`, css)
} }

View file

@ -70,7 +70,6 @@
.md h1 { .md h1 {
margin: 0.67em 0; margin: 0.67em 0;
font-weight: 600;
padding-bottom: 0.3em; padding-bottom: 0.3em;
font-size: 2em; font-size: 2em;
border-bottom: 1px solid var(--color-border-muted); border-bottom: 1px solid var(--color-border-muted);
@ -240,35 +239,30 @@
.md h6 { .md h6 {
margin-top: 24px; margin-top: 24px;
margin-bottom: 16px; margin-bottom: 16px;
font-weight: 600; font-weight: 400;
line-height: 1.25; line-height: 1.25;
font-family: "font-regular"; font-family: "font-semibold";
} }
.md h2 { .md h2 {
font-weight: 600;
padding-bottom: 0.3em; padding-bottom: 0.3em;
font-size: 1.5em; font-size: 1.5em;
border-bottom: 1px solid var(--color-border-muted); border-bottom: 1px solid var(--color-border-muted);
} }
.md h3 { .md h3 {
font-weight: 600;
font-size: 1.25em; font-size: 1.25em;
} }
.md h4 { .md h4 {
font-weight: 600;
font-size: 1em; font-size: 1em;
} }
.md h5 { .md h5 {
font-weight: 600;
font-size: 0.875em; font-size: 0.875em;
} }
.md h6 { .md h6 {
font-weight: 600;
font-size: 0.85em; font-size: 0.85em;
color: var(--color-fg-muted); color: var(--color-fg-muted);
} }
@ -465,7 +459,7 @@
margin-top: 16px; margin-top: 16px;
font-size: 1em; font-size: 1em;
font-style: italic; font-style: italic;
font-weight: 600; font-family: "font-semibold";
} }
.md dl dd { .md dl dd {
@ -474,7 +468,7 @@
} }
.md table th { .md table th {
font-weight: 600; font-family: "font-semibold";
} }
.md table th, .md table th,
@ -677,7 +671,7 @@
} }
.md .csv-data th { .md .csv-data th {
font-weight: 600; font-family: "font-semibold";
background: var(--color-canvas-subtle); background: var(--color-canvas-subtle);
border-top: 0; border-top: 0;
} }