TextView.st
changeset 5443 61ebc1660709
parent 5412 d248d42bac05
child 5444 cd4f2b359bfe
child 5460 c353fd71390d
--- a/TextView.st	Thu Oct 01 08:57:11 2015 +0200
+++ b/TextView.st	Thu Oct 01 11:08:34 2015 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -2657,27 +2659,37 @@
      line separation. This is required, to allow for proper handling of
      national characters, such as A-diaresis ..."
 
-    |italicFont boldFont fA iA bA|
+    |italicFont boldFont|
 
     font := font onDevice:device.
+    "/ do we really need this info now?
+    "/ on unix, it seems to work with the next two lines commented;
+    "/ should probably check on windows too
     italicFont := font asItalic onDevice:device.
     boldFont := font asBold onDevice:device.
 
-    fontHeight := font height max:(italicFont height max:(boldFont height)).
+    fontHeight := font height.
+    fontAscent := font ascent. 
+    fontWidth := font width.
+    fontIsFixedWidth := font isFixedWidth.
+
+    "/ fA := font maxAscent. 
+    italicFont notNil ifTrue:[ 
+        fontHeight := fontHeight max:(italicFont height).
+        fontAscent := fontAscent max:(italicFont ascent).
+        fontIsFixedWidth := fontIsFixedWidth and:[ italicFont isFixedWidth ]
+    ]. 
+    boldFont notNil ifTrue:[ 
+        fontHeight := fontHeight max:(boldFont height).
+        fontAscent := fontAscent max:(boldFont ascent).
+        fontIsFixedWidth := fontIsFixedWidth and:[ boldFont isFixedWidth ]
+    ]. 
+
     includesNonStrings == true ifTrue:[
         "/ for now, we do not support variable height entries ...
         fontHeight := fontHeight max:(list first heightOn:self).
     ].
     fontHeight := fontHeight + lineSpacing.
-    fA := font ascent. 
-    "/ fA := font maxAscent. 
-    iA := italicFont ascent. 
-    "/ iA := italicFont maxAscent. 
-    bA := boldFont ascent. 
-    "/ bA := boldFont maxAscent. 
-    fontAscent := fA max:(iA max:bA).
-    fontWidth := font width.
-    fontIsFixedWidth := font isFixedWidth and:[ italicFont isFixedWidth and:[ boldFont isFixedWidth ]].
 
     "Modified: 22.5.1996 / 12:02:47 / cg"
     "Created: 22.5.1996 / 12:18:34 / cg"