using semibold

This commit is contained in:
Gavin Nishizawa 2023-04-10 14:38:34 -07:00
parent d4228a171e
commit 07faf97941
No known key found for this signature in database
GPG key ID: AE3B177777CE55CD
2 changed files with 24 additions and 11 deletions

View file

@ -115,6 +115,9 @@ var sourceCodeProRegularBase64 string
//go:embed encoded/SourceCodePro-Bold.txt
var sourceCodeProBoldBase64 string
//go:embed encoded/SourceCodePro-Semibold.txt
var sourceCodeProSemiboldBase64 string
//go:embed encoded/SourceCodePro-Italic.txt
var sourceCodeProItalicBase64 string
@ -156,6 +159,10 @@ func init() {
Family: SourceCodePro,
Style: FONT_STYLE_BOLD,
}: sourceCodeProBoldBase64,
{
Family: SourceCodePro,
Style: FONT_STYLE_SEMIBOLD,
}: sourceCodeProSemiboldBase64,
{
Family: SourceCodePro,
Style: FONT_STYLE_ITALIC,
@ -204,6 +211,14 @@ func init() {
Family: SourceCodePro,
Style: FONT_STYLE_BOLD,
}] = b
b, err = fontFacesFS.ReadFile("ttf/SourceCodePro-Semibold.ttf")
if err != nil {
panic(err)
}
FontFaces[Font{
Family: SourceCodePro,
Style: FONT_STYLE_SEMIBOLD,
}] = b
b, err = fontFacesFS.ReadFile("ttf/SourceCodePro-Italic.ttf")
if err != nil {
panic(err)

View file

@ -1434,21 +1434,19 @@ func EmbedFonts(buf *bytes.Buffer, diagramHash, source string, fontFamily *d2fon
),
)
if fontFamily != nil && *fontFamily == d2fonts.SourceSansPro {
appendOnTrigger(
buf,
source,
[]string{`class="md"`},
fmt.Sprintf(`
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),
),
)
}
diagramHash,
fontFamily.Font(0, d2fonts.FONT_STYLE_SEMIBOLD).GetEncodedSubset(corpus),
),
)
appendOnTrigger(
buf,