text

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

package text provides a common interface for different mechanisms to derive texts for images.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AvailableTexts

func AvailableTexts() []string

AvailableText returns the list of schemes that have been registered with `TextInitializeFunc` functions.

func PrepareText

func PrepareText(pdf *fpdf.Fpdf, dpi float64, max_w float64, txt string) []string

func RegisterText

func RegisterText(ctx context.Context, name string, fn TextInitializeFunc) error

RegisterText associates a URI scheme with a `TextInitializeFunc` initialization function.

Types

type JsonText

type JsonText struct {
	Text
	// contains filtered or unexported fields
}

type JsonText implements the `Text` interface and returns empty text strings.

func (*JsonText) Body

func (c *JsonText) Body(ctx context.Context, bucket *blob.Bucket, path string) (string, error)

Body returns ...

type Text

type Text interface {
	// Text produces a text derived from a file contained in a gocloud.dev/blob Bucket instance.
	Body(context.Context, *blob.Bucket, string) (string, error)
}

type Text provides a common interface for different mechanisms to derive texts for images.

func NewJsonText

func NewJsonText(ctx context.Context, uri string) (Text, error)

NewJsonText return a new instance of `JsonText` for 'url'

func NewText

func NewText(ctx context.Context, uri string) (Text, error)

NewText returns a new `Text` instance for 'uri' whose scheme is expected to have been associated with an `TextInitializeFunc` (by the `RegisterText` method.

type TextInitializeFunc

type TextInitializeFunc func(context.Context, string) (Text, error)

type TextInitializeFunc defined a common initialization function for instances implementing the Text interface. This is specified when the packages definining those instances call `RegisterText` and invoked with the `NewText` method is called.

Jump to

Keyboard shortcuts

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