1 7 8 21 22 package java.awt.font; 23 24 58 59 public final class GlyphJustificationInfo { 60 61 84 public GlyphJustificationInfo(float weight, 85 boolean growAbsorb, 86 int growPriority, 87 float growLeftLimit, 88 float growRightLimit, 89 boolean shrinkAbsorb, 90 int shrinkPriority, 91 float shrinkLeftLimit, 92 float shrinkRightLimit) 93 { 94 if (weight < 0) { 95 throw new IllegalArgumentException ("weight is negative"); 96 } 97 98 if (!priorityIsValid(growPriority)) { 99 throw new IllegalArgumentException ("Invalid grow priority"); 100 } 101 if (growLeftLimit < 0) { 102 throw new IllegalArgumentException ("growLeftLimit is negative"); 103 } 104 if (growRightLimit < 0) { 105 throw new IllegalArgumentException ("growRightLimit is negative"); 106 } 107 108 if (!priorityIsValid(shrinkPriority)) { 109 throw new IllegalArgumentException ("Invalid shrink priority"); 110 } 111 if (shrinkLeftLimit < 0) { 112 throw new IllegalArgumentException ("shrinkLeftLimit is negative"); 113 } 114 if (shrinkRightLimit < 0) { 115 throw new IllegalArgumentException ("shrinkRightLimit is negative"); 116 } 117 118 this.weight = weight; 119 this.growAbsorb = growAbsorb; 120 this.growPriority = growPriority; 121 this.growLeftLimit = growLeftLimit; 122 this.growRightLimit = growRightLimit; 123 this.shrinkAbsorb = shrinkAbsorb; 124 this.shrinkPriority = shrinkPriority; 125 this.shrinkLeftLimit = shrinkLeftLimit; 126 this.shrinkRightLimit = shrinkRightLimit; 127 } 128 129 private static boolean priorityIsValid(int priority) { 130 131 return priority >= PRIORITY_KASHIDA && priority <= PRIORITY_NONE; 132 } 133 134 135 public static final int PRIORITY_KASHIDA = 0; 136 137 138 public static final int PRIORITY_WHITESPACE = 1; 139 140 141 public static final int PRIORITY_INTERCHAR = 2; 142 143 144 public static final int PRIORITY_NONE = 3; 145 146 149 public final float weight; 150 151 154 public final int growPriority; 155 156 160 public final boolean growAbsorb; 161 162 165 public final float growLeftLimit; 166 167 170 public final float growRightLimit; 171 172 175 public final int shrinkPriority; 176 177 181 public final boolean shrinkAbsorb; 182 183 187 public final float shrinkLeftLimit; 188 189 193 public final float shrinkRightLimit; 194 } 195 | Popular Tags |