Debian Codegraph @

src/com/github/weisj/jsvg/attributes/font/FontSpec.java

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
•1 /*
2 * MIT License
3 *
4 * Copyright (c) 2021-2024 Jannis Weis
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
7 * associated documentation files (the "Software"), to deal in the Software without restriction,
8 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
9 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in all copies or
13 * substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
16 * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 *
21 */
22 package com.github.weisj.jsvg.attributes.font;
23
24 import java.util.Arrays;
25 import java.util.Objects;
26
27 import org.jetbrains.annotations.NotNull;
28 import org.jetbrains.annotations.Nullable;
29
30 import com.github.weisj.jsvg.geometry.size.Length;
31 import com.github.weisj.jsvg.geometry.size.Percentage;
32
33 public class FontSpec {
34 protected final @NotNull String[] families;
35 protected final @Nullable FontStyle style;
36 protected final @Nullable Length sizeAdjust;
37 protected final @NotNull Percentage stretch;
38
39 FontSpec(@NotNull String[] families, @Nullable FontStyle style, @Nullable Length sizeAdjust,
40 @NotNull Percentage stretch) {
41 this.families = families;
42 this.style = style;
43 this.sizeAdjust = sizeAdjust;
44 this.stretch = stretch;
45 }
46
47 @Override
48 public String toString() {
49 return "FontSpec{" +
50 "families=" + Arrays.toString(families) +
51 ", style=" + style +
52 ", sizeAdjust=" + sizeAdjust +
53 ", stretch=" + stretch +
54 '}';
55 }
56
57 @Override
58 public boolean equals(Object o) {
59 if (this == o) return true;
60 if (!(o instanceof FontSpec)) return false;
61 FontSpec fontSpec = (FontSpec) o;
62 return Objects.equals(stretch, fontSpec.stretch)
63 && Arrays.equals(families, fontSpec.families)
64 && Objects.equals(style, fontSpec.style)
65 && Objects.equals(sizeAdjust, fontSpec.sizeAdjust);
66 }
67
68 @Override
69 public int hashCode() {
70 int result = Objects.hash(style, sizeAdjust, stretch);
71 result = 31 * result + Arrays.hashCode(families);
72 return result;
73 }
74 }