unicodepolicy

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPDFFormat

func IsPDFFormat(format string) bool

IsPDFFormat reports whether format names a PDF output.

func IsRasterFormat

func IsRasterFormat(format string) bool

IsRasterFormat reports whether format names a raster/image-like output.

func IsTextBearingFormat

func IsTextBearingFormat(format string) bool

IsTextBearingFormat reports whether an output can carry searchable text.

Types

type ContentProfile

type ContentProfile struct {
	Known       bool
	HasText     bool
	HasNonASCII bool
	HasCyrillic bool
}

ContentProfile is a small adapter-friendly summary of input text content. The zero value is an unknown safe profile: Decide never fails on unknown data.

type Decision

type Decision struct {
	Level                   SafetyLevel
	RequireUnicodePDFEngine bool
	RequireTextValidation   bool
	Warnings                []string
}

Decision describes the safety requirements selected for a conversion.

func Decide

func Decide(request Request) (Decision, error)

Decide deterministically selects Unicode safety requirements for a conversion.

type Mode

type Mode string

Mode controls Unicode safety decisions.

const (
	ModeAuto   Mode = "auto"
	ModeOff    Mode = "off"
	ModeStrict Mode = "strict"
)

func ParseMode

func ParseMode(value string) (Mode, error)

ParseMode validates a user-facing mode string.

func (Mode) Valid

func (m Mode) Valid() bool

Valid reports whether mode is one of the exposed values.

type Request

type Request struct {
	Mode         Mode
	OutputFormat string
	Profile      ContentProfile
}

Request contains the stable inputs for a safety decision.

type SafetyLevel

type SafetyLevel string

SafetyLevel describes the amount of Unicode safety required for a conversion.

const (
	SafetyDefault         SafetyLevel = "default"
	SafetyUnicodeAware    SafetyLevel = "unicode-aware"
	SafetyStrictTextLayer SafetyLevel = "strict-text-layer"
)

Jump to

Keyboard shortcuts

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