testcases

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var All = []TestCase{
	func(p *document.Page) error {

		E, err := gofont.GoRegular.Embed(p.Out, nil)
		if err != nil {
			return err
		}
		p.TextSetFont(E, 24)
		return nil
	},

	func(p *document.Page) error {

		E, err := gofont.GoRegular.Embed(p.Out, nil)
		if err != nil {
			return err
		}
		p.TextSetFont(E, 24)
		p.TextFirstLine(10, 10)
		p.TextShow("Hello, world!")
		return nil
	},

	func(p *document.Page) error {

		E, err := gofont.GoRegular.Embed(p.Out, nil)
		if err != nil {
			return err
		}
		p.TextSetFont(E, 24)
		p.TextFirstLine(10, 50)
		p.TextShow("Hello, world!")
		p.TextSecondLine(0, -25)
		p.TextShow("Hello again, world!")
		return nil
	},

	func(p *document.Page) error {

		E, err := gofont.GoRegular.Embed(p.Out, nil)
		if err != nil {
			return err
		}
		p.TextSetFont(E, 24)
		p.TextFirstLine(10, 75)
		p.TextShow("Hello, world!")
		p.TextSecondLine(0, -25)
		p.TextShow("Hello again, world!")
		p.TextNextLine()
		p.TextShow("And again.")
		return nil
	},

	func(p *document.Page) error {

		E, err := gofont.GoRegular.Embed(p.Out, nil)
		if err != nil {
			return err
		}
		p.TextSetFont(E, 24)
		p.TextSetCharacterSpacing(10)
		p.TextShow("Hello, world!")
		return nil
	},

	func(p *document.Page) error {

		E, err := gofont.GoRegular.Embed(p.Out, nil)
		if err != nil {
			return err
		}
		p.TextSetFont(E, 24)
		p.TextSetCharacterSpacing(-5)
		p.TextShow("Hello, world!")
		return nil
	},

	func(p *document.Page) error {

		E, err := gofont.GoRegular.Embed(p.Out, nil)
		if err != nil {
			return err
		}
		p.TextSetFont(E, 24)
		p.TextSetWordSpacing(20)
		p.TextShow("Hello, world!")
		return nil
	},

	func(p *document.Page) error {

		E, err := gofont.GoRegular.Embed(p.Out, nil)
		if err != nil {
			return err
		}
		p.TextSetFont(E, 24)
		p.TextSetWordSpacing(-20)
		p.TextShow("Hello, world!")
		return nil
	},

	func(p *document.Page) error {

		E, err := gofont.GoRegular.Embed(p.Out, nil)
		if err != nil {
			return err
		}
		p.TextSetFont(E, 48)
		p.TextFirstLine(-20, 10)
		p.TextSetHorizontalScaling(1.5)
		p.TextShow("Hello, world!")
		return nil
	},

	func(p *document.Page) error {

		E, err := gofont.GoRegular.Embed(p.Out, nil)
		if err != nil {
			return err
		}
		p.TextSetFont(E, 48)
		p.TextSetHorizontalScaling(0.5)
		p.TextShow("Hello, world!")
		return nil
	},

	func(p *document.Page) error {

		E, err := gofont.GoRegular.Embed(p.Out, nil)
		if err != nil {
			return err
		}
		p.TextSetFont(E, 48)
		p.TextSetHorizontalScaling(-1)
		p.TextFirstLine(300, 20)
		p.TextShow("Hello, world!")
		return nil
	},

	func(p *document.Page) error {

		E, err := gofont.GoRegular.Embed(p.Out, nil)
		if err != nil {
			return err
		}
		p.TextSetFont(E, 24)
		p.TextFirstLine(10, 200)
		p.TextShow("Hello, world!")
		p.TextSetLeading(28)
		p.TextNextLine()
		p.TextShow("line 2")
		p.TextNextLine()
		p.TextShow("line 3")
		p.TextNextLine()
		p.TextShow("line 4")
		return nil
	},

	func(p *document.Page) error {

		E, err := gofont.GoRegular.Embed(p.Out, nil)
		if err != nil {
			return err
		}
		p.TextSetFont(E, 24)
		p.TextShow("Hello, ")
		p.TextSetRise(10)
		p.TextShow("world!")
		return nil
	},

	func(p *document.Page) error {

		E, err := gofont.GoRegular.Embed(p.Out, nil)
		if err != nil {
			return err
		}
		p.TextSetFont(E, 24)
		p.TextSetMatrix(matrix.Rotate(math.Pi / 4))
		p.TextShow("Hello, world!")
		return nil
	},

	func(p *document.Page) error {

		E, err := gofont.GoRegular.Embed(p.Out, nil)
		if err != nil {
			return err
		}
		p.TextSetFont(E, 24)
		p.TextSetMatrix(matrix.Matrix{1, 2, 3, 4, 50, 60})
		p.TextShow("ABC")
		return nil
	},

	func(p *document.Page) error {

		E, err := gofont.GoRegular.Embed(p.Out, nil)
		if err != nil {
			return err
		}
		p.TextSetFont(E, 24)
		s := font.EncodeText(E, "Hello, world!")
		p.TextShowRaw(s)
		return nil
	},

	func(p *document.Page) error {

		E, err := gofont.GoRegular.Embed(p.Out, nil)
		if err != nil {
			return err
		}
		p.TextFirstLine(10, 100)
		p.TextSetFont(E, 24)
		p.TextSetLeading(28)
		s := font.EncodeText(E, "Hello, world!")
		p.TextShowRaw(s)
		p.TextShowNextLineRaw(s)
		return nil
	},

	func(p *document.Page) error {

		E, err := gofont.GoRegular.Embed(p.Out, nil)
		if err != nil {
			return err
		}
		p.TextFirstLine(-20, 50)
		p.TextSetFont(E, 24)
		s := font.EncodeText(E, "Hello, world!")
		p.TextShowSpacedRaw(10, 5, s)
		return nil
	},
}
View Source
var AllGhostscript = []Answer{
	{0.000000, 0.000000},
	{146.250000, 10.000000},
	{212.250000, 25.000000},
	{126.250000, 25.000000},
	{266.250000, 0.000000},
	{71.250000, 0.000000},
	{156.250000, 0.000000},
	{116.250000, 0.000000},
	{388.750000, 10.000000},
	{136.250000, 0.000000},
	{27.500000, 20.000000},
	{69.000000, 116.000000},
	{136.250000, 10.000000},
	{96.750000, 96.750000},
	{99.250000, 158.750000},
	{136.250000, 0.000000},
	{146.250000, 72.000000},
	{191.250000, 50.000000},
}

AllGhostscript contains the text positions determined using ghostscript. This corresponds to the test cases in All.

View Source
var Paper = &pdf.Rectangle{
	LLx: -50,
	LLy: -50,
	URx: 450,
	URy: 450,
}

Functions

This section is empty.

Types

type Answer

type Answer struct {
	X, Y float64
}

type TestCase

type TestCase func(*document.Page) error

Jump to

Keyboard shortcuts

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