Merge jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Fri, 02 Oct 2015 06:23:10 +0100
branchjv
changeset 3506 3f2128d78441
parent 3505 af4fb19df063 (current diff)
parent 3504 3bc5a83d71ff (diff)
child 3509 5695dc1969e8
Merge
--- a/.hgtags	Tue Sep 01 17:49:42 2015 +0100
+++ b/.hgtags	Fri Oct 02 06:23:10 2015 +0100
@@ -2,45 +2,47 @@
 053d437c248a6e2a158ee441898eea967bc2b9f9 expecco_2_2_5
 0570acbd78e3bc004055ef97ea3030553379c1f6 rel4_1_3_1
 0581d9906df0d81447cbb2f8b87544b2f5a84170 rel5_2_8
-08dc80825e691a8c1fb0a340ff07d9ee19c0ca85 expecco_2_7_0
-08dc80825e691a8c1fb0a340ff07d9ee19c0ca85 expecco_2_7_0_49
 136dd7e8228a6b331b5ed87970023db7b2643ff5 stable_expecco_sel
-196ff4d5d5ada3abb4d367959bcf532360d9919a expecco_2_6_1
-196ff4d5d5ada3abb4d367959bcf532360d9919a expecco_2_6_2
+181d9724446349d9cd3c5e9e811de12af1ea1543 expecco_ALM_1_9_5
+1e1ffdd308980263a8cc89ea3391685087458cf4 expecco_2_7_5
+1e1ffdd308980263a8cc89ea3391685087458cf4 expecco_2_7_5a
 283d815128505de76a039620ea84c8432aead0fa expecco_1_3_4
 2a795646e9851e575a4398f60892cc49f76d2009 rel3-1-2
-358f5696bc0d23f1ada9ca1f8f1c60a59a6a060d expecco_2_6_0rc1
 4055b361abe946d17108814719830915bb6c434e rel4_1_7
 4055b361abe946d17108814719830915bb6c434e release
 41a53daee5cb657aec16301d239f30ebc18b630f rel3_6_4
-437b1425507e31b1fb4cde2224504c28cdecb9a6 expecco_2_5_1
+4938f4baa0ef9ffeb1d73a8eca72d3891f48ce37 expeccoALM_1_9_0_1
 494a30fd40cf20c1f2c808409ffc47f946aea421 rel5_1_4
-4befd1e4e8d01a326e4c1062cad9cbcf2b44b197 expecco_2_5_0
 4cdef981fdb34c7ef0e35d7e5c79efe608d51307 expecco_1_7_2rc1
 5d6a438f84d0c25b1df226fd84a46204be274c32 rel3_4_3_1
+5dd413dddd1c68ca345c5667cf2c491b948b5b8d stable
 5fdc86bfcf2ce772c810d2af90d49eb64b2ffaf0 expeccoNET_1_4_0rc1
 5fdc86bfcf2ce772c810d2af90d49eb64b2ffaf0 expecco_1_7_0rc1
 5fdc86bfcf2ce772c810d2af90d49eb64b2ffaf0 expecco_1_7_0rc3
 63c153f0ce9094d293bc1e72972a0b93c41d9644 expecco_1_7_0rc5
 63c153f0ce9094d293bc1e72972a0b93c41d9644 expecco_1_7_0rc8
 682dcd575c9a22861ad6a2df0e0ae95911a8933a rel2_10_8_6_last2
+6edd75bca9659e03106e8824b81b655d69b3d2c0 expecco_2_6_0
+6edd75bca9659e03106e8824b81b655d69b3d2c0 expecco_2_6_0_45_windows_final
+6edd75bca9659e03106e8824b81b655d69b3d2c0 expecco_2_6_0_49_windows_final
+715f5527f5ef8ccfc517035b567348afb35177e5 expecco_2_5_1
 733df1ff38b5107e28571f82593c4bf28e8a4c35 expecco_1_7_0b1
 733df1ff38b5107e28571f82593c4bf28e8a4c35 expecco_1_7_0b2
-74842f3b79eb9f5c209ffff51f4e76be7a7a896d expecco_2_6_0
-74842f3b79eb9f5c209ffff51f4e76be7a7a896d expecco_2_6_0_45_windows_final
-74842f3b79eb9f5c209ffff51f4e76be7a7a896d expecco_2_6_0_49_windows_final
 779ae6adb925de0c53632a9e3db6db8ad4034bdc rel2_10_8_5
 7efb31ff6de5cfa31733483d1681961bb14f1f1b expecco_1_5_0
 815ac59338e130b7115dd603eafa3d85c7a3e7b4 rel5_2_2
 86ef45ddef74178dccb9e1a6e946e681cc442751 expecco_2_4_0
 86ef45ddef74178dccb9e1a6e946e681cc442751 expecco_2_4_1
 87adcdcddc17df1c92ad684e8d80a8c595f40a9f expecco_1_6_0rc5
