The Trunk: Multilingual-ul.218.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Multilingual-ul.218.mcz

commits-2
Levente Uzonyi uploaded a new version of Multilingual to project The Trunk:
http://source.squeak.org/trunk/Multilingual-ul.218.mcz

==================== Summary ====================

Name: Multilingual-ul.218
Author: ul
Time: 13 March 2017, 2:44:49.462944 pm
UUID: 69427b43-9743-47fa-925f-7759a34c58df
Ancestors: Multilingual-tfel.217

SortedCollection Whack-a-mole

=============== Diff against Multilingual-tfel.217 ===============

Item was changed:
  ----- Method: EFontBDFFontReader>>readFrom:to: (in category 'as yet unclassified') -----
  readFrom: start to: end
 
  | xTable glyphs ascent descent chars charsNum height form blt lastAscii pointSize ret lastValue encoding bbx strikeWidth minAscii maxAscii maxWidth |
  form := encoding := bbx := nil.
  self initialize.
  self readAttributes.
  height := Integer readFromString: ((properties at: #FONTBOUNDINGBOX) at: 2).
  ascent := Integer readFromString: (properties at: #'FONT_ASCENT')  first.
  descent := Integer readFromString: (properties at: #'FONT_DESCENT') first.
  (properties includesKey: #'POINT_SIZE') ifTrue: [
  pointSize := (Integer readFromString: (properties at: #'POINT_SIZE') first) // 10.
  ] ifFalse: [
  pointSize := (ascent + descent) * 72 // 96.
  ].
 
 
  maxWidth := 0.
  minAscii := 16r200000.
  strikeWidth := 0.
  maxAscii := 0.
 
  charsNum := Integer readFromString: (properties at: #CHARS) first.
  chars := Set new: charsNum.
 
  self readCharactersInRangeFrom: start to: end totalNums: charsNum storeInto: chars.
 
+ chars := chars sorted: [:x :y | (x at: 2) <= (y at: 2)].
- chars := chars asSortedCollection: [:x :y | (x at: 2) <= (y at: 2)].
  charsNum := chars size. "undefined encodings make this different"
 
  chars do: [:array | | width |
  encoding := array at: 2.
  bbx := array at: 3..
  width := bbx at: 1.
  maxWidth := maxWidth max: width.
  minAscii := minAscii min: encoding.
  maxAscii := maxAscii max: encoding.
  strikeWidth := strikeWidth + width.
  ].
  glyphs := Form extent: strikeWidth@height.
  blt := BitBlt toForm: glyphs.
  "xTable := XTableForUnicodeFont new ranges: (Array with: (Array with: start with: end))."
  xTable := SparseLargeTable new: end + 3 chunkSize: 32 arrayClass: Array base: start + 1 defaultValue: -1.
  lastAscii := start.
  1 to: charsNum do: [:i |
  form := (chars at: i) first.
  encoding := (chars at: i) second.
  bbx := (chars at: i) third.
  "lastAscii+1 to: encoding-1 do: [:a | xTable at: a+2 put: (xTable at: a+1)]."
  lastValue := xTable at: lastAscii + 1 + 1.
  xTable at: encoding + 1 put: lastValue.
  blt copy: (((xTable at: encoding+1)@(ascent - (bbx at: 2) - (bbx at: 4)))
  extent: (bbx at: 1)@(bbx at: 2))
  from: 0@0 in: form.
  xTable at: encoding+2 put: (xTable at: encoding+1)+(bbx at: 1).
  lastAscii := encoding.
  ].
 
  xTable zapDefaultOnlyEntries.
  ret := Array new: 8.
  ret at: 1 put: xTable.
  ret at: 2 put: glyphs.
  ret at: 3 put: minAscii.
  ret at: 4 put: maxAscii.
  ret at: 5 put: maxWidth.
  ret at: 6 put: ascent.
  ret at: 7 put: descent.
  ret at: 8 put: pointSize.
  ^ret.
  " ^{xTable. glyphs. minAscii. maxAscii. maxWidth. ascent. descent. pointSize}"
  !

Item was changed:
  ----- Method: EFontBDFFontReaderForRanges>>readRanges: (in category 'as yet unclassified') -----
  readRanges: ranges
 
  | xTable glyphs ascent descent chars charsNum height form blt lastAscii pointSize ret lastValue start end encoding bbx strikeWidth minAscii maxAscii maxWidth |
  form := encoding := bbx := nil.
  self initialize.
  self readAttributes.
  height := Integer readFromString: ((properties at: #FONTBOUNDINGBOX) at: 2).
  ascent := Integer readFromString: (properties at: #'FONT_ASCENT') first.
  descent := Integer readFromString: (properties at: #'FONT_DESCENT') first.
  (properties includesKey: #'POINT_SIZE') ifTrue: [
  pointSize := (Integer readFromString: (properties at: #'POINT_SIZE') first) // 10.
  ] ifFalse: [
  pointSize := (ascent + descent) * 72 // 96.
  ].
 
  maxWidth := 0.
  minAscii := 16r200000.
  strikeWidth := 0.
  maxAscii := 0.
 
  charsNum := Integer readFromString: (properties at: #CHARS) first.
  chars := Set new: charsNum.
 
  self readCharactersInRanges: ranges storeInto: chars.
 
+ chars := chars sorted: [:x :y | (x at: 2) <= (y at: 2)].
- chars := chars asSortedCollection: [:x :y | (x at: 2) <= (y at: 2)].
  charsNum := chars size. "undefined encodings make this different"
 
  chars do: [:array | | width |
  encoding := array at: 2.
  bbx := array at: 3..
  width := bbx at: 1.
  maxWidth := maxWidth max: width.
  minAscii := minAscii min: encoding.
  maxAscii := maxAscii max: encoding.
  strikeWidth := strikeWidth + width.
  ].
 
  glyphs := Form extent: strikeWidth@height.
  blt := BitBlt toForm: glyphs.
  start := (ranges collect: [:r | r first]) min.
  end := (ranges collect: [:r | r second]) max + 3.
 
  xTable := SparseLargeTable new: end chunkSize: 64 arrayClass: Array base: start +1 defaultValue: -1.
  lastAscii := start.
  xTable at: lastAscii + 2 put: 0.
  1 to: charsNum do: [:i |
  form := (chars at: i) first.
  encoding := (chars at: i) second.
  bbx := (chars at: i) third.
  "lastAscii+1 to: encoding-1 do: [:a | xTable at: a+2 put: (xTable at: a+1)]."
  lastValue := xTable at: lastAscii + 1 + 1.
  xTable at: encoding + 1 put: lastValue.
  blt copy: (((xTable at: encoding+1)@(ascent - (bbx at: 2) - (bbx at: 4)))
  extent: (bbx at: 1)@(bbx at: 2))
  from: 0@0 in: form.
  xTable at: encoding+2 put: (xTable at: encoding+1)+(bbx at: 1).
  lastAscii := encoding.
  ].
  xTable at: xTable size put: (xTable at: xTable size - 1).
  xTable zapDefaultOnlyEntries.
  ret := Array new: 8.
  ret at: 1 put: xTable.
  ret at: 2 put: glyphs.
  ret at: 3 put: minAscii.
  ret at: 4 put: maxAscii.
  ret at: 5 put: maxWidth.
  ret at: 6 put: ascent.
  ret at: 7 put: descent.
  ret at: 8 put: pointSize.
  ^ret.
  " ^{xTable. glyphs. minAscii. maxAscii. maxWidth. ascent. descent. pointSize}"
  !

Item was changed:
  ----- Method: EFontBDFFontReaderForRanges>>readRanges:overrideWith:otherRanges:additionalOverrideRange: (in category 'as yet unclassified') -----
  readRanges: ranges overrideWith: otherFileName otherRanges: otherRanges additionalOverrideRange: additionalRange
 
  | xTable glyphs ascent descent chars charsNum height form blt lastAscii pointSize ret lastValue start end encoding bbx strikeWidth minAscii maxAscii maxWidth |
  form := encoding := bbx := nil.
  self initialize.
  self readAttributes.
  height := Integer readFromString: ((properties at: #FONTBOUNDINGBOX) at: 2).
  ascent := Integer readFromString: (properties at: #'FONT_ASCENT') first.
  descent := Integer readFromString: (properties at: #'FONT_DESCENT') first.
  (properties includesKey: #'POINT_SIZE') ifTrue: [
  pointSize := (Integer readFromString: (properties at: #'POINT_SIZE') first) // 10.
  ] ifFalse: [
  pointSize := (ascent + descent) * 72 // 96.
  ].
 
 
  maxWidth := 0.
  minAscii := 16r200000.
  strikeWidth := 0.
  maxAscii := 0.
 
  charsNum := Integer readFromString: (properties at: #CHARS) first.
  chars := Set new: charsNum.
 
  self readCharactersInRanges: ranges storeInto: chars.
  chars := self override: chars with: otherFileName ranges: otherRanges transcodingTable: (UCSTable jisx0208Table) additionalRange: additionalRange.
 
+ chars := chars sorted: [:x :y | (x at: 2) <= (y at: 2)].
- chars := chars asSortedCollection: [:x :y | (x at: 2) <= (y at: 2)].
  charsNum := chars size. "undefined encodings make this different"
 
  chars do: [:array | | width |
  encoding := array at: 2.
  bbx := array at: 3..
  width := bbx at: 1.
  maxWidth := maxWidth max: width.
  minAscii := minAscii min: encoding.
  maxAscii := maxAscii max: encoding.
  strikeWidth := strikeWidth + width.
  ].
 
  glyphs := Form extent: strikeWidth@height.
  blt := BitBlt toForm: glyphs.
  start := ((ranges collect: [:r | r first]), (additionalRange collect: [:r2 | r2 first])) min.
  end := ((ranges collect: [:r | r second]), (additionalRange collect: [:r2 | r2 second])) max + 3.
  "xRange := Array with: (Array with: ((ranges collect: [:r | r first]), (additionalRange collect: [:r2 | r2 first])) min
  with: (((ranges collect: [:r | r second]), (additionalRange collect: [:r2 | r2 second])) max + 2))."
  "xTable := XTableForUnicodeFont new
  ranges: xRange."
  xTable := SparseLargeTable new: end chunkSize: 64 arrayClass: Array base: start defaultValue: -1.
  lastAscii := start.
  xTable at: lastAscii + 2 put: 0.
  1 to: charsNum do: [:i |
  form := (chars at: i) first.
  encoding := (chars at: i) second.
  bbx := (chars at: i) third.
  "lastAscii+1 to: encoding-1 do: [:a | xTable at: a+2 put: (xTable at: a+1)]."
  lastValue := xTable at: lastAscii + 1 + 1.
  xTable at: encoding + 1 put: lastValue.
  blt copy: (((xTable at: encoding+1)@(ascent - (bbx at: 2) - (bbx at: 4)))
  extent: (bbx at: 1)@(bbx at: 2))
  from: 0@0 in: form.
  xTable at: encoding+2 put: (xTable at: encoding+1)+(bbx at: 1).
  lastAscii := encoding.
  ].
  xTable at: xTable size put: (xTable at: xTable size - 1).
  xTable zapDefaultOnlyEntries.
  ret := Array new: 8.
  ret at: 1 put: xTable.
  ret at: 2 put: glyphs.
  ret at: 3 put: minAscii.
  ret at: 4 put: maxAscii.
  ret at: 5 put: maxWidth.
  ret at: 6 put: ascent.
  ret at: 7 put: descent.
  ret at: 8 put: pointSize.
  ^ret.
  " ^{xTable. glyphs. minAscii. maxAscii. maxWidth. ascent. descent. pointSize}"
  !

Item was changed:
  ----- Method: StrikeFontSet class>>familyName:size: (in category 'as yet unclassified') -----
  familyName: aName size: aSize
  "Answer a font (or the default font if the name is unknown) in the specified size."
 
  | collection |
  collection :=  self allInstances select: [:inst | (inst name beginsWith: aName) and: [inst emphasis = 0]].
  collection isEmpty ifTrue: [
  (aName = 'DefaultMultiStyle') ifTrue: [
  collection := (TextConstants at: #DefaultMultiStyle) fontArray.
  ] ifFalse: [
  ^ TextStyle defaultFont
  ]
  ].
+ collection sort: [:a :b | a pointSize <= b pointSize].
- collection := collection asSortedCollection: [:a :b | a pointSize <= b pointSize].
  collection do: [:s | (s pointSize >= aSize) ifTrue: [^ s]].
  ^ TextStyle defaultFont.
  !