Marcel Taeumel uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-mt.1120.mcz
==================== Summary ====================
Name: Tools-mt.1120
Author: mt
Time: 30 January 2022, 9:06:35.692695 pm
UUID: 9ae6768f-fa92-2a42-846e-335169a65751
Ancestors: Tools-ct.1119
Adds a small tool to browse all available glyphs in a font.
Try this:
TextStyle defaultFont browseAllGlyphs.
TextStyle defaultFixedFont browseAllGlyphs.
=============== Diff against Tools-ct.1119 ===============
Item was added:
+ ----- Method: AbstractFont>>browseAllGlyphs (in category '*Tools-Browsing') -----
+ browseAllGlyphs
+
+ ^ self browseGlyphsFrom: self minCodePoint to: self maxCodePoint!
Item was added:
+ ----- Method: AbstractFont>>browseGlyphsFrom:to: (in category '*Tools-Browsing') -----
+ browseGlyphsFrom: firstCodePoint to: lastCodePoint
+ "Browse all glyphs in the given range of code points. Use a fall-back character if an inner code point does not have a glyph. DO NOT TRANSLATE!!"
+
+ | contents |
+ contents := String streamContents: [:s |
+ | first last fallbackChar |
+ first := firstCodePoint max: (self minCodePoint max: 32+1 "first printable after space").
+ last := lastCodePoint min: self maxCodePoint.
+ fallbackChar := Character space.
+ first to: last do: [:codePoint | | char |
+ (self hasGlyphOf: (char := Character value: codePoint))
+ ifTrue: [s nextPut: char]
+ ifFalse: [s nextPut: fallbackChar]]].
+ contents := contents asText addAttribute: (TextFontReference toFont: self); yourself.
+ contents := ((' Family name: {1}\ Emphasis: {2}\ Point size: {3}\Pixels per inch: {4}\ Pixel size: {5}\\' withCRs asText format: { self familyName asText addAttribute: (PluggableTextAttribute evalBlock: [self explore]); yourself. self emphasisString. self pointSize. self pixelsPerInch. self pixelSize }) addAttribute: (TextFontReference toFont: TextStyle defaultFixedFont); yourself),
+ contents.
+ contents editWithLabel: self printString.!
Marcel Taeumel uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-mt.470.mcz
==================== Summary ====================
Name: Graphics-mt.470
Author: mt
Time: 30 January 2022, 9:01:03.368695 pm
UUID: 263add45-e829-e84c-9775-f897d442a107
Ancestors: Graphics-mt.469
Fixes another issue with fall-back fonts in StrikeFonts. Watch out that you use a fall-back character that can actually be rendered. I suppose that the only remaining issue now would be that you cannot use a StrikeFont that cannot render even a single character... We could use line-breaks then ... :-D
=============== Diff against Graphics-mt.469 ===============
Item was changed:
----- Method: FixedFaceFont>>baseFont: (in category 'accessing') -----
baseFont: aFont
+ baseFont := aFont.
+ substitutionCharacter ifNotNil: [
+ substitutionCharacter := substitutionCharacter max: self minSubstitutionCharacter].!
- baseFont := aFont!
Item was added:
+ ----- Method: FixedFaceFont>>errorCharacter (in category 'accessing') -----
+ errorCharacter
+ ^$?!
Item was changed:
----- Method: FixedFaceFont>>errorFont (in category 'initialize-release') -----
errorFont
displaySelector := #displayErrorOn:length:at:kern:baselineY:.
+ substitutionCharacter := self errorCharacter max: self minSubstitutionCharacter.!
- substitutionCharacter := $?.!
Item was added:
+ ----- Method: FixedFaceFont>>minSubstitutionCharacter (in category 'private') -----
+ minSubstitutionCharacter
+
+ ^ Character value: (baseFont ifNil: [0] ifNotNil: [baseFont minCodePoint])!
Item was changed:
----- Method: FixedFaceFont>>passwordFont (in category 'initialize-release') -----
passwordFont
displaySelector := #displayPasswordOn:length:at:kern:baselineY:.
+ substitutionCharacter := self passwordCharacter max: self minSubstitutionCharacter.!
- substitutionCharacter := self passwordCharacter!
Item was changed:
----- Method: StrikeFont>>glyphOf: (in category 'accessing') -----
glyphOf: aCharacter
"Answer the width of the argument as a character in the receiver."
| code |
+ (self hasGlyphOf: aCharacter)
+ ifFalse: [^ self fallbackFont glyphOf: aCharacter].
- (self hasGlyphOf: aCharacter) ifFalse: [
- fallbackFont ifNotNil: [
- ^ fallbackFont glyphOf: aCharacter.
- ].
- ^ (Form extent: 1@self height) fillColor: Color white
- ].
code := self codeForCharacter: aCharacter.
^ glyphs copy: (((xTable at: code + 1)@0) corner: (xTable at: code +2)@self height).
!
Marcel Taeumel uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-mt.469.mcz
==================== Summary ====================
Name: Graphics-mt.469
Author: mt
Time: 30 January 2022, 8:33:29.157695 pm
UUID: 39bf150b-8f33-2b42-9195-5a141ca51cca
Ancestors: Graphics-mt.468
Revise the fix for #hasGlyphForCode: from Graphics-mt.468 ... of course ... we must check +1 and +2. I even said so in the commentary. Sorry for the noise.
=============== Diff against Graphics-mt.468 ===============
Item was changed:
----- Method: StrikeFont>>hasGlyphForCode: (in category 'multibyte character methods') -----
hasGlyphForCode: aCharacterCode
"Note that missing glyphs are encoded as -1 in the xTable but to speed up the #widthOf: check, the next offset must be adjacent and thus be duplicated. For example: #(-1 -1 0 24 -1 -1 -1 24 48 -1 ...). Since aCharacterCode is 0-based, that codes offset is at +1 while its width needs to consult +2, too. See #widthOf:."
(aCharacterCode between: self minAscii and: self maxAscii)
ifFalse: [^ false].
+ (xTable at: aCharacterCode + 1) >= 0
+ ifFalse: [^ false].
(xTable at: aCharacterCode + 2) >= 0
ifFalse: [^ false].
^ true!
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1863.mcz
==================== Summary ====================
Name: Morphic-mt.1863
Author: mt
Time: 30 January 2022, 8:22:27.857695 pm
UUID: 18d0ec7f-edb0-c14a-8287-fa92bcfd1b0a
Ancestors: Morphic-mt.1862
Complements Graphics-mt.468 and ToolBuilder-Morphic-mt.291.
=============== Diff against Morphic-mt.1862 ===============
Item was changed:
----- Method: TextMorph>>font: (in category 'accessing') -----
font: aFont
+ "Change the receiver's default font, which is used to draw its contents. Remove all custom font-face-related attributes from the current contents. For a less harsh approach, just use #textStyle: instead and rely on text attributes.
- "Change the receiver's default font, which is used to draw its contents. Remove all custom font-face-related attributes from the current contents. Try to lookup the matching #textStyle so that TextFontChange can be used from here on. For a less harsh approach, just use #textStyle: instead and rely on text attributes.
!! It is best practice to work with #textStyle: and rely on the text attributes TextFontChange and (sometimes) TextFontReference."
- | newTextStyle |
self text removeAttributesThat: [:attr | attr isTextFontChange and: [attr canFontBeSubstituted]].
- newTextStyle := aFont textStyleOrNil
- ifNil: [TextStyle fontArray: {aFont}]
- ifNotNil: [:style | style copy].
- newTextStyle defaultFontIndex: (newTextStyle fontIndexOfPointSize: aFont pointSize).
-
aFont emphasis ~= 0 ifTrue: [
self text addAttribute: (TextEmphasis new emphasisCode: aFont emphasis; yourself)].
+ self textStyle: aFont asNewTextStyle.!
- self textStyle: newTextStyle.!
Marcel Taeumel uploaded a new version of TrueType to project The Trunk:
http://source.squeak.org/trunk/TrueType-mt.58.mcz
==================== Summary ====================
Name: TrueType-mt.58
Author: mt
Time: 30 January 2022, 8:18:50.806695 pm
UUID: 09c0cb65-1611-6a4c-a232-674266925c7e
Ancestors: TrueType-mt.57
Complements Graphics-mt.468. Fixes reported range in TrueType fonts, which had an off-by-one error in #maxAscii.
=============== Diff against TrueType-mt.57 ===============
Item was changed:
----- Method: TTCFont>>maxAscii (in category 'accessing') -----
maxAscii
+
+ self flag: #deprecated.
+ ^ self maxCodePoint!
- "Answer the max. code point in this font. The name of this method is historical."
- ^maxAscii ifNil:[ttcDescription size].!
Item was added:
+ ----- Method: TTCFont>>maxCodePoint (in category 'accessing') -----
+ maxCodePoint
+
+ ^maxAscii ifNil: [ttcDescription size - 1]!
Item was changed:
----- Method: TTCFont>>minAscii (in category 'accessing') -----
minAscii
+
+ self flag: #deprecated.
+ ^ self minCodePoint
- "Answer the min. code point in this font. The name of this method is historical."
- ^ 0.
!
Marcel Taeumel uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-mt.468.mcz
==================== Summary ====================
Name: Graphics-mt.468
Author: mt
Time: 30 January 2022, 8:17:05.704695 pm
UUID: 1f47d2db-9a76-f747-9613-9df0594a4d76
Ancestors: Graphics-mt.467
Fixes an issue in regarding #widthOf: for pre-renderend fonts that have holes in their supported code-point range. See commentary in #asGlyphForCode:.
Since Squeak's internal encoding is based on Unicode code points, make it explicit by renaming #minAscii and #maxAscii to #minCodePoint and #maxCodePoint. The comments already explained that.
=============== Diff against Graphics-mt.467 ===============
Item was added:
+ ----- Method: AbstractFont>>asNewTextStyle (in category 'converting') -----
+ asNewTextStyle
+ "Answer a new text style where the receiver is the default font. Try to lookup the an existing #textStyle so that TextFontChange can be used in views."
+
+ | newTextStyle |
+ newTextStyle := self textStyleOrNil
+ ifNil: [TextStyle fontArray: {self}]
+ ifNotNil: [:style | style copy].
+ newTextStyle defaultFontIndex: (newTextStyle fontIndexOfPointSize: self pointSize).
+ ^ newTextStyle!
Item was added:
+ ----- Method: AbstractFont>>maxCodePoint (in category 'accessing') -----
+ maxCodePoint
+ "Answer the largest code point that the receiver can translate into glyphs. Use the range from #minCodePoint to #maxCodePoint to configure a list of #fallbackFont's. Note that subclasses may insert 'holes' via #hasGlyphOf: test such as StrikeFont's internal xTable."
+
+ ^ 16r10FFFF "Unicode uses 21-bit but 16r110000 to 16r1FFFFF are not valid code points. See https://www.unicode.org/versions/stats/."!
Item was added:
+ ----- Method: AbstractFont>>minCodePoint (in category 'accessing') -----
+ minCodePoint
+ "Answer the smallest code point that the receiver can translate into glyphs. Use the range from #minCodePoint to #maxCodePoint to configure a list of #fallbackFont's. Note that subclasses may insert 'holes' via #hasGlyphOf: test such as StrikeFont's internal xTable."
+
+ ^ 0!
Item was changed:
----- Method: FixedFaceFont>>maxAscii (in category 'accessing') -----
maxAscii
+
+ self flag: #deprecated.
+ ^ self maxCodePoint!
- ^ SmallInteger maxVal!
Item was added:
+ ----- Method: FixedFaceFont>>maxCodePoint (in category 'accessing') -----
+ maxCodePoint
+ "Overwritten for robustness. The receiver MUST BE a reliable source of glyphs if all else fails. Font rendering must never stop."
+
+ ^ SmallInteger maxVal!
Item was changed:
----- Method: StrikeFont>>hasGlyphForCode: (in category 'multibyte character methods') -----
hasGlyphForCode: aCharacterCode
+ "Note that missing glyphs are encoded as -1 in the xTable but to speed up the #widthOf: check, the next offset must be adjacent and thus be duplicated. For example: #(-1 -1 0 24 -1 -1 -1 24 48 -1 ...). Since aCharacterCode is 0-based, that codes offset is at +1 while its width needs to consult +2, too. See #widthOf:."
(aCharacterCode between: self minAscii and: self maxAscii)
ifFalse: [^ false].
+ (xTable at: aCharacterCode + 2) >= 0
- (xTable at: aCharacterCode + 1) positive
ifFalse: [^ false].
+ ^ true!
- ^ true.
- !
Item was changed:
----- Method: StrikeFont>>maxAscii (in category 'accessing') -----
maxAscii
- "Answer the integer that is the last Ascii character value of the receiver."
+ self flag: #deprecated.
+ ^ self maxCodePoint!
- ^maxAscii!
Item was added:
+ ----- Method: StrikeFont>>maxCodePoint (in category 'accessing') -----
+ maxCodePoint
+ "Overwritten to configure ranges of glyphs per pre-rendered font."
+
+ ^maxAscii!
Item was changed:
----- Method: StrikeFont>>minAscii (in category 'accessing') -----
minAscii
- "Answer the integer that is the first Ascii character value of the receiver."
+ self flag: #deprecated.
+ ^ self minCodePoint!
- ^minAscii!
Item was added:
+ ----- Method: StrikeFont>>minCodePoint (in category 'accessing') -----
+ minCodePoint
+ "Overwritten to configure ranges of glyphs per pre-rendered font."
+
+ ^minAscii!
Christoph Thiede uploaded a new version of Environments to project The Treated Inbox:
http://source.squeak.org/treated/Environments-ct.84.mcz
==================== Summary ====================
Name: Environments-ct.84
Author: ct
Time: 27 January 2022, 1:45:50.290256 am
UUID: 7d378970-f5d8-5242-b813-24773d22d10a
Ancestors: Environments-ct.83
Accelerates queries like "browse my changes" *significantly*. Is this an appropriate place or should this go into the SystemNavigation instead?
=============== Diff against Environments-ct.83 ===============
Item was changed:
----- Method: Environment>>allClassesAndTraitsDo: (in category 'classes and traits') -----
allClassesAndTraitsDo: aBlock
+ CurrentReadOnlySourceFiles cacheDuring:
+ [declarations keysAndValuesDo:
+ [:key :value |
+ ((value isBehavior) and: [key == value name]) ifTrue:
+ [aBlock value: value]]]!
- declarations keysAndValuesDo:
- [:key :value |
- ((value isBehavior) and: [key == value name]) ifTrue:
- [aBlock value: value]]!