+8c2680e496c97104e8591029ed6d1e07069928bf expecco_2_6_0rc1
 a0bd24f746c0087b6a7259de7183782e00c9d64b expecco_1_9_1_iX
 a78a9e0380b18979ad83be903213d4ef338f35ae expecco_1_6_0
 ac1655bd31bb0ca9ee4994b9260b6b02e8d21967 rel3_4_1_1
 ac1655bd31bb0ca9ee4994b9260b6b02e8d21967 rel3_4_1_2
 af9c31ac2fc17558cb46373c4628d208f893224a stx_6_2_2
 b42670756688f64ba6cc6a3c5d6024d89256bc24 expecco_1_7_0b3
+b4e4fadd90dac00b10fe69ba6cb1998dd9c3e7a5 expecco_2_6_1
+b4e4fadd90dac00b10fe69ba6cb1998dd9c3e7a5 expecco_2_6_2
 b745ee0a04ac9ba8b0f15070aae589f4e22b3e9e expeccoNET_1_5_0rc1
 b745ee0a04ac9ba8b0f15070aae589f4e22b3e9e expecco_1_8_2rc1
 b748f03cb6cf1f987944c1dbb85f35869a266a95 expeccoNET_1_8_0_0
@@ -50,21 +52,20 @@
 c2ab6ead91c843ab99b8131a15fe2d0a35137705 rel3_6_1
 c47f1fd6cf5b81cb02d3769335f1e0c1e7cc1c76 rel2_10_8_6_last_before_vmData_change
 c50ab5fa6cf0aea6be5d5f20582ada1fb21b6b38 expecco_2_1_0
-d167d433053c208b3cbdedccf2acfbe33f629c37 stable
 d2055a8b10557feb7affed2e49151e47cede0c08 expecco_1_9_1_1
 d5171b9245e689eddb4fa4624aae4b3861aa275f expeccoNET_1_6_0_0
 dc8cd7d0f0fdb71fb88c0c2fa4abe0742076a4d5 rel5_4_6
+ddb23aad351e5e4c6fe84e59a0a27e9025092df9 expecco_2_5_0
 e23fc319064dcf2ef636e31dc71840a2f44aa7f5 expecco_1_8_0rc1
+e707e6cb12ed34919e26b313db15bb0e471b954f expecco_2_7_0
+e707e6cb12ed34919e26b313db15bb0e471b954f expecco_2_7_0_49
 e9df4227a57dd36d43cc1fb2eb64fdb10900a0cd expeccoNET_1_5_1rc1
 ea33c918e116d00933bca7f7f0f45d6a3af00730 expeccoNET_1_7_0_0
 ebf1067a3289e238cdd38bfa97f0e4d23b77d5f9 expecco_1_7_1rc1
 ebf1067a3289e238cdd38bfa97f0e4d23b77d5f9 expecco_1_7_1rc2
 ebf1067a3289e238cdd38bfa97f0e4d23b77d5f9 expecco_1_7_1rc3
 ebf1067a3289e238cdd38bfa97f0e4d23b77d5f9 expecco_1_7_1rc4
-ed161dbbaedf9003fe0099e9b4d217b6750a0e76 expecco_2_7_5
-ed161dbbaedf9003fe0099e9b4d217b6750a0e76 expecco_2_7_5a
 ef7d38d397bc2733ce8646c436ceb48e3191e32f expecco_2_0_0
 ef7d38d397bc2733ce8646c436ceb48e3191e32f expecco_2_0_0_0
-f97405cc78a3e83738f7e39927e344fd8df5ff16 expeccoALM_1_9_0_1
 fb54a0eabe13bf49bb363bbcf7a87bfd30a233b2 rel5_1_3
 fb54a0eabe13bf49bb363bbcf7a87bfd30a233b2 stx_513
--- a/ActiveHelpView.st	Tue Sep 01 17:49:42 2015 +0100
+++ b/ActiveHelpView.st	Fri Oct 02 06:23:10 2015 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1995 by Claus Gittinger
               All Rights Reserved
@@ -11,6 +13,8 @@
 "
 "{ Package: 'stx:libview2' }"
 
+"{ NameSpace: Smalltalk }"
+
 View subclass:#ActiveHelpView
 	instanceVariableNames:'myView shapeStyle controllingHelpListener'
 	classVariableNames:''
@@ -216,6 +220,7 @@
 
     <resource: #style (#'activeHelp.backgroundColor'
                        #'activeHelp.borderWidth'
+                       #'activeHelp.borderColor'
                        #'activeHelp.font'
                        #'activeHelp.style')>
 
