ZenScript main repository
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.

DFont.java 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package org.openzen.drawablegui;
  7. import java.util.Objects;
  8. /**
  9. *
  10. * @author Hoofdgebruiker
  11. */
  12. public class DFont {
  13. public final DFontFamily family;
  14. public final boolean bold;
  15. public final boolean italic;
  16. public final boolean underline;
  17. public final int size;
  18. public Object cached;
  19. public DFont(DFontFamily family, boolean bold, boolean italic, boolean underline, int size) {
  20. this.family = family;
  21. this.bold = bold;
  22. this.italic = italic;
  23. this.underline = underline;
  24. this.size = size;
  25. }
  26. @Override
  27. public int hashCode() {
  28. int hash = 3;
  29. hash = 29 * hash + Objects.hashCode(this.family);
  30. hash = 29 * hash + (this.bold ? 1 : 0);
  31. hash = 29 * hash + (this.italic ? 1 : 0);
  32. hash = 29 * hash + (this.underline ? 1 : 0);
  33. hash = 29 * hash + Float.floatToIntBits(this.size);
  34. return hash;
  35. }
  36. @Override
  37. public boolean equals(Object obj) {
  38. if (this == obj) {
  39. return true;
  40. }
  41. if (obj == null) {
  42. return false;
  43. }
  44. if (getClass() != obj.getClass()) {
  45. return false;
  46. }
  47. final DFont other = (DFont) obj;
  48. if (this.bold != other.bold) {
  49. return false;
  50. }
  51. if (this.italic != other.italic) {
  52. return false;
  53. }
  54. if (this.underline != other.underline) {
  55. return false;
  56. }
  57. if (this.size != other.size)
  58. return false;
  59. if (this.family != other.family) {
  60. return false;
  61. }
  62. return true;
  63. }
  64. }