fontspec.c 978 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Implementation of FontSpec for Windows.
  3. */
  4. #include "putty.h"
  5. FontSpec *fontspec_new(const char *name, bool bold, int height, int charset)
  6. {
  7. FontSpec *f = snew(FontSpec);
  8. f->name = dupstr(name);
  9. f->isbold = bold;
  10. f->height = height;
  11. f->charset = charset;
  12. return f;
  13. }
  14. FontSpec *fontspec_copy(const FontSpec *f)
  15. {
  16. return fontspec_new(f->name, f->isbold, f->height, f->charset);
  17. }
  18. void fontspec_free(FontSpec *f)
  19. {
  20. sfree(f->name);
  21. sfree(f);
  22. }
  23. void fontspec_serialise(BinarySink *bs, FontSpec *f)
  24. {
  25. put_asciz(bs, f->name);
  26. put_uint32(bs, f->isbold);
  27. put_uint32(bs, f->height);
  28. put_uint32(bs, f->charset);
  29. }
  30. FontSpec *fontspec_deserialise(BinarySource *src)
  31. {
  32. const char *name = get_asciz(src);
  33. unsigned isbold = get_uint32(src);
  34. unsigned height = get_uint32(src);
  35. unsigned charset = get_uint32(src);
  36. return fontspec_new(name, isbold, height, charset);
  37. }