'From Squeakland 3.8.5976 of 25 August 2004 [latest update: #267] on 31 August 2004 at 5:15:39 pm'! "Change Set: MoreM17NCleanup-nk Date: 31 August 2004 Author: Ned Konz Some more fixes for the various M17N related code. Calls of unimplemented messages, subclass responsibilities not defined, etc. "! !AbstractFont methodsFor: 'accessing' stamp: 'nk 8/31/2004 09:15'! familyName "Answer the name to be used as a key in the TextConstants dictionary." ^self subclassResponsibility! ! !AbstractFont methodsFor: 'accessing' stamp: 'nk 8/31/2004 09:14'! height "Answer the height of the receiver, total of maximum extents of characters above and below the baseline." ^self subclassResponsibility! ! !AbstractFont methodsFor: 'accessing' stamp: 'nk 8/31/2004 09:14'! lineGrid "Answer the relative space between lines" ^self subclassResponsibility! ! !AbstractString methodsFor: '*packageinfo-base' stamp: 'nk 8/30/2004 09:02'! escapeEntities ^ self species streamContents: [:s | self do: [:c | s nextPutAll: c escapeEntities]] ! ! !FontSet class methodsFor: 'installing' stamp: 'nk 8/31/2004 09:23'! fontNamed: fontName fromLiteral: aString "This method allows a font set to be captured as sourcecode in a subclass. The string literals will presumably be created by printing, eg, (FileStream readOnlyFileNamed: 'Palatino24.sf2') contentsOfEntireFile, and then pasting into a browser after a heading like, eg, sizeNewYork10 ^ self fontNamed: 'NewYork10' fromLiteral: '--unreadable binary data--' See the method installAsTextStyle to see how this can be used." ^(StrikeFont new) name: fontName; readFromStrike2Stream: (ReadStream on: aString asByteArray); yourself! ! !FontSet class methodsFor: 'installing' stamp: 'nk 8/31/2004 09:23'! size: pointSize fromLiteral: aString "This method allows a font set to be captured as sourcecode in a subclass. The string literals will presumably be created by printing, eg, (FileStream readOnlyFileNamed: 'Palatino24.sf2') contentsOfEntireFile, and then pasting into a browser after a heading like, eg, size24 ^ self size: 24 fromLiteral: '--unreadable binary data--' See the method installAsTextStyle to see how this can be used." "This method is old and for backward compatibility only. please use fontNamed:fromLiteral: instead." self flag: #bob. "used in Alan's projects" ^(StrikeFont new) name: self fontName , (pointSize < 10 ifTrue: ['0' , pointSize printString] ifFalse: [pointSize printString]); readFromStrike2Stream: ((RWBinaryOrTextStream with: aString) reset; binary); yourself! ! !Locale methodsFor: 'accessing' stamp: 'nk 8/31/2004 09:39'! isoCountry ^self localeID isoCountry! ! !Locale methodsFor: 'accessing' stamp: 'nk 8/31/2004 09:39'! isoLanguage ^self localeID isoLanguage! ! !Locale class methodsFor: 'class initialization' stamp: 'nk 8/29/2004 13:21'! initializePlatformEncodings "Locale initializePlatformEncodings" | platform | PlatformEncodings isNil ifTrue: [ PlatformEncodings := Dictionary new ]. platform := PlatformEncodings at: 'default' ifAbsentPut: Dictionary new. platform at: 'default' put: 'iso8859-1'; at: 'Win32 CE' put: 'utf-8'; yourself. platform := PlatformEncodings at: 'ja' ifAbsentPut: Dictionary new. platform at: 'default' put: 'shift-jis'; at: 'unix' put: 'euc-jp'; at: 'Win32 CE' put: 'utf-8'; yourself. platform := PlatformEncodings at: 'ko' ifAbsentPut: Dictionary new. platform at: 'default' put: 'euc-kr'; at: 'Win32 CE' put: 'utf-8'; yourself. platform := PlatformEncodings at: 'zh' ifAbsentPut: Dictionary new. platform at: 'default' put: 'gb2312'; at: 'unix' put: 'euc-cn'; at: 'Win32 CE' put: 'utf-8'; yourself. ! ! !Locale class methodsFor: 'class initialization' stamp: 'nk 8/29/2004 13:20'! platformEncodings PlatformEncodings isEmptyOrNil ifTrue: [ self initializePlatformEncodings ]. ^PlatformEncodings ! ! !LocaleID methodsFor: 'accessing' stamp: 'nk 8/29/2004 12:42'! displayCountry ^(ISOLanguageDefinition isoCountries at: self isoCountry asUppercase ifAbsent: [ self isoCountry ]) ! ! !NaturalLanguageTranslator methodsFor: 'printing' stamp: 'nk 8/29/2004 10:51'! printOn: aStream aStream nextPutAll: self class name; nextPut: $(; print: self localeID; nextPut: $)! ! !NaturalLanguageTranslator methodsFor: 'translation' stamp: 'nk 8/29/2004 13:36'! removeTranslationFor: phraseString self generics removeKey: phraseString ifAbsent: []! ! !NaturalLanguageTranslator class methodsFor: 'accessing' stamp: 'nk 8/29/2004 14:23'! default ^self localeID: (LocaleID default) ! ! !NaturalLanguageTranslator class methodsFor: 'class initialization' stamp: 'nk 8/29/2004 13:23'! startUp: resuming | defaultID | resuming ifFalse: [^ self]. "" defaultID := LocaleID default. self cachedTranslations at: defaultID ifAbsent: [self localeID: defaultID]. "" self loadAvailableExternalLocales! ! !PasswordFont methodsFor: 'accessing' stamp: 'nk 8/31/2004 09:25'! familyName ^baseFont familyName, '-pw'! ! !PasswordFont methodsFor: 'accessing' stamp: 'nk 8/31/2004 09:26'! lineGrid ^baseFont lineGrid! ! !PasswordFont methodsFor: 'accessing' stamp: 'nk 8/31/2004 09:28'! pointSize ^baseFont pointSize! ! !SparseLargeTable methodsFor: 'private' stamp: 'nk 8/31/2004 08:34'! copyEmpty "Answer a copy of the receiver that contains no elements." ^self speciesNew: 0 ! ! !StrikeFont methodsFor: 'file in/out' stamp: 'nk 8/31/2004 09:22'! readBDFFromFile: fileName name: aString "This builds a StrikeFont instance by reading the X11 Binary Distribution Format font source file. See the BDFFontReader class comment." "StrikeFont new readBDFFromFile: 'helvR12' name: 'Helvetica12'." | fontReader stream | fontReader := BDFFontReader oldFileNamed: fileName. stream := ReadStream on: fontReader read. xTable := stream next. glyphs := stream next. minAscii := stream next. maxAscii := stream next. maxWidth := stream next. ascent := stream next. descent := stream next. pointSize := stream next. name := aString. " xTable size <= 256 ifTrue: [self setStopConditions]." type := 0. "no one see this" superscript := (ascent - descent) // 3. subscript := (descent - ascent) // 3. emphasis := 0. self reset! ! !HostFont methodsFor: 'primitives' stamp: 'nk 8/31/2004 09:19'! primitiveFont: fontHandle fullWidthOfChar: aCharIndex ^Array with: 0 with: (self primitiveFont: fontHandle widthOfChar: aCharIndex) with: 0! ! !HostFont methodsFor: 'primitives' stamp: 'nk 8/31/2004 09:19'! primitiveFont: fontHandle glyphOfChar: aCharIndex into: glyphForm ^self primitiveFailed! ! !HostFont methodsFor: 'primitives' stamp: 'nk 8/31/2004 09:19'! primitiveFont: fontHandle widthOfChar: aCharIndex ^self primitiveFailed! ! !TTCFontSet methodsFor: 'as yet unclassified' stamp: 'nk 8/31/2004 09:27'! height ^fontArray first pixelSize. ! ! !TTCFontSet methodsFor: 'as yet unclassified' stamp: 'nk 8/31/2004 09:27'! lineGrid ^ fontArray first lineGrid. ! ! !TextStyle methodsFor: 'mime file in/out' stamp: 'nk 8/31/2004 09:23'! compressedMIMEEncodedStream "Answer a ReadWriteStream with my compressed, stored representation as Base64" | s ff ffcontents s2 gzs | self fontArray do: [:f | f releaseCachedState]. s := RWBinaryOrTextStream on: ''. ff := SmartRefStream on: s reset. TextConstants at: #forceFontWriting put: true. [ff nextPut: self] ensure: [TextConstants at: #forceFontWriting put: false]. ffcontents := s contents. ff close. s2 := RWBinaryOrTextStream on: ''. gzs := GZipWriteStream on: s2. gzs nextPutAll: ffcontents. gzs close. s2 reset. s := RWBinaryOrTextStream on: (ByteArray new: 10000). Base64MimeConverter mimeEncode: s2 to: s. ^s ascii; reset; yourself! ! !TextStyle class methodsFor: 'mime file in/out' stamp: 'nk 8/31/2004 09:20'! writeSF2FamilyNamed: familyName inDirectory: directoryName toChangeSet: csName " TextStyle writeSF2FamilyNamed: 'Accuny' inDirectory: 'AccunyCorrectedFeb252004Beta Folder' toChangeSet: 'AccunyInstall'. " | oldDefaultDirectory family | oldDefaultDirectory := FileDirectory default. family := OrderedCollection new. FileDirectory setDefaultDirectory: (FileDirectory default fullNameFor: directoryName). [family addAll: (StrikeFont readStrikeFont2Family: familyName) ] ensure: [FileDirectory setDefaultDirectory: oldDefaultDirectory fullName]. family do: [:f | f reset]. self writeStyle: (TextStyle fontArray: family asArray) named: familyName toChangeSet: csName! ! Symbol removeSelector: #hashMappedBy:! !PasswordFont reorganize! ('accessing' ascent baseFont baseFont: baseKern descent descentKern emphasized: familyName height lineGrid passwordCharacter pointSize) ('measuring' widthOf:) ('displaying' displayString:on:from:to:at:kern: installOn:foregroundColor:backgroundColor:) ('caching' releaseCachedState) ! MultiSymbol removeSelector: #hashMappedBy:! MultiString removeSelector: #asTranslatedWording! MultiByteFileStream removeSelector: #basicNext! EncodedCharSet class removeSelector: #compoundTextFinalChar! EncodedCharSet class removeSelector: #compoundTextSequence! AbstractString removeSelector: #asTranslatedWording! AbstractString removeSelector: #at:! AbstractFont removeSelector: #displayStringR2L:on:from:to:at:kern:! AbstractFont removeSelector: #isL2R!