percent

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyPercentHandlers

func ApplyPercentHandlers(style map[string]json.RawMessage, dims ImageDims) map[string]json.RawMessage

ApplyPercentHandlers converts % to px for registered keys (render-time only).

func RegisterPercentHandler

func RegisterPercentHandler(h PercentHandler)

RegisterPercentHandler adds a handler to the registry.

Types

type ImageDims

type ImageDims struct {
	W, H       int
	FontSizePx float64
	Zoom       float64
	// PreservePercent keeps % values for HTML compile so padding scales with the slide overlay.
	PreservePercent bool
}

ImageDims holds canvas/image dimensions for percent resolution at render time.

type PercentHandler

type PercentHandler interface {
	Keys() []string
	Resolve(key string, value string, dims ImageDims) (resolved string, ok bool)
}

PercentHandler resolves % values to px for specific properties.

Jump to

Keyboard shortcuts

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