[Pkg] The Trunk: Collections-mt.965.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Dec 2 13:52:24 UTC 2021
Marcel Taeumel uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-mt.965.mcz
==================== Summary ====================
Name: Collections-mt.965
Author: mt
Time: 2 December 2021, 2:52:21.175715 pm
UUID: 1d5fd54c-a0fc-044b-9bf6-75cb62f26fd4
Ancestors: Collections-ul.964
To HtmlReadWriter's support of <font> tags, add specific support for "face" and "size" attributes.
Note that, at some point, we might want to extract the stuff shared between Collections and Graphics into a separate package. Maybe the entire "Collections-Text" stuff should live somewhere else.
=============== Diff against Collections-ul.964 ===============
Item was changed:
----- Method: HtmlReadWriter>>mapFontTag: (in category 'mapping') -----
mapFontTag: aTag
+ | result colorName fontFace fontSize |
- | result colorStartIndex colorStopIndex attribute |
result := OrderedCollection new.
"<font color=""#00FFCC""> or <font color=""green"">"
+ "<font face=""Bitmap DejaVu Sans"" size=""12"">"
+ (#(color face size) collect: [:attribute |
+ | startIndex stopIndex |
+ startIndex := aTag findString: attribute.
+ startIndex > 0 ifTrue: [
+ startIndex := aTag findString: '"' startingAt: startIndex+attribute size.
+ stopIndex := aTag findString: '"' startingAt: startIndex+1.
+ aTag copyFrom: startIndex+1 to: stopIndex-1]])
+ in: [:values |
+ colorName := values first.
+ fontFace := values second.
+ fontSize := values third].
+
+ colorName ifNotNil: [
+ result add: (TextColor color: (Color fromString: colorName))].
+ (fontFace notNil or: [fontSize notNil]) ifTrue: [
+ result add: (TextFontReference toFont: (StrikeFont familyName: (fontFace ifNil: [TextStyle defaultFont familyName]) pointSize: (fontSize ifNil: [TextStyle defaultFont pointSize])))].
+
- attribute := 'color'.
- colorStartIndex := aTag findString: attribute.
- colorStartIndex > 0 ifTrue: [
- colorStartIndex := aTag findString: '"' startingAt: colorStartIndex+attribute size.
- colorStopIndex := aTag findString: '"' startingAt: colorStartIndex+1.
- result add: (TextColor color:
- (Color fromString: (aTag copyFrom: colorStartIndex+1 to: colorStopIndex-1)))].
-
^ result!
Item was added:
+ ----- Method: TextFontReference>>closeHtmlOn: (in category 'html') -----
+ closeHtmlOn: aStream
+
+ font closeHtmlOn: aStream.!
Item was added:
+ ----- Method: TextFontReference>>openHtmlOn: (in category 'html') -----
+ openHtmlOn: aStream
+
+ font openHtmlOn: aStream.!
More information about the Packages
mailing list