@@ -409,10 +414,10 @@
 !ActiveHelpView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/ActiveHelpView.st,v 1.49 2014-11-20 19:31:34 cg Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview2/ActiveHelpView.st,v 1.49 2014-11-20 19:31:34 cg Exp $'
+    ^ '$Header$'
 ! !
 
--- a/HersheyFont.st	Tue Sep 01 17:49:42 2015 +0100
+++ b/HersheyFont.st	Fri Oct 02 06:23:10 2015 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
               All Rights Reserved
@@ -23,9 +25,9 @@
  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  SUCH DAMAGE.
 "
-
+"{ Package: 'stx:libview2' }"
 
-"{ Package: 'stx:libview2' }"
+"{ NameSpace: Smalltalk }"
 
 Font subclass:#HersheyFont
 	instanceVariableNames:'glyphs scale'
@@ -128,13 +130,46 @@
 documentation
 "
     HersheyFont provides (limited) support to draw characters
-    from the hershey font data file 'hersh.oc'
-    (which is available via ftp and must be aquired from elsewhere).
-        
+    from the hershey font set.
+
     This is a demo class - not maintained or meant for productive use.
     Notice: this is a very old demo - it should be rewritten to honor
     the FontDescription protocol (see BitmapFont as a better example).
 
+    Caveat: not completely correct; the ascent and descent data is wrong, which
+    gives textView a little trouble when selecting. (see examples)
+    We leave it as an exercise to the interested user to fix those.
+
+    You need the data file 'hersh.oc' and the glyph data files
+        astrol.hmp              astrology
+        scripts.hmp             cursive
+        cyrilc.hmp              cyrillic
+        romans.hmp              futura.l
+        romand.hmp              futura.m
+        gotheng.hmp             gothic.eng
+        gothger.hmp             gothic.ger
+        gothita.hmp             gothic.ita
+        greeks.hmp              greek
+        marker.hmp              markers
+        lowmat.hmp              math.low
+        uppmat.hmp              math.upp
+        meteo.hmp               meteorology
+        music.hmp               music
+        scriptc.hmp             script
+        symbol.hmp              symbolic
+        greekc.hmp              times.g
+        italicc.hmp             times.i
+        italict.hmp             times.ib
+        romanc.hmp              times.r
+        romant.hmp              times.rb
+        japan.hmp               japanese
+
+    (these are available via http/ftp and must be aquired from elsewhere due to
+     copyright restrictions - google for 'hersh.oc' or search for hershey in github).
+        
+    You should install those files in some font folder 
+    (see hersheyFontPath for a list of places where they are expected)
+    
     [see also:]
         BitmapFont FontDescription Font
 
@@ -200,6 +235,20 @@
 
 examples
 "
+                                                                [exBegin]
+     |aView|
+
+     aView := TextView new extent:400@400.
+     aView openAndWait.
+     aView font:(HersheyFont family:'hershey-gothic-german' face:'bold' style:'roman' size:12).
+     aView contents:'
+
+Hello world
+
+Is this nice?'.
+                                                                [exEnd]
+
+                                                                [exBegin]
      |aView|
 
      aView := View new extent:500@200.
@@ -316,6 +365,7 @@
                                         style:'roman' 
                                          size:24) in:aView
      ].
+                                                                [exEnd]
 "
 ! !
 
@@ -367,7 +417,7 @@
     ^ nil
 
     "
-     HersheyFont family:'hershey-gothic-german' face:'medium' style:'roman' size:12
+     HersheyFont family:'hershey-gothic-german' face:'bold' style:'roman' size:12
     "
 
     "Modified: 16.1.1997 / 18:19:47 / cg"
@@ -524,8 +574,29 @@
     "the directory, where the glyph data is found;
      you may have to modify this a bit ..."
 
-    ^ '/usr/local/fonts/hershey/data/hersh.oc'
+    #(
+        '/usr/local/fonts/hershey'
+        '/usr/fonts/hershey'
+        '~/fonts/hershey'
+        '~/Library/fonts/hershey'
+        '~/Fonts/hershey'
+        '/Library/fonts/hershey'
+        '~/Desktop/fonts/hershey'
+        '~/Desktop/hershey'
+        '~/Downloads/fonts/hershey'
+    ) do:[:each |
+        |fn|
+        
+        fn := each asFilename.
+        (fn / 'data') exists ifTrue:[^ fn pathName].
+    ].
+    
+    ^ '/usr/local/fonts/hershey'
 
+    "
+     self hersheyFontPath
+    "
+    
     "Modified: 16.1.1997 / 18:24:35 / cg"
 !
 
@@ -544,7 +615,7 @@
 readDataFile
     |inStream b5 b3 chars moves glyphNo nPairs char1 char2 index|
 
