The Write.as desktop (GUI) app for macOS.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

40 lignes
981 B

  1. //
  2. // Created by Matt Baer on 7/29/17.
  3. // Copyright (c) 2017 A Bunch Tell. All rights reserved.
  4. //
  5. import Foundation
  6. class Preferences {
  7. enum PostFont: String {
  8. case serif = "norm"
  9. case sans = "sans"
  10. case mono = "wrap"
  11. var typeface: String {
  12. switch self {
  13. case .serif:
  14. return "Lora"
  15. case .sans:
  16. return "Open Sans"
  17. case .mono:
  18. return "Hack"
  19. }
  20. }
  21. }
  22. class func getFontSize() -> CGFloat {
  23. let size = Int(UserDefaults.standard.string(forKey: "editor_text_size") ?? "16") ?? 16
  24. return CGFloat(size)
  25. }
  26. class func getFont() -> PostFont {
  27. return PostFont(rawValue: UserDefaults.standard.string(forKey: "editor_font") ?? PostFont.serif.rawValue) ?? PostFont.serif
  28. }
  29. class func setFont(_ font: PostFont) {
  30. UserDefaults.standard.set(font.rawValue, forKey: "editor_font")
  31. }
  32. }