d2fonts

package
v0.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2022 License: MPL-2.0 Imports: 2 Imported by: 10

README

d2fonts

The SVG renderer embeds fonts directly into the SVG as base64 data. This is to give determinstic outputs and load without a network call.

To include your own font, e.g. Helvetica, you must include the Truetype glyphs:

  • ./ttf/Helvetica-Bold.ttf
  • ./ttf/Helvetica-Italic.ttf
  • ./ttf/Helvetica-Regular.ttf

You must also include an encoded version of these of mimetype application/font-woff:

  • ./ttf/Helvetica-Bold.txt
  • ./ttf/Helvetica-Italic.txt
  • ./ttf/Helvetica-Regular.txt

If you include a font to contribute, it must have an open license.

Documentation

Overview

TODO write a script to do this as part of CI

Index

Constants

View Source
const (
	FONT_SIZE_XS   = 13
	FONT_SIZE_S    = 14
	FONT_SIZE_M    = 16
	FONT_SIZE_L    = 20
	FONT_SIZE_XL   = 24
	FONT_SIZE_XXL  = 28
	FONT_SIZE_XXXL = 32

	FONT_STYLE_REGULAR FontStyle = "regular"
	FONT_STYLE_BOLD    FontStyle = "bold"
	FONT_STYLE_ITALIC  FontStyle = "italic"

	SourceSansPro FontFamily = iota
	SourceCodePro FontFamily = iota
)

Variables

View Source
var FontEncodings map[Font]string
View Source
var FontFaces map[Font][]byte

Functions

This section is empty.

Types

type Font

type Font struct {
	Family FontFamily
	Style  FontStyle
	Size   int
}

type FontFamily

type FontFamily int

func (FontFamily) Font

func (f FontFamily) Font(size int, style FontStyle) Font

type FontStyle

type FontStyle string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL