src/Tools/jEdit/src/jedit_lib.scala
changeset 57849 6d8f97d555d8
parent 57612 990ffb84489b
child 59076 65babcd8b0e6
equal deleted inserted replaced
57848:f68cda7c85d4 57849:6d8f97d555d8
   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