feat(fonts): add font endpoints
All checks were successful
build / Go-Build (push) Successful in 27s

This commit is contained in:
2026-02-12 15:41:23 +01:00
parent 35e873397d
commit 6b61fe1e54
3 changed files with 50 additions and 8 deletions

View File

@@ -63,10 +63,6 @@ func (f FileSvgStorage) Get(id string) (io.Reader, error) {
}
func (f FileSvgStorage) AddFont(fontreader io.Reader, format string) error {
fontblob, err := io.ReadAll(fontreader)
if err != nil {
return err
}
if format != "ttf" && format != "otf" {
return errors.New("Format not supported")
}
@@ -75,7 +71,11 @@ func (f FileSvgStorage) AddFont(fontreader io.Reader, format string) error {
return err
}
defer file.Close()
file.Write(fontblob)
log.Printf("Writing %s font to %s\n", format, file.Name())
_, err = io.Copy(file, fontreader)
if err != nil {
return err
}
return nil
}
@@ -102,6 +102,7 @@ func (f FileSvgStorage) GetFonts() ([]string, error) {
fonts[i] = fontname
}
}
log.Printf("Got fonts \n%s\n", strings.Join(fonts, "\n"))
return fonts, nil
}