Convert WriteFreely quotes to Instagram / PixelFed posts.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.0 KiB

  1. /*
  2. * Copyright © 2021 A Bunch Tell LLC.
  3. *
  4. * This file is part of text-pic.
  5. *
  6. * text-pic is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License, included
  8. * in the LICENSE file in this source code package.
  9. */
  10. package textpic
  11. var fonts = map[string]string{
  12. "norm": "Lora",
  13. "serif": "Lora",
  14. "sans": "OpenSans",
  15. "mono": "Hack",
  16. "wrap": "Hack",
  17. }
  18. type ContentOptions struct {
  19. // Author information
  20. Instance string
  21. Username string
  22. // Write.as-only option
  23. IsSubdomain bool // UNIMPLEMENTED
  24. // Content
  25. UserFont string
  26. Content string
  27. }
  28. func NewContentOptions(instance, username string, isSubdomain bool, font, content string) *ContentOptions {
  29. opt := &ContentOptions{
  30. Instance: instance,
  31. Username: username,
  32. IsSubdomain: isSubdomain,
  33. UserFont: font,
  34. Content: content,
  35. }
  36. if opt.Content == "" {
  37. opt.Content = "Hello, world!"
  38. }
  39. return opt
  40. }
  41. func IsValidFont(f string) bool {
  42. _, valid := fonts[f]
  43. return valid
  44. }