equal
deleted
inserted
replaced
293 def pretty_metric(painter: TextAreaPainter): Pretty_Metric = |
293 def pretty_metric(painter: TextAreaPainter): Pretty_Metric = |
294 new Pretty_Metric { |
294 new Pretty_Metric { |
295 def string_width(s: String): Double = |
295 def string_width(s: String): Double = |
296 painter.getFont.getStringBounds(s, painter.getFontRenderContext).getWidth |
296 painter.getFont.getStringBounds(s, painter.getFontRenderContext).getWidth |
297 |
297 |
298 val unit = string_width(Pretty.space) |
298 val unit = string_width(Pretty.space) max 1.0 |
299 val average = string_width("mix") / (3 * unit) |
299 val average = string_width("mix") / (3 * unit) |
300 def apply(s: String): Double = if (s == "\n") 1.0 else string_width(s) / unit |
300 def apply(s: String): Double = if (s == "\n") 1.0 else string_width(s) / unit |
301 } |
301 } |
302 |
302 |
303 |
303 |