Documentation
¶
Index ¶
- Constants
- func AddChromeSearchRoots(roots ...string)
- func BuildSnapshotHTML(in PageInput) string
- func BundledChromeInDir(dir string) string
- func CloseBrowser()
- func CloseDefault()
- func DefaultFontBytes() []byte
- func ResolveChromeExec() string
- type BlockInput
- type BlockStyle
- type FontBytes
- type OutlinedBlock
- type OutlinedPath
- type Outliner
- type PageInput
- type Result
Constants ¶
const DefaultFontFamily = "PSRTDefault"
const GoTextFallbackNotice = "Compilação SVG com motor go-text (Chromium não encontrado). Pode haver pequenas diferenças em relação ao preview."
GoTextFallbackNotice is shown in the GUI when the go-text fallback is used.
Variables ¶
This section is empty.
Functions ¶
func AddChromeSearchRoots ¶
func AddChromeSearchRoots(roots ...string)
AddChromeSearchRoots registers extra directories checked for bundled Chrome.
func BuildSnapshotHTML ¶
BuildSnapshotHTML returns a self-contained HTML document for headless layout.
func BundledChromeInDir ¶
BundledChromeInDir returns a Chrome/Chromium executable next to dir, if any.
func DefaultFontBytes ¶
func DefaultFontBytes() []byte
DefaultFontBytes returns the embedded fallback font for outlining.
func ResolveChromeExec ¶
func ResolveChromeExec() string
ResolveChromeExec returns a Chromium/Edge executable path, or "" if none found.
Types ¶
type BlockInput ¶
type BlockInput struct {
Index int
X, Y int
Width int
Height int
ClassAttr string
InnerClass string
TextHTML string
PlainText string
FilterID string
Transform string
Style BlockStyle
}
BlockInput describes one text block in the layout snapshot.
type BlockStyle ¶
type BlockStyle struct {
FontSizePx float64
LineHeight float64
Color string
Stroke string
StrokeWidth string
TextAlign string
PadTop int
PadLeft int
ContentW int
FontFamily string
Bold bool
}
BlockStyle carries layout hints for the go-text fallback.
type OutlinedBlock ¶
type OutlinedBlock struct {
Index int `json:"index"`
Paths []OutlinedPath `json:"paths"`
PlainText string `json:"plainText"`
FilterID string `json:"filterId,omitempty"`
Transform string `json:"transform,omitempty"`
}
OutlinedBlock holds vector paths and metadata for one PSRT text block.
type OutlinedPath ¶
type OutlinedPath struct {
D string `json:"d"`
Fill string `json:"fill,omitempty"`
Stroke string `json:"stroke,omitempty"`
StrokeWidth string `json:"strokeWidth,omitempty"`
Opacity string `json:"opacity,omitempty"`
PaintOrder string `json:"paintOrder,omitempty"`
}
OutlinedPath is one SVG path for a text run.
type Outliner ¶
type Outliner struct {
// contains filtered or unexported fields
}
Outliner runs headless Chromium to convert laid-out text to SVG paths.
func NewOutliner ¶
NewOutliner starts a headless browser using the given Chromium executable.
func (*Outliner) OutlinePage ¶
OutlinePage layouts texts in Chromium and returns vector paths per block.