stix

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: BSD-3-Clause Imports: 0 Imported by: 0

README

stix

GitHub release GoDoc License

stix provides the STIX fonts as importable Go packages.

The fonts are released under the SIL Open Font license. The Go packages under the BSD-3 license.

Example

import (
	"fmt"
	"log"

	"codeberg.org/go-fonts/stix/stix2mathregular"
	"golang.org/x/image/font/sfnt"
)

func Example() {
	ttf, err := sfnt.Parse(stix2mathregular.TTF)
	if err != nil {
		log.Fatalf("could not parse STIX2 Math font: %+v", err)
	}

	var buf sfnt.Buffer
	v, err := ttf.Name(&buf, sfnt.NameIDVersion)
	if err != nil {
		log.Fatalf("could not retrieve font version: %+v", err)
	}

	fmt.Printf("version:    %s\n", v)
	fmt.Printf("num glyphs: %d\n", ttf.NumGlyphs())

	// Output:
	// version:    Version 2.13 b171
	// num glyphs: 6760
}

Documentation

Overview

Package stix holds TTF data of the STIX2 fonts.

Example
package main

import (
	"fmt"
	"log"

	"codeberg.org/go-fonts/stix/stix2mathregular"
	"golang.org/x/image/font/sfnt"
)

func main() {
	ttf, err := sfnt.Parse(stix2mathregular.TTF)
	if err != nil {
		log.Fatalf("could not parse STIX2 Math font: %+v", err)
	}

	var buf sfnt.Buffer
	v, err := ttf.Name(&buf, sfnt.NameIDVersion)
	if err != nil {
		log.Fatalf("could not retrieve font version: %+v", err)
	}

	fmt.Printf("version:    %s\n", v)
	fmt.Printf("num glyphs: %d\n", ttf.NumGlyphs())

}
Output:

version:    Version 2.13 b171
num glyphs: 6760

Directories

Path Synopsis
Package stix2mathregular provides the "STIXTwoMath Regular" TrueType font from the STIX2 font family.
Package stix2mathregular provides the "STIXTwoMath Regular" TrueType font from the STIX2 font family.
Package stix2textbold provides the "STIXTwoText Bold" TrueType font from the STIX2 font family.
Package stix2textbold provides the "STIXTwoText Bold" TrueType font from the STIX2 font family.
Package stix2textbolditalic provides the "STIXTwoText BoldItalic" TrueType font from the STIX2 font family.
Package stix2textbolditalic provides the "STIXTwoText BoldItalic" TrueType font from the STIX2 font family.
Package stix2textitalic provides the "STIXTwoText Italic" TrueType font from the STIX2 font family.
Package stix2textitalic provides the "STIXTwoText Italic" TrueType font from the STIX2 font family.
Package stix2textmedium provides the "STIXTwoText Medium" TrueType font from the STIX2 font family.
Package stix2textmedium provides the "STIXTwoText Medium" TrueType font from the STIX2 font family.
Package stix2textmediumitalic provides the "STIXTwoText MediumItalic" TrueType font from the STIX2 font family.
Package stix2textmediumitalic provides the "STIXTwoText MediumItalic" TrueType font from the STIX2 font family.
Package stix2textregular provides the "STIXTwoText Regular" TrueType font from the STIX2 font family.
Package stix2textregular provides the "STIXTwoText Regular" TrueType font from the STIX2 font family.
Package stix2textsemibold provides the "STIXTwoText SemiBold" TrueType font from the STIX2 font family.
Package stix2textsemibold provides the "STIXTwoText SemiBold" TrueType font from the STIX2 font family.
Package stix2textsemibolditalic provides the "STIXTwoText SemiBoldItalic" TrueType font from the STIX2 font family.
Package stix2textsemibolditalic provides the "STIXTwoText SemiBoldItalic" TrueType font from the STIX2 font family.

Jump to

Keyboard shortcuts

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