equal
deleted
inserted
replaced
30 override def toString: String = font.toString |
30 override def toString: String = font.toString |
31 |
31 |
32 def string_bounds(str: String): Rectangle2D = font.getStringBounds(str, context) |
32 def string_bounds(str: String): Rectangle2D = font.getStringBounds(str, context) |
33 def string_width(str: String): Double = string_bounds(str).getWidth |
33 def string_width(str: String): Double = string_bounds(str).getWidth |
34 |
34 |
|
35 protected def sample: String = "mix" |
|
36 val height: Double = string_bounds(sample).getHeight |
|
37 val average_width: Double = string_width(sample) / sample.length |
|
38 |
35 val space_width: Double = string_width(Symbol.space) |
39 val space_width: Double = string_width(Symbol.space) |
36 override def unit: Double = space_width max 1.0 |
40 override def unit: Double = space_width max 1.0 |
37 override def apply(s: String): Double = if (s == "\n") 1.0 else string_width(s) / unit |
41 override def apply(s: String): Double = if (s == "\n") 1.0 else string_width(s) / unit |
38 |
|
39 protected def sample: String = "mix" |
|
40 val height: Double = string_bounds(sample).getHeight |
|
41 val average_width: Double = string_bounds(sample).getWidth / sample.length |
|
42 def average: Double = average_width / unit |
42 def average: Double = average_width / unit |
43 } |
43 } |