Documentation
¶
Overview ¶
Package pdfexport owns the printable export pipeline: adapter registration, JSONL ingestion, payload building, ordering, and PDF rendering.
Index ¶
- Constants
- func CenteredOrigin(area Rect, cols, rows int, cellSize float64) (float64, float64)
- func ClampStandardCellFontSize(fontSize float64) float64
- func FitCompactCellSize(cols, rows int, area Rect) float64
- func FitHashiCellSize(cols, rows int, area Rect) float64
- func FitNonogramCellSize(cols, rows int, area Rect) float64
- func FitSudokuCellSize(cols, rows int, area Rect) float64
- func FitTableCellSize(cols, rows int, area Rect) float64
- func FitWordSearchCellSize(cols, rows int, area Rect) float64
- func HasPrintAdapter(gameType string) bool
- func InstructionLineCount(pdf *fpdf.Fpdf, width float64, rules []string) int
- func InstructionY(boardBottom, pageH float64, lineCount int) float64
- func IsNilPrintPayload(payload any) bool
- func RegisterPrintAdapter(adapter PrintAdapter)
- func RenderInstructions(pdf *fpdf.Fpdf, x, y, width float64, rules []string) int
- func SetInstructionStyle(pdf *fpdf.Fpdf)
- func StandardCellFontSize(cellSize, scale float64) float64
- func WritePDF(outputPath string, docs []PackDocument, puzzles []Puzzle, cfg RenderConfig) error
- type DifficultyConfidence
- type FillominoData
- type GridTable
- type HashiData
- type HashiIsland
- type HitoriData
- type JSONLPackMeta
- type JSONLPuzzle
- type JSONLRecord
- type NetwalkData
- type NonogramData
- type NurikabeData
- type PackDocument
- type PackMetadata
- type PrintAdapter
- type Puzzle
- type Rect
- type RenderConfig
- type RippleEffectCage
- type RippleEffectCell
- type RippleEffectData
- type SheetLayout
- type ShikakuData
- type SudokuData
- type TakuzuData
- type WordSearchData
Constants ¶
View Source
const ( SansFontFamily = sansFontFamily PDFFontSizeDelta = pdfFontSizeDelta PrimaryTextGray = primaryTextGray SecondaryTextGray = secondaryTextGray RuleTextGray = ruleTextGray DimTextGray = dimTextGray ThinGridLineMM = thinGridLineMM MajorGridLineMM = majorGridLineMM OuterBorderLineMM = outerBorderLineMM InstructionLineHMM = instructionLineHMM PuzzleBottomInsetMM = puzzleBottomInsetMM WordSearchGridGapMM = wordSearchGridListGap PuzzleWordBankFontSize = puzzleWordBankFontSize PuzzleWordBankHeadSize = puzzleWordBankHeadSize )
View Source
const ExportSchemaV1 = "puzzletea.export.v1"
Variables ¶
This section is empty.
Functions ¶
func CenteredOrigin ¶
func FitCompactCellSize ¶
func FitHashiCellSize ¶
func FitNonogramCellSize ¶
func FitSudokuCellSize ¶
func FitTableCellSize ¶
func FitWordSearchCellSize ¶
func HasPrintAdapter ¶ added in v1.8.0
func InstructionLineCount ¶ added in v1.9.0
func InstructionY ¶
func IsNilPrintPayload ¶ added in v1.8.0
func RegisterPrintAdapter ¶ added in v1.8.0
func RegisterPrintAdapter(adapter PrintAdapter)
func RenderInstructions ¶ added in v1.9.0
func SetInstructionStyle ¶
func StandardCellFontSize ¶
func WritePDF ¶
func WritePDF(outputPath string, docs []PackDocument, puzzles []Puzzle, cfg RenderConfig) error
Types ¶
type DifficultyConfidence ¶
type DifficultyConfidence string
const ( DifficultyConfidenceHigh DifficultyConfidence = "high" DifficultyConfidenceMedium DifficultyConfidence = "medium" )
type FillominoData ¶
func ParseFillominoPrintData ¶
func ParseFillominoPrintData(saveData []byte) (*FillominoData, error)
type HashiData ¶
type HashiData struct {
Width int
Height int
Islands []HashiIsland
}
func ParseHashiPrintData ¶
type HashiIsland ¶
type HitoriData ¶
func ParseHitoriPrintData ¶
func ParseHitoriPrintData(saveData []byte) (*HitoriData, error)
type JSONLPackMeta ¶
type JSONLPuzzle ¶
type JSONLRecord ¶
type JSONLRecord struct {
Schema string `json:"schema"`
Pack JSONLPackMeta `json:"pack"`
Puzzle JSONLPuzzle `json:"puzzle"`
}
type NetwalkData ¶ added in v1.9.0
func ParseNetwalkPrintData ¶ added in v1.9.0
func ParseNetwalkPrintData(saveData []byte) (*NetwalkData, error)
type NonogramData ¶
func ParseNonogramPrintData ¶
func ParseNonogramPrintData(saveData []byte) (*NonogramData, error)
type NurikabeData ¶
func ParseNurikabePrintData ¶
func ParseNurikabePrintData(saveData []byte) (*NurikabeData, error)
type PackDocument ¶
type PackDocument struct {
SourcePath string
Metadata PackMetadata
Puzzles []Puzzle
}
func ParseJSONLFile ¶
func ParseJSONLFile(path string) (PackDocument, error)
func ParseJSONLFiles ¶
func ParseJSONLFiles(paths []string) ([]PackDocument, error)
type PackMetadata ¶
type PrintAdapter ¶ added in v1.8.0
type PrintAdapter interface {
CanonicalGameType() string
Aliases() []string
BuildPDFPayload(save []byte) (any, error)
RenderPDFBody(pdf *fpdf.Fpdf, payload any) error
}
func LookupPrintAdapter ¶ added in v1.8.0
func LookupPrintAdapter(gameType string) (PrintAdapter, bool)
type Puzzle ¶
type Puzzle struct {
SourcePath string
SourceFileName string
Category string
ModeSelection string
Name string
Index int
Body string
SaveData []byte
PrintPayload any
DifficultyScore float64
DifficultyConfidence DifficultyConfidence
DifficultySource string
}
func OrderPuzzlesForPrint ¶
type RenderConfig ¶
type RippleEffectCage ¶
type RippleEffectCage struct {
Size int `json:"size"`
Cells []RippleEffectCell `json:"cells"`
}
type RippleEffectCell ¶
type RippleEffectData ¶
type RippleEffectData struct {
Width int
Height int
Givens [][]int
Cages []RippleEffectCage
}
func ParseRippleEffectPrintData ¶
func ParseRippleEffectPrintData(saveData []byte) (*RippleEffectData, error)
type SheetLayout ¶ added in v1.9.0
type SheetLayout int
const ( SheetLayoutHalfLetter SheetLayout = iota SheetLayoutDuplexBooklet )
type ShikakuData ¶
func ParseShikakuPrintData ¶
func ParseShikakuPrintData(saveData []byte) (*ShikakuData, error)
type SudokuData ¶
type SudokuData struct {
Givens [9][9]int `json:"givens"`
}
func ParseSudokuPrintData ¶
func ParseSudokuPrintData(saveData []byte) (*SudokuData, error)
func ParseSudokuRGBPrintData ¶ added in v1.8.0
func ParseSudokuRGBPrintData(saveData []byte) (*SudokuData, error)
type TakuzuData ¶
type TakuzuData struct {
Size int
Givens [][]string
HorizontalRelations [][]string
VerticalRelations [][]string
GroupEveryTwo bool
}
func ParseTakuzuPlusPrintData ¶ added in v1.8.0
func ParseTakuzuPlusPrintData(saveData []byte) (*TakuzuData, error)
func ParseTakuzuPrintData ¶
func ParseTakuzuPrintData(saveData []byte) (*TakuzuData, error)
type WordSearchData ¶
type WordSearchData struct {
Width int `json:"width"`
Height int `json:"height"`
Grid [][]string `json:"grid"`
Words []string `json:"words"`
}
func ParseWordSearchPrintData ¶
func ParseWordSearchPrintData(saveData []byte) (*WordSearchData, error)
Source Files
¶
- font.go
- fonts.go
- jsonl.go
- normalize.go
- order.go
- parse_fillomino.go
- parse_hashi.go
- parse_helpers.go
- parse_hitori.go
- parse_netwalk.go
- parse_nonogram.go
- parse_nurikabe.go
- parse_rippleeffect.go
- parse_shikaku.go
- parse_sudoku.go
- parse_takuzu.go
- parse_takuzuplus.go
- parse_wordsearch.go
- print_adapter.go
- render.go
- render_cover.go
- render_difficulty.go
- render_instructions.go
- render_kit.go
- render_metadata.go
- render_plan.go
- render_title.go
- render_tokens.go
- types.go
Click to show internal directories.
Click to hide internal directories.