Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1867.mcz
==================== Summary ====================
Name: Morphic-mt.1867
Author: mt
Time: 5 February 2022, 8:38:14.914233 am
UUID: 65f30102-4d0b-5b41-b10d-66aa2dc38960
Ancestors: Morphic-mt.1866
Fixes that annoying issue in multi-window windows where that (invisible) button for choosing your model was made inaccessible when, for example, switching UI themes.
Thanks to Eliot (eem) for reporting this!
=============== Diff against Morphic-mt.1866 ===============
Item was added:
+ ----- Method: PluggableSystemWindowWithLabelButton>>replaceBoxes (in category 'initialization') -----
+ replaceBoxes
+
+ super replaceBoxes.
+ labelButton comeToFront.!
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1866.mcz
==================== Summary ====================
Name: Morphic-mt.1866
Author: mt
Time: 3 February 2022, 4:58:18.363576 pm
UUID: 5d2d9711-dbfa-5d44-a2e5-f29b0a081d60
Ancestors: Morphic-mt.1865
Fixes a regression in TextMorph, which must support #font: without having any contents/text configured.
Thanks to Christoph (ct) for the pointer.
=============== Diff against Morphic-mt.1865 ===============
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.
!! It is best practice to work with #textStyle: and rely on the text attributes TextFontChange and (sometimes) TextFontReference."
+ self text ifNotNil: [
+ self text removeAttributesThat: [:attr | attr isTextFontChange and: [attr canFontBeSubstituted]].
- self text removeAttributesThat: [:attr | attr isTextFontChange and: [attr canFontBeSubstituted]].
+ aFont emphasis ~= 0 ifTrue: [
+ self text addAttribute: (TextEmphasis new emphasisCode: aFont emphasis; yourself)]].
- aFont emphasis ~= 0 ifTrue: [
- self text addAttribute: (TextEmphasis new emphasisCode: aFont emphasis; yourself)].
self textStyle: aFont asNewTextStyle.!
Marcel Taeumel uploaded a new version of TrueType to project The Trunk:
http://source.squeak.org/trunk/TrueType-mt.61.mcz
==================== Summary ====================
Name: TrueType-mt.61
Author: mt
Time: 3 February 2022, 4:41:36.830061 pm
UUID: 1d2cd5ad-a073-8142-9e1b-1926a91d7343
Ancestors: TrueType-mt.60
Adds missing selector. Sorry for the noise.
=============== Diff against TrueType-mt.60 ===============
Item was added:
+ ----- Method: TTFileDescription>>unitsPerEm (in category 'accessing') -----
+ unitsPerEm
+
+ ^unitsPerEm!
Marcel Taeumel uploaded a new version of MultilingualTests to project The Trunk:
http://source.squeak.org/trunk/MultilingualTests-mt.38.mcz
==================== Summary ====================
Name: MultilingualTests-mt.38
Author: mt
Time: 3 February 2022, 4:32:56.405027 pm
UUID: 0cd9e92d-e797-3547-b7c4-bd46de0fd9ab
Ancestors: MultilingualTests-pre.37
Fixes paragraph test. The box needs to be bigger to account for a bigger default system font. Maybe we can further rewrite this test to not use "TextStyle default" in the first place.
=============== Diff against MultilingualTests-pre.37 ===============
Item was changed:
----- Method: FontTest>>testParagraphFallback (in category 'tests') -----
testParagraphFallback
"self debug: #testParagraphFallback"
| text p style height width e expect |
e := (Character value: 257) asString.
text := ('test' , e , e , e , e , 'test') asText.
expect := 'test????test'.
p := NewParagraph new.
style := TextStyle default.
p
compose: text
style: style
from: 1
+ in: (0 @ 0 corner: 1000000 @ 1000000).
- in: (0 @ 0 corner: 100 @ 100).
"See CompositionScanner>>setActualFont: &
CompositionScanner>>composeFrom:inRectangle:firstLine:leftSide:rightSide:"
height := style defaultFont height + style leading.
width := (expect
inject: 0
into: [:tally :next | tally
+ (style defaultFont widthOf: next)]) + p caretWidth.
p adjustRightX.
self assert: p extent = (width @ height).
"Display getCanvas
paragraph: p
bounds: (10 @ 10 extent: 100 @ 100)
color: Color black"!
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1865.mcz
==================== Summary ====================
Name: Morphic-mt.1865
Author: mt
Time: 3 February 2022, 4:29:43.140027 pm
UUID: 36bb0484-8771-7347-8df0-76a80dcf9a71
Ancestors: Morphic-mt.1864
Extends FontImporterTool to be able to browse a font before installing it and be able to delete a font that is already installed.
Fixes some issues in FontImporterTool and TextEditor.
Builds upon Graphics-mt.471, TrueType-mt.60, and System-mt.1300
=============== Diff against Morphic-mt.1864 ===============
Item was added:
+ ----- Method: FontImporterTool>>browseImported (in category 'actions') -----
+ browseImported
+
+ | filenames fonts ttcFonts |
+ fonts := self currentSelection.
+ filenames := fonts allFilenames.
+
+ ttcFonts := filenames gather: [:ea |
+ (TTCFontReader readTTFFrom: (FileStream readOnlyFileNamed: ea))
+ collect: [:descr | TTCFont new ttcDescription: descr; pointSize: TextStyle defaultFont pointSize; yourself]].
+
+ ttcFonts do: [:ea | ea browseAllGlyphs].!
Item was added:
+ ----- Method: FontImporterTool>>browseLinked (in category 'actions') -----
+ browseLinked
+
+ | filenames fonts ttcFonts |
+ fonts := self currentSelection.
+ filenames := fonts allFilenames.
+
+ ttcFonts := filenames gather: [:ea |
+ (TTFileDescription readFontsFrom: ea)
+ collect: [:descr | TTCFont new ttcDescription: descr; pointSize: TextStyle defaultFont pointSize; yourself]].
+
+ ttcFonts do: [:ea | ea browseAllGlyphs].!
Item was added:
+ ----- Method: FontImporterTool>>delete (in category 'actions') -----
+ delete
+
+ | font |
+ (font := self selectedFont) textStyleOrNil ifNotNil: [:style |
+ TextConstants removeKey: font familyName].
+ self allFonts: nil. "force redraw"
+ TTCFont registerAll.!
Item was changed:
----- Method: FontImporterTool>>font:hasGlyphOf: (in category 'helper') -----
font: f hasGlyphOf: aCharacter
| font |
font := f isFontSet ifTrue: [f fontArray first] ifFalse: [f].
+ ^ font hasGlyphOf: aCharacter!
- ^ font isTTCFont
- ifFalse: [font hasGlyphOf: aCharacter]
- ifTrue: [
- " [(f hasGlyphOf: aCharacter) not] does not work, the fallback glyph is always found instead.
- So we fake. if aCharacter is the same form as Character null aka 0, we assume absence."
- (font characterFormAt: aCharacter) bits ~= font fallbackForm bits]
- !
Item was changed:
----- Method: FontImporterTool>>fontFromFamily: (in category 'helper') -----
fontFromFamily: aFamily
| readFonts |
+ aFamily ifNil: [^ TextStyle defaultFont].
- aFamily ifNil: [^ TextStyle default fonts first].
readFonts := TTFileDescription readFontsFrom: aFamily allFilenames anyOne.
^ (readFonts size > 1
ifTrue: [
| ftArray |
" see TTCFontSet>>newTextStyleFromTT: "
ftArray := readFonts collect: [:ttc | |f|
ttc ifNil: [nil] ifNotNil: [
f := TTCFont new.
f ttcDescription: ttc.
f pointSize: TextStyle defaultFont pointSize.
f]].
TTCFontSet newFontArray: ftArray]
ifFalse: [ |f|
f := TTCFont new.
f ttcDescription: readFonts anyOne.
f pointSize: TextStyle defaultFont pointSize.
f])!
Item was changed:
----- Method: FontImporterTool>>fontListMenu: (in category 'font list') -----
fontListMenu: aMenu
^ aMenu addTranslatedList: #(
+ ('Browse Font (imported)' browseImported 'Import and browse all available glyphs')
+ ('Browse Font (linked)' browseLinked 'Browse all available glyphs')
+ -
+ ('Install Font (imported)' import 'Include the font data in the image and provide a TextStyle for the font')
+ ('Install Font (linked)' link 'Install the font as a link to its file and provide a TextStyle for the referenced font')
+ ), (self selectedFont textStyleOrNil ifNil: [#()] ifNotNil: [#(
+ -
+ ('Delete Font' delete 'Remove imported font data or link to font from the system')
+ )])
- ('Import Font' import 'Include the font data in the image and provide a TextStyle for the font')
- ('Link Font' link 'Install the font as a link to its file and provide a TextStyle for the referenced font'))
yourself!
Item was changed:
----- Method: FontImporterTool>>textForFamily:subfamily: (in category 'helper') -----
textForFamily: familyName subfamily: subfamilyName
subfamilyName ifNil: [
+ ^ (TextStyle named: (familyName copyWithout: Character space))
- ^ (TextStyle named: familyName)
ifNil: [familyName]
ifNotNil: [:style | style isTTCStyle
ifTrue: ["we are already present "
Text string: familyName attribute: TextEmphasis underlined]
ifFalse: [familyName]]].
" frome here on it is only about subfamilies"
(self isStyleNameSupported: subfamilyName)
ifFalse: [^ Text string: subfamilyName attribute: TextColor gray].
^ (TextStyle named: familyName)
ifNil: ["importable" subfamilyName]
ifNotNil: [:style |
(style isTTCStyle and: [ | regular emph |
regular := style fonts anyOne.
emph := TTCFont indexOfSubfamilyName: subfamilyName.
" detect if this style is already imported "
regular emphasis = emph or: [(regular emphasis: emph) ~= regular]])
ifFalse: ["again importable" subfamilyName]
ifTrue: [Text string: subfamilyName attribute: TextEmphasis underlined]]!
Item was changed:
----- Method: TextEditor>>changeSelectionFontTo: (in category 'attributes') -----
changeSelectionFontTo: aFont
| attr |
aFont ifNil: [ ^ self ].
attr := TextFontReference toFont: aFont.
self openTypeIn.
paragraph text
addAttribute: attr
+ from: (self hasSelection
+ ifTrue: [ self startIndex ]
+ ifFalse: [ 1 ])
- from: self startIndex
to:
(self hasSelection
ifTrue: [ self stopIndex - 1 min: paragraph text size ]
ifFalse: [ paragraph text size ]).
self closeTypeIn.
paragraph composeAll.
self recomputeSelection.
morph changed!
Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1300.mcz
==================== Summary ====================
Name: System-mt.1300
Author: mt
Time: 3 February 2022, 4:27:27.276027 pm
UUID: 6bb978c2-9714-c846-b94b-4166a25fae48
Ancestors: System-dtl.1299
Complements Graphics-mt.471
=============== Diff against System-dtl.1299 ===============
Item was changed:
----- Method: TextStyle>>addNewFontSize: (in category '*System-Fonts') -----
addNewFontSize: pointSize
"Add a font in specified size to the array of fonts."
+ | f d newArray t isSet priorDefault |
- | f d newArray t isSet |
fontArray first emphasis ~= 0 ifTrue: [
t := TextConstants at: self fontArray first familyName asSymbol.
t fonts first emphasis = 0 ifTrue: [
^ t addNewFontSize: pointSize.
].
].
pointSize <= 0 ifTrue: [^ nil].
fontArray do: [:s |
s pointSize = pointSize ifTrue: [^ s].
].
(isSet := fontArray first isKindOf: TTCFontSet)
ifTrue:[
| fonts |
fonts := fontArray first fontArray collect: [ :font |
| newFont |
(font isNil)
ifTrue: [newFont := nil]
ifFalse: [
newFont := (font ttcDescription size > 256)
ifTrue: [MultiTTCFont new initialize]
ifFalse: [TTCFont new initialize].
newFont ttcDescription: font ttcDescription.
+ newFont pointSize: pointSize.
- newFont pixelSize: pointSize * 96 // 72.
font derivativeFonts notEmpty ifTrue: [font derivativeFonts do: [ :proto |
proto ifNotNil: [
d := proto class new initialize.
d ttcDescription: proto ttcDescription.
d pixelSize: newFont pixelSize.
newFont derivativeFont: d]]].
].
newFont].
f := TTCFontSet newFontArray: fonts]
ifFalse: [
f := fontArray first class new initialize: fontArray first.
f pointSize: pointSize.
fontArray first derivativeFonts do: [:proto |
proto ifNotNil: [
d := TTCFont new initialize: proto.
d pointSize: f pointSize.
f derivativeFont: d.
].
].
].
newArray := (fontArray copyWith: f) asArray sort: [:a :b | a pointSize <= b pointSize].
+ priorDefault := self defaultFont pointSize.
self newFontArray: newArray.
+ self defaultFontIndex: (self fontIndexOfPointSize: priorDefault).
isSet ifTrue: [
TTCFontSet register: newArray at: newArray first familyName asSymbol.
].
^ self fontOfPointSize: pointSize
!
Item was changed:
----- Method: UserInterfaceTheme>>installSystemFont: (in category 'private - fonts') -----
installSystemFont: aFont
+ "Establish the default text font and style. Update the #defaultFontIndex in all known text styles to reflect the system's new default point size."
- "Establish the default text font and style"
| aStyle |
self flag: #todo. "mt: Support derivatives such as bold and italic."
aStyle := aFont textStyle.
aStyle defaultFontIndex: (aStyle fontIndexOfPointSize: aFont pointSize "drop emphasis").
TextStyle setDefault: aStyle.
+ TextStyle actualTextStyles "no defaults" do: [:ea |
+ ea isTTCStyle ifTrue: [ea defaultFont asPointSize: aFont pointSize "May generate new pointSize"].
+ ea defaultFontIndex: (ea fontIndexOfPointSize: aFont pointSize)].
+
RealEstateAgent resetScaleFactor.
Flaps replaceToolsFlap.
ScriptingSystem resetStandardPartsBin.!
Item was changed:
+ (PackageInfo named: 'System') postscript: '"Add missing sTypo values for our Bitstream Vera fonts."
+ TTFontDescription allInstancesDo: [:ea | (ea familyName beginsWith: ''Bitstream Vera'')
+ ifTrue: [ea setTypographicAscender: 1556 descender: -492 lineGap: 410 ]].
+
+ "Update #leading in all text styles using the default font''s #lineGap. Also remove all cached glyphs."
+ AbstractFont allSubInstancesDo: [ :font | font pixelsPerInchChanged ].
+ TextStyle allInstancesDo: [ :style | style pixelsPerInchChanged ].
+
+ "Fix default font sizes in existing text styles according to the current UserInterfaceTheme."
+ UserInterfaceTheme current installSystemFont: TextStyle defaultFont.'!
- (PackageInfo named: 'System') postscript: 'SystemNavigation initializeAuthors.
- AbstractFont setupDefaultFallbackTextStyle.'!
Marcel Taeumel uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-mt.471.mcz
==================== Summary ====================
Name: Graphics-mt.471
Author: mt
Time: 3 February 2022, 4:26:11.420027 pm
UUID: 944bb575-2b2c-e14f-99ea-88876b34a5cc
Ancestors: Graphics-mt.470
Various fixes and improvements around font rendering:
- Imported fonts now have the current system's point size by default
- Fixes very old #lineGap/#leading issue concering TrueType fonts
- Fixes very old #ascent/#height issue concerning TrueType fonts
- Adds extra TrueType scaling so improve the quality of imported fonts that have too small glyphs by default; see commentary in #extraScale:; may be tweaked per font
- Makes #lineGap in StrikeFonts adapt with their point size, min. 1 pixel
- Adds missing sTypo* properties for our BitstreamVera font families to actually now have a #lineGap
- Improve "Font Size Summary" page in help browser
- Removes fallback-glyph-drawing code from TTCGlyph because fallback glyphs are organized at a higher level in AbstractFont via FixedFaceFont; see #fallbackFont
- Speed up TTCFont >> #hasGlyphOf:
=============== Diff against Graphics-mt.470 ===============
Item was added:
+ ----- Method: AbstractFont>>asPointSize: (in category 'converting') -----
+ asPointSize: differentPointSize
+ "Convert the receiver into a different point size. Compared to #pointSize:, this operation does not modify the receiver but tries to lookup another font object or create one on-the-fly."
+
+ self pointSize = differentPointSize ifTrue: [^ self].
+
+ ^ self class
+ familyName: self familyName
+ pointSize: differentPointSize
+ emphasized: self emphasis!
Item was added:
+ ----- Method: AbstractFont>>lineGap (in category 'accessing') -----
+ lineGap
+
+ ^ 2 "pre-rendered legacy fonts"!
Item was changed:
----- Method: AbstractFont>>lineGrid (in category 'accessing') -----
lineGrid
"Answer the relative space between lines"
+ ^ self height + self lineGap!
- ^self subclassResponsibility!
Item was added:
+ ----- Method: AbstractFont>>maxAscii (in category 'accessing') -----
+ maxAscii
+
+ self flag: #deprecated.
+ ^ self maxCodePoint!
Item was added:
+ ----- Method: AbstractFont>>minAscii (in category 'accessing') -----
+ minAscii
+
+ self flag: #deprecated.
+ ^ self minCodePoint!
Item was changed:
+ ----- Method: FixedFaceFont>>characterFormAt: (in category 'character shapes') -----
- ----- Method: FixedFaceFont>>characterFormAt: (in category 'accessing') -----
characterFormAt: character
^ baseFont characterFormAt: substitutionCharacter!
Item was added:
+ ----- Method: FixedFaceFont>>formOf: (in category 'private') -----
+ formOf: aCharacter
+ "No need to check #hasGlyphOf:."
+
+ ^ self characterFormAt: aCharacter!
Item was changed:
----- Method: FixedFaceFont>>initialize (in category 'initialize-release') -----
initialize
+
- "This used to be the default textstyle, but it needs to be a StrikeFont and not a TTCFont and sometimes the default textstyle is a TTCFont. So, we use a typical StrikeFont as the default fallback font."
baseFont := TextStyle defaultFont.
+ self passwordFont.!
- self passwordFont!
Item was removed:
- ----- Method: FixedFaceFont>>maxAscii (in category 'accessing') -----
- maxAscii
-
- self flag: #deprecated.
- ^ self maxCodePoint!
Item was changed:
AbstractFont subclass: #StrikeFont
+ instanceVariableNames: 'characterToGlyphMap xTable glyphs name type minAscii maxAscii maxWidth strikeLength ascent descent xOffset raster subscript superscript emphasis derivativeFonts pointSize fallbackFont charIndexCompatibilitySlot lineGap'
- instanceVariableNames: 'characterToGlyphMap xTable glyphs name type minAscii maxAscii maxWidth strikeLength ascent descent xOffset raster subscript superscript emphasis derivativeFonts pointSize fallbackFont charIndexCompatibilitySlot'
classVariableNames: 'DefaultStringScanner'
poolDictionaries: 'TextConstants'
category: 'Graphics-Fonts'!
!StrikeFont commentStamp: 'fbs 11/28/2013 08:50' prior: 0!
I represent a compact encoding of a set of Forms corresponding to characters in the ASCII character set. All the forms are placed side by side in a large form whose height is the font height, and whose width is the sum of all the character widths. The xTable variable gives the left-x coordinates of the subforms corresponding to the glyphs. Characters are mapped to glyphs by using the characterToGyphMap.
Subclasses can have non-trivial mapping rules as well as different representations for glyphs sizes (e.g., not using an xTable). If so, these classes should return nil when queried for xTable and/or the characterToGlyphMap. This will cause the CharacterScanner primitive to fail and query the font for the width of a character (so that a more programatical approach can be implemented).
For display, fonts need to implement two messages:
#installOn: aDisplayContext foregroundColor: foregroundColor backgroundColor: backgroundColor
This method installs the receiver (a font) on the given DisplayContext (which may be an instance of BitBlt or Canvas (or any of its subclasses). The font should take the appropriate action to initialize the display context so that further display operations can be optimized.
#displayString: aString on: aDisplayContext from: startIndex to: stopIndex at: aPoint kern: kernDelta
This method is called for each subsequent run of characters in aString which is to be displayed with the (previously installed) settings.
!
Item was changed:
+ ----- Method: StrikeFont>>basicHasGlyphOf: (in category 'private') -----
- ----- Method: StrikeFont>>basicHasGlyphOf: (in category 'multibyte character methods') -----
basicHasGlyphOf: aCharacter
^ self hasGlyphForCode: (self codeForCharacter: aCharacter)
!
Item was added:
+ ----- Method: StrikeFont>>formOf: (in category 'private') -----
+ formOf: aCharacter
+ "Like #characterFormAt: but checks for #hasGlyphOf: and supports #fallbackFont."
+
+ (self hasGlyphOf: aCharacter)
+ ifFalse: [^ self fallbackFont formOf: aCharacter].
+
+ ^ self characterFormAt: aCharacter!
Item was changed:
+ ----- Method: StrikeFont>>glyphOf: (in category 'private') -----
- ----- Method: StrikeFont>>glyphOf: (in category 'accessing') -----
glyphOf: aCharacter
- "Answer the width of the argument as a character in the receiver."
+ self flag: #deprecated.
+ ^ self formOf: aCharacter!
- | code |
- (self hasGlyphOf: aCharacter)
- ifFalse: [^ self fallbackFont glyphOf: aCharacter].
- code := self codeForCharacter: aCharacter.
- ^ glyphs copy: (((xTable at: code + 1)@0) corner: (xTable at: code +2)@self height).
- !
Item was changed:
+ ----- Method: StrikeFont>>hasGlyphForCode: (in category 'private') -----
- ----- 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!
Item was added:
+ ----- Method: StrikeFont>>lineGap (in category 'accessing') -----
+ lineGap
+ "Historical. The #lineGap has been 2 pixels for all fonts in the system for a very long time. Since the #referenceHeight is 14 pixels, use that to compute a #lineGap relative to the receivers #pointSize/#pixelSize. Also see TTCFont >> #lineGap."
+
+ ^ lineGap ifNil: [lineGap := ((self height asFloat / self class referenceHeight) * 2 "pixels") rounded]!
Item was removed:
- ----- Method: StrikeFont>>lineGrid (in category 'accessing') -----
- lineGrid
- ^ ascent + descent!
Item was removed:
- ----- Method: StrikeFont>>maxAscii (in category 'accessing') -----
- maxAscii
-
- self flag: #deprecated.
- ^ self maxCodePoint!
Item was removed:
- ----- Method: StrikeFont>>minAscii (in category 'accessing') -----
- minAscii
-
- self flag: #deprecated.
- ^ self minCodePoint!
Item was changed:
----- Method: TextStyle class>>actualTextStyles (in category 'TextConstants access') -----
actualTextStyles
| aDict |
"TextStyle actualTextStyles"
"Answer dictionary whose keys are the names of styles in the system and whose values are the actual styles"
aDict := TextConstants select: [:thang | thang isKindOf: self ].
+ self defaultFamilyNames do: [ :sym | aDict removeKey: sym ifAbsent: [] ].
- self defaultFamilyNames do: [ :sym | aDict removeKey: sym ].
^ aDict!
Item was changed:
----- Method: TextStyle class>>fontSizeSummaryContents (in category 'utilities') -----
fontSizeSummaryContents
+ ^ Text streamContents: [:aStream |
+ | knownStyles knownTTCStyles knownLegacyStyles defaultStyles printBlock |
+ knownStyles := self knownTextStylesWithoutDefault sorted.
+ defaultStyles := self defaultFamilyNames sorted.
+
+ aStream nextPutAll: ('This page lists all known text styles and for each style''s font the available point sizes. Most text fields offer the {1} where you can choose a different font or point size. Note that you can use any new point size for TrueType fonts. This is, however, not possible for our pre-rendred legacy fonts. If you need more fonts, use the {2} to import TrueType fonts from your current platform. Click {3} to browse all styles by example.\\'
+ translated withCRs asText format: {
+ 'FontChooserTool' asText
+ addAttribute: (PluggableTextAttribute evalBlock: [FontChooserTool open]); yourself.
+ 'FontImporterTool' asText
+ addAttribute: (PluggableTextAttribute evalBlock: [FontImporterTool open]); yourself.
+ 'here' asText
+ addAttribute: (PluggableTextAttribute evalBlock: [TextStyle browseAllStyles])}).
+
+ defaultStyles do: [:styleName |
+ | style prefix |
+ style := self named: styleName.
+ prefix := (style isNil or: [(self named: style defaultFamilyName) == style]) ifTrue: [''] ifFalse: [' !! '].
+ aStream
+ nextPutAll: (((styleName padded: #left to: 24 with: Character space), ': ', prefix) asText addAttribute: (TextFontReference toFont: TextStyle defaultFixedFont); yourself);
+ nextPutAll: (style ifNil: ['-'] ifNotNil: [(style defaultFamilyName asText addAttribute: (TextFontReference toFont: style defaultFont); addAttribute: (PluggableTextAttribute evalBlock: [style explore]); yourself)]);
+ cr].
+
+ printBlock := [:styleName |
+ | style defaultFont preferredPointSize exampleFont |
+ style := self named: styleName.
+ preferredPointSize := TextStyle defaultFont pointSize. "system's current default"
+ defaultFont := style defaultFont. "style's current default"
+ exampleFont := defaultFont asPointSize: preferredPointSize.
+ aStream
+ nextPutAll: (styleName asText addAttribute: (TextFontReference toFont: exampleFont)).
+ styleName ~= style defaultFamilyName ifTrue: ["style alias"
+ aStream nextPutAll: ' (', style defaultFamilyName, ')'].
+
+ aStream
+ nextPutAll: ((Text new,
+ ((style isTTCStyle ifFalse: [''] ifTrue: [ | es tt |
+ ' TrueType',
+ ((tt := style defaultFont ttcDescription) isExternal ifFalse: [''] ifTrue: [' (extern)']),
+ ((es := tt extraScale) > 1.0 ifFalse: [''] ifTrue: [' ', (es * 100) rounded asString, '%'])] ) asText addAttribute: (TextColor color: ((self userInterfaceTheme get: #balloonTextColor for: #PluggableTextMorphPlus) ifNil: [Color gray])); yourself),
+ ' ... ',
+ ('explore' translated asText addAttribute: (PluggableTextAttribute evalBlock: [style explore]); yourself),
+ ' ',
+ ('browse' translated asText addAttribute: (PluggableTextAttribute evalBlock: [defaultFont browseAllGlyphs]); yourself),
+
+ ' ') addAttribute: (TextFontReference toFont: Preferences standardButtonFont); yourself);
+ cr.
+ aStream nextPutAll: (((self fontPointSizesFor: styleName) inject: ' ' asText into: [:text :pointSize |
+ pointSize = defaultFont pointSize
+ ifFalse: [text, ((pointSize asFloat printShowingDecimalPlaces: 1) padded: #left to: 5 with: Character space)]
+ ifTrue: [text, (((pointSize asFloat printShowingDecimalPlaces: 1) padded: #left to: 5 with: Character space) asText addAttribute: TextEmphasis bold; yourself)]]) addAttribute: (TextFontReference toFont: TextStyle defaultFixedFont); yourself).
+ aStream cr; cr].
+
+ knownTTCStyles := knownStyles select: [:ea | (self named: ea) isTTCStyle].
+ knownLegacyStyles := knownStyles reject: [:ea | (self named: ea) isTTCStyle].
+
+ aStream cr.
+ knownTTCStyles do: printBlock.
+ aStream nextPutAll: ('The following pre-rendered legacy fonts are still available. Note that you can only choose from the point sizes that are listed here. Each point size has a pixel size for 96 PPI. The system scales currently for {1} PPI.' translated format: {TextStyle pixelsPerInch}) ; cr; cr.
+ knownLegacyStyles do: printBlock.
+ ].!
- ^ Text streamContents:
- [:aStream |
- self knownTextStyles do: [:aStyleName |
- aStream nextPutAll:
- (aStyleName asText addAttribute: (TextFontReference toFont: (TextStyle named: aStyleName) defaultFont)), ' ',
- (self fontPointSizesFor: aStyleName) asArray storeString.
- aStream cr]].!
Item was changed:
----- Method: TextStyle class>>pixelsPerInch: (in category 'utilities') -----
pixelsPerInch: aNumber
"Set the nominal number of pixels per inch to aNumber."
self pixelsPerInch = aNumber ifTrue: [^ self].
TextConstants at: #pixelsPerInch put: aNumber.
+ AbstractFont allSubInstancesDo: [ :font | font pixelsPerInchChanged ].
+ TextStyle allInstancesDo: [ :style | style pixelsPerInchChanged ].!
- AbstractFont allSubInstancesDo: [ :font | font pixelsPerInchChanged ].!
Item was changed:
----- Method: TextStyle>>consistOnlyOf: (in category 'fonts and font indexes') -----
consistOnlyOf: aFont
+
+ self deprecated.
+ ^ self newFontArray: {aFont}!
- fontArray := Array with: aFont.
- defaultFontIndex := 1!
Item was added:
+ ----- Method: TextStyle>>defaultFamilyName (in category 'accessing') -----
+ defaultFamilyName
+ ^ self defaultFont familyName!
Item was changed:
----- Method: TextStyle>>defaultFontIndex: (in category 'default font') -----
defaultFontIndex: anIndex
defaultFontIndex := anIndex.
+
+ leading := self defaultFont lineGap.
+ lineGrid := self defaultFont height + leading.
+ baseline := self defaultFont ascent + leading.!
- lineGrid := (fontArray at: defaultFontIndex) height + leading.
- baseline := (fontArray at: defaultFontIndex) ascent + leading.!
Item was added:
+ ----- Method: TextStyle>>pixelsPerInchChanged (in category 'notifications') -----
+ pixelsPerInchChanged
+ "The receiver's #lineGap is cached here."
+
+ self defaultFontIndex: self defaultFontIndex.!