TextView.st
branchjv
changeset 5444 cd4f2b359bfe
parent 5417 213089a29fb8
parent 5443 61ebc1660709
child 5470 00d06a29e01c
--- a/TextView.st	Thu Oct 01 06:52:46 2015 +0200
+++ b/TextView.st	Fri Oct 02 06:33:28 2015 +0100
@@ -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 currentDeviceFont|
+    |italicFont boldFont currentDeviceFont |
 
     currentDeviceFont := gc createFontOnDevice.
-    italicFont := currentDeviceFont asItalic onDevice:gc device.
-    boldFont := currentDeviceFont asBold onDevice:gc device.
-
-    fontHeight := currentDeviceFont height max:(italicFont height max:(boldFont height)).
+    "/ 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 := currentDeviceFont asItalic onDevice:self device.
+    boldFont := currentDeviceFont asBold onDevice:self device.
+
+    fontHeight := currentDeviceFont height.
+    fontAscent := currentDeviceFont ascent. 
+    fontWidth := currentDeviceFont width.
+    fontIsFixedWidth := currentDeviceFont 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 := currentDeviceFont ascent.
-    "/ fA := font maxAscent.
-    iA := italicFont ascent.
-    "/ iA := italicFont maxAscent.
-    bA := boldFont ascent.
-    "/ bA := boldFont maxAscent.
-    fontAscent := fA max:(iA max:bA).
-    fontWidth := currentDeviceFont width.
-    fontIsFixedWidth := currentDeviceFont isFixedWidth and:[ italicFont isFixedWidth and:[ boldFont isFixedWidth ]].
 
     "Modified: 22.5.1996 / 12:02:47 / cg"
     "Created: 22.5.1996 / 12:18:34 / cg"