-    inStream := FileStream readonlyFileNamed:(self hersheyFontPath).
+    inStream := FileStream readonlyFileNamed:(self hersheyFontPath asFilename / 'data/hersh.oc').
     inStream isNil ifTrue:[
         self error:'no glyph data file ''' , self hersheyFontPath , ''' found.'.
         ^ self
@@ -553,7 +624,7 @@
     GlyphData isNil ifTrue:[
         Transcript showCR:'reading hershey glyphs ...'.
 
-        GlyphData := OrderedCollection new:4000; grow:4000.
+        GlyphData := (OrderedCollection new:4000) grow:4000.
         b5 := String new:5.
         b3 := String new:3.
         [inStream atEnd] whileFalse:[
@@ -590,13 +661,13 @@
 
 !HersheyFont methodsFor:'drawing'!
 
-displayString:aString from:index1 to:index2 x:x0 y:y in:aGC
+displayString:aString from:index1 to:index2 x:x0 y:y in:aGC opaque:opaque
     |x|
 
     x := x0.
     index1 to:index2 do:[:index |
-	self drawCharacter:(aString at:index) asciiValue in:aGC x:x y:y.
-	x := x + (self widthOfCharacter:(aString at:index) asciiValue)
+        self drawCharacter:(aString at:index) asciiValue in:aGC x:x y:y.
+        x := x + (self widthOfCharacter:(aString at:index) asciiValue)
     ]
 !
 
@@ -614,6 +685,7 @@
     |glyphNo|
 
     (ascii between:32 and:127) ifFalse:[^ self].
+    
     glyphNo := glyphs at:(ascii - 32 + 1).
     glyphNo isNil ifTrue:[^ self].
     self class drawGlyph:glyphNo in:aGC x:x y:y scale:scale
@@ -629,6 +701,10 @@
     scale := sz / 24 
 !
 
+onDevice:aDevice
+    ^ self copy setDevice:aDevice
+!
+
 readGlyphsFrom:aFileName
     "read glyph definitions from aFileName"
 
@@ -636,19 +712,19 @@
 
     self class readDataFile.
     glyphs := Array new:(256 - 32).
-    inStream := FileStream readonlyFileNamed:('/LocalLibrary/Fonts/hershey/fonts/',aFileName,'.hmp').
+    inStream := FileStream readonlyFileNamed:(self class hersheyFontPath asFilename / 'fonts' / (aFileName , '.hmp')).
     ascii := 32.
     [inStream atEnd] whileFalse:[
-	index1 := Number readFrom:inStream.
-	index2 := Number readFrom:inStream.
-	index2 == 0 ifTrue:[
-	    index2 := index1
-	].
-	index1 to:index2 do:[:pos |
-	    glyphs at:(ascii - 32 + 1) put:pos.
-	    ascii := ascii + 1
-	].
-	inStream skipSeparators
+        index1 := Number readFrom:inStream.
+        index2 := Number readFrom:inStream.
+        index2 == 0 ifTrue:[
+            index2 := index1
+        ].
+        index1 to:index2 do:[:pos |
+            glyphs at:(ascii - 32 + 1) put:pos.
+            ascii := ascii + 1
+        ].
+        inStream skipSeparators
     ].
     inStream close.
     ^ self
@@ -656,6 +732,20 @@
 
 scale:aScale
     scale := aScale
+!
+
+setDevice:aDevice
+    super setDevice:aDevice.
+    scale isNil ifTrue:[
+        scale := size / 24 
+    ].    
+    ascent := maxAscent := self ascentOn:aDevice.
+    descent := maxDescent := self descentOn:aDevice.
+    width := minWidth := maxWidth := self widthOn:aDevice.
+    isFixedWidth := false.
+    minCode := 32.
+    maxCode := 127.
+    encoding := 'ascii'.
 ! !
 
 !HersheyFont methodsFor:'queries'!
@@ -681,8 +771,8 @@
     ^ scale * (24 + 12)
 !
 
-onDevice:aDevice
-    ^ self
+isAlienFont
+    ^ true
 !
 
 widthOf:aString
@@ -712,13 +802,23 @@
     |glyphNo|
 
     (ascii between:32 and:127) ifFalse:[^ 0].
+    
     glyphNo := glyphs at:(ascii - 32 + 1).
     glyphNo isNil ifTrue:[^ 0].
     ^ self class widthOfGlyph:glyphNo scale:scale
+!
+
+widthOn:aDevice
+    ^ self widthOfCharacter:($m codePoint)
 ! !
 
 !HersheyFont class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/HersheyFont.st,v 1.7 2002-07-23 17:22:44 mb Exp $'
+    ^ '$Header$'
+!
+
+version_CVS
+    ^ '$Header$'
 ! !
+