Skip to content

Default fonts#

To be able to render HTML without loading lots of external fonts, the frontend provides three default font families for serif, sans and monospace. These fonts must be loaded with

func (fe *Document) LoadIncludedFonts() error

To access these fonts, use the font family:

// or monospace or serif
ff := f.FindFontFamily("serif")

This would be the CSS definition of the default fonts.

@font-face {
    font-family: "monospace";
    src: url("CamingoCode Regular.ttf");
}
@font-face {
    font-family: "monospace";
    src: url("CamingoCode Bold.ttf");
    font-weight: bold;
}
@font-face {
    font-family: "monospace";
    src: url("CamingoCode BoldItalic.ttf");
    font-weight: bold;
    font-style: italic;
}
@font-face {
    font-family: "monospace";
    src: url("CamingoCode Italic.ttf");
    font-style: italic;
}

@font-face {
    font-family: "serif";
    src: url("CrimsonPro-Regular.ttf");
}
@font-face {
    font-family: "serif";
    src: url("CrimsonPro-Bold.ttf");
    font-weight: bold;
}
@font-face {
    font-family: "serif";
    src: url("CrimsonPro-BoldItalic.ttf");
    font-weight: bold;
    font-style: italic;
}
@font-face {
    font-family: "serif";
    src: url("CrimsonPro-Italic.ttf");
    font-style: italic;
}

@font-face {
    font-family: "sans";
    src: url("texgyreheros-regular.otf");
}
@font-face {
    font-family: "sans";
    src: url("texgyreheros-bold.otf");
    font-weight: bold;
}
@font-face {
    font-family: "sans";
    src: url("texgyreheros-bolditalic.otf");
    font-weight: bold;
    font-style: italic;
}
@font-face {
    font-family: "sans";
    src: url("texgyreheros-italic.otf");
    font-style: italic;
}