Marcel Taeumel uploaded a new version of TrueType to project The Trunk:
http://source.squeak.org/trunk/TrueType-mt.74.mcz
==================== Summary ====================
Name: TrueType-mt.74
Author: mt
Time: 25 February 2022, 10:40:11.78063 am
UUID: ab1c5dc9-3363-e448-9bfa-c3c33f4a73fe
Ancestors: TrueType-mt.73
Step 3 of 2 :-D ... remove unused code.
=============== Diff against TrueType-mt.73 ===============
Item was changed:
Object subclass: #TTFileDescription
+ instanceVariableNames: 'fileName fileOffset familyName subfamilyName copyright ascender descender lineGap unitsPerEm numGlyphs indexToLocOffset indexToLocFormat glyphTableOffset cmapType cmapOffset numHMetrics hmtxTableOffset sTypoAscender sTypoDescender sTypoLineGap'
- instanceVariableNames: 'fileName fileOffset familyName subfamilyName copyright ascender descender lineGap unitsPerEm numGlyphs indexToLocOffset indexToLocFormat glyphTableOffset cmapType cmapOffset numHMetrics hmtxTableOffset sTypoAscender sTypoDescender sTypoLineGap extraScale extraGap'
classVariableNames: 'AllFontsAndFiles FontPaths OfferNonPortableFonts'
poolDictionaries: ''
category: 'TrueType-Fonts'!
!TTFileDescription commentStamp: 'ar 7/29/2009 22:18' prior: 0!
Contrary to TTFontDescritption, this class leaves true type files on disk and only reads the required portions when constructing glyphs. This avoids the need of reading the entire font into memory at the cost of having to hit disk whenever a glyph is requested.!
Item was removed:
- ----- Method: TTFileDescription>>extraGap (in category 'accessing') -----
- extraGap
- "See commenetary in TTFontDescription"
-
- ^ extraGap ifNil: [extraGap := TTFontDescription extraGapFor: self]!
Item was removed:
- ----- Method: TTFileDescription>>extraGap: (in category 'accessing') -----
- extraGap: anIntegerOrNil
- "Increase or decrease the receivers line gap"
-
- extraGap = anIntegerOrNil ifTrue: [^ self].
- extraGap := anIntegerOrNil.
- TTCFont allSubInstancesDo: [:font |
- font ttcDescription == self ifTrue: [font reset "keep glyph cache"]].
- TextStyle allInstancesDo: [:style | style reset].!
Item was removed:
- ----- Method: TTFileDescription>>extraScale (in category 'accessing') -----
- extraScale
-
- ^ extraScale ifNil: [extraScale := TTFontDescription extraScaleFor: self]!
Item was removed:
- ----- Method: TTFileDescription>>extraScale: (in category 'accessing') -----
- extraScale: aFloatOrNil
- "EXPERIMENTAL. See commentary in TTFontDescription"
-
- self extraScale = aFloatOrNil ifTrue: [^ self].
- extraScale := aFloatOrNil.
- TTCFont allSubInstancesDo: [:font |
- font ttcDescription == self ifTrue: [font flushCache]].!
Item was changed:
Object subclass: #TTFontDescription
+ instanceVariableNames: 'glyphTable glyphs kernPairs copyright familyName fullName subfamilyName uniqueName versionName postscriptName trademark bounds unitsPerEm ascender descender lineGap sTypoAscender sTypoDescender sTypoLineGap'
- instanceVariableNames: 'glyphTable glyphs kernPairs copyright familyName fullName subfamilyName uniqueName versionName postscriptName trademark bounds unitsPerEm ascender descender lineGap sTypoAscender sTypoDescender sTypoLineGap extraScale extraGap'
classVariableNames: 'Default Descriptions'
poolDictionaries: ''
category: 'TrueType-Fonts'!
!TTFontDescription commentStamp: '<historical>' prior: 0!
Holds a TrueType font in memory. Is used by TTSampleStringMorph as its font.
Class owns a default example. !
Item was removed:
- ----- Method: TTFontDescription class>>extraGapFor: (in category 'defaults') -----
- extraGapFor: ttcDescription
-
- ^ ttcDescription typographicLineGap = 0
- ifFalse: [0 "The font already provides. Users may override manually."]
- ifTrue: [(ttcDescription internalLeading * 0.5) truncated]!
Item was removed:
- ----- Method: TTFontDescription class>>extraScaleFor: (in category 'defaults') -----
- extraScaleFor: ttcDescription
- "Answers a factor for #extraScale for selected font families. They represent a trade-off between legibility and correctness. For now, use up about 50% of the room reserved for glyph features, i.e. #internalLeading. Our goal is to render comparable glyphs from different fonts in a similar size so that the system's readability of text is not impaired when mixing largely different fonts. In the end, glyphs sizes may still differ, but not as much."
-
- (ttcDescription familyName beginsWith: 'Bitstream Vera')
- ifTrue: [^ 1.059 "Squeak's optimized default TrueType font for scale factors 75% to 150%. The benchmark is whether the underscore glyph $_ is legible."].
-
- ^ 1.0 + ((ttcDescription internalLeading / ttcDescription unitsPerEm) * 0.5)!
Item was removed:
- ----- Method: TTFontDescription>>extraGap (in category 'accessing - metrics') -----
- extraGap
- "Answer the extra lineGap for the receiver. In combination with #extraScale, this property can be used to balance the legibility of different fonts used side-by-side with the same #pointSize."
-
- ^ extraGap ifNil: [extraGap := self class extraGapFor: self]!
Item was removed:
- ----- Method: TTFontDescription>>extraGap: (in category 'accessing - metrics') -----
- extraGap: anIntegerOrNil
- "Increase or decrease the receivers line gap"
-
- extraGap = anIntegerOrNil ifTrue: [^ self].
- extraGap := anIntegerOrNil.
- TTCFont allSubInstancesDo: [:font |
- font ttcDescription == self ifTrue: [font reset "keep glyph cache"]].
- TextStyle allInstancesDo: [:style | style reset].!
Item was removed:
- ----- Method: TTFontDescription>>extraScale (in category 'accessing - metrics') -----
- extraScale
- "
- TTCFont allSubInstancesDo: [:f | f ttcDescription extraScale: nil]
- "
- ^ extraScale ifNil: [extraScale := self class extraScaleFor: self]!
Item was removed:
- ----- Method: TTFontDescription>>extraScale: (in category 'accessing - metrics') -----
- extraScale: aFloatOrNil
- "EXPERIMENTAL. Increase the glyph size without increasing the pixel size for a certain point size. Consequently, if the scale factor is too large, you may notice overlapping and clipping artifacts."
-
- extraScale = aFloatOrNil ifTrue: [^ self].
- extraScale := aFloatOrNil.
- TTCFont allSubInstancesDo: [:font |
- font ttcDescription == self ifTrue: [font flushCache]].!
Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1313.mcz
==================== Summary ====================
Name: System-mt.1313
Author: mt
Time: 25 February 2022, 10:37:45.39663 am
UUID: fc3c8d83-1afd-7d41-8347-a215a8982ad0
Ancestors: System-mt.1312
Complements TrueType-mt.73
=============== Diff against System-mt.1312 ===============
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 |
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)
+ ifFalse: [f := fontArray first copyWithPointSize: pointSize]
ifTrue:[
| fonts |
+ self flag: #legacy. "mt: There should be no new instances of TTCFontSet (or StrikeFontSet) anymore."
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.
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].
+
- 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
!
Marcel Taeumel uploaded a new version of TrueType to project The Trunk:
http://source.squeak.org/trunk/TrueType-mt.72.mcz
==================== Summary ====================
Name: TrueType-mt.72
Author: mt
Time: 25 February 2022, 10:30:51.46363 am
UUID: 94aba991-6d64-304c-9759-2f6b86743889
Ancestors: TrueType-mt.71
Move extral scale/gap from TTFontDescription up to TTCFont -- Step 1 of 2
Make it a property of the particular font instance to not modify the original font data. Make it possible no rename a TTCFont's #familyName to install that font under a different #textStyleName to make it possible to have both the modified and the original font.
Thanks to Tobias (topa) for the idea! This fits better to our concept of TTCFont and how point sizes are managed.
=============== Diff against TrueType-mt.71 ===============
Item was added:
+ ----- Method: Form>>advanceWidth (in category '*TrueType-displaying') -----
+ advanceWidth
+ "Backwards compatibility wit TTGlyphForm. See TTCFont >> #widthOf:."
+
+ ^ width!
Item was added:
+ ----- Method: LinedTTCFont>>addLined: (in category 'initialize') -----
+ addLined: aTTCFont
+ "Ignore. I am already lined."
+
+ ^ self!
Item was changed:
AbstractFont subclass: #TTCFont
+ instanceVariableNames: 'ttcDescription pointSize foregroundColor cache derivatives fallbackFont height ascent descent colorToCacheMap lineGap lineGapSlice minCodePoint maxCodePoint extraGlyphScale extraLineGap'
- instanceVariableNames: 'ttcDescription pointSize foregroundColor cache derivatives fallbackFont height ascent descent colorToCacheMap lineGap lineGapSlice minCodePoint maxCodePoint'
classVariableNames: 'GlyphCacheData GlyphCacheIndex GlyphCacheReady GlyphCacheSize NamesToIndexes Registry Scale ShutdownList'
poolDictionaries: ''
category: 'TrueType-Fonts'!
!TTCFont commentStamp: 'nk 4/2/2004 11:32' prior: 0!
I represent a font that uses TrueType derived glyph. Upon a request for glyph for a character through a call to #formOf: (or #widthOf:), I first search corresponding glyph in the cache. If there is not, it creates a 32bit depth form with the glyph.
The cache is weakly held. The entries are zapped at full GC.
Structure:
ttcDescription TTFontDescription -- The Squeak data structure for a TrueType font data file.
pointSize Number -- Nominal Em size in points. Conversion to pixel sizes depends on the definition of TextStyle class>>pixelsPerInch.
foregroundColor Color -- So far, this font need to know the glyph color in cache.
cache WeakArray of <Color -> <Array(256) of glyph>>
derivatives Array -- stores the fonts in the same family but different emphasis.
!
Item was added:
+ ----- Method: TTCFont>>copyWithPointSize: (in category 'copying') -----
+ copyWithPointSize: newPointSize
+ "Copy the receiver to create a new point size. Note that the call to #asPointSize: might end up here."
+
+ | result |
+ result := self class new initialize: self.
+ result setPointSize: newPointSize.
+ result flushCache. "Hmpf. Initialize cache at some point ..."
+
+ self derivativeFonts do: [:proto |
+ proto ifNotNil: [ | d |
+ d := TTCFont new initialize: proto.
+ d setPointSize: newPointSize.
+ d flushCache. "Hmpf. Initialize cache at some point ..."
+ result derivativeFont: d]].
+
+ ^ result!
Item was added:
+ ----- Method: TTCFont>>extraGlyphScale (in category 'accessing') -----
+ extraGlyphScale
+ "Answers the additional scale factor that is applied when rendering the receiver's glyphs into forms. You can increase or decrease this scale to change the font's original point-size-to-visual-size mapping. For example, the visual #xHeight of multiple fonts can be adjusted to look more consistent side-by-side. In the case of #fallbackFont it makes sense to show the fallback glyph in a compatible size. There are fonts that greatly vary in their #xHeight when being rendered at the same point size. Another example is a low value of #pixelsPerInch where a slightly increase in glyph scale can improve legibility of some glyphs at smaller point sizes.
+
+ NOTE THAT this extra scale does not change the receiver's #pixelHeight. Consequently, if the scale factor is too large, you may notice overlapping and clipping artifacts. You may want to also adjust #extraLineGap to keep the font's overall aesthetics."
+
+ ^ extraGlyphScale ifNil: [extraGlyphScale := 1.0]!
Item was added:
+ ----- Method: TTCFont>>extraGlyphScale: (in category 'editing') -----
+ extraGlyphScale: aFloatOrNil
+ "See commentary in #extraGlyphScale. Enumerate all known point sizes and emphases."
+
+ | fontsToUpdate |
+ fontsToUpdate := self textStyleOrNil
+ ifNil: [{self} "not-yet-installed"]
+ ifNotNil: [:style | style fontArray "all point sizes"].
+
+ fontsToUpdate do: [:font | "All subfamilies / emphases"
+ font privateExtraGlyphScale: aFloatOrNil.
+ font derivativeFonts do: [:f | f privateExtraGlyphScale: aFloatOrNil ]].
+
+ TextStyle allInstancesDo: [:style |
+ (style fontArray anySatisfy: [:font | fontsToUpdate identityIncludes: font])
+ ifTrue: [ "Width of space and tabs might have changed."
+ style reset]].!
Item was added:
+ ----- Method: TTCFont>>extraLineGap (in category 'accessing') -----
+ extraLineGap
+ "Answers the extra line gap of the receiver in units-per-em (UPM). Which means that the description's #typographicLineGap can be adjusted or completely nullified. NOTE THAT you can adjust a text-style's #lineSpacing as an additional factor to modify such gaps per application instead of per font."
+
+ ^ extraLineGap ifNil: [extraLineGap := 0]!
Item was added:
+ ----- Method: TTCFont>>extraLineGap: (in category 'editing') -----
+ extraLineGap: aFloatOrNil
+ "See commentary in #extraLineGap. Enumerate all known point sizes and emphases."
+
+ | fontsToUpdate |
+ fontsToUpdate := self textStyleOrNil
+ ifNil: [{self} "not-yet-installed"]
+ ifNotNil: [:style | style fontArray "all point sizes"].
+
+ fontsToUpdate do: [:font | "All subfamilies / emphases"
+ font privateExtraLineGap: aFloatOrNil.
+ font derivativeFonts do: [:f | f privateExtraLineGap: aFloatOrNil ]].!
Item was changed:
----- Method: TTCFont>>familyName (in category 'accessing') -----
familyName
+ "Use the description's #name instead of #familyName to ignore separators. Can be overwritten by the particular receiver such as when changing a font's #extraGlyphScale."
- "Use #name instead of #familyName to ignore separators."
+ ^ familyName
+ ifNotNil: [familyName copyWithout: Character space]
+ ifNil: [ttcDescription name]!
- ^ ttcDescription name!
Item was added:
+ ----- Method: TTCFont>>familyName: (in category 'editing') -----
+ familyName: newNameOrNil
+ "See commentary in #familyName. Enumerate all known point sizes and emphases."
+
+ | fontsToUpdate |
+ fontsToUpdate := self textStyleOrNil
+ ifNil: [{self} "not-yet-installed"]
+ ifNotNil: [:style | style fontArray "all point sizes"].
+
+ fontsToUpdate do: [:font | "All subfamilies / emphases"
+ font privateFamilyName: newNameOrNil.
+ font derivativeFonts do: [:f | f privateFamilyName: newNameOrNil ]].!
Item was added:
+ ----- Method: TTCFont>>familyNameAsIs (in category 'accessing') -----
+ familyNameAsIs
+ "Answers the receiver's family name as-is, which means including all the spaces."
+
+ ^ familyName ifNil: [ttcDescription familyName]!
Item was changed:
----- Method: TTCFont>>initialize: (in category 'initialize') -----
+ initialize: aPrototypeTTCFont
+ "Initialize the receiver from aPrototypeTTCFont."
- initialize: aFont
self initialize.
+
+ ttcDescription := aPrototypeTTCFont ttcDescription.
+ pointSize := aPrototypeTTCFont pointSize.
+
+ familyName := aPrototypeTTCFont familyNameAsIs.
+ extraGlyphScale := aPrototypeTTCFont extraGlyphScale.
+ extraLineGap := aPrototypeTTCFont extraLineGap.!
- self ttcDescription: aFont ttcDescription.
- !
Item was added:
+ ----- Method: TTCFont>>isRemoteFont (in category 'testing') -----
+ isRemoteFont
+ "Answer whether this font fetches its glyph data from a remote location such as the file system."
+
+ ^ ttcDescription isRemoteFont!
Item was changed:
----- Method: TTCFont>>name (in category 'accessing') -----
name
+ "Overwritten just like StrikeFont does. Keep it simple and use my #familyName."
+ ^ self familyName!
- ^ ttcDescription name.
- !
Item was changed:
----- Method: TTCFont>>pixelScale (in category 'accessing') -----
pixelScale
"Answer the scale factor to convert from the truetype's units into the receiver's pixel size. Avoid the use of #typographicFontHeight to make receiver compatible with pixel-based rendering."
+ ^self pixelSize asFloat / ttcDescription fontHeight!
- ^self pixelSize asFloat / ttcDescription fontHeight
- "^ self pixelSize asFloat / ttcDescription typographicFontHeight"!
Item was changed:
+ ----- Method: TTCFont>>pixelSize: (in category 'editing') -----
- ----- Method: TTCFont>>pixelSize: (in category 'initialize') -----
pixelSize: aNumber
+ "Make sure that we don't yield too many point sizes."
+
+ self flag: #deprecated.
+ self pointSize: ((TextStyle pixelsToPoints: aNumber) roundTo: 0.5).
- "Make sure that we don't return a Fraction"
- self pointSize: (TextStyle pixelsToPoints: aNumber) rounded.
!
Item was changed:
+ ----- Method: TTCFont>>pointSize: (in category 'editing') -----
- ----- Method: TTCFont>>pointSize: (in category 'initialize') -----
pointSize: aNumber
+ "Modify the receiver's point size. NOTE THAT #asPointSize: will also give you the receiver's font (description) in a different size without modifying the receiver."
+
-
self privatePointSize: aNumber.
derivatives ifNotNil: [ derivatives do: [ :f | f ifNotNil: [ f privatePointSize: aNumber ]]].
!
Item was added:
+ ----- Method: TTCFont>>privateExtraGlyphScale: (in category 'editing') -----
+ privateExtraGlyphScale: aFloatOrNil
+ "See commentary in #extraGlyphScale."
+
+ extraGlyphScale = aFloatOrNil ifTrue: [^ self].
+ (aFloatOrNil isNil or: [aFloatOrNil > 0.0]) ifFalse: [^ self].
+
+ extraGlyphScale := aFloatOrNil.
+
+ "Discard cached glyph forms and pixel-sclaed font metrics."
+ self flushCache.!
Item was added:
+ ----- Method: TTCFont>>privateExtraLineGap: (in category 'editing') -----
+ privateExtraLineGap: anIntegerOrNil
+ "See commentary in #extraLineGap."
+
+ extraLineGap = anIntegerOrNil ifTrue: [^ self].
+ extraLineGap := anIntegerOrNil.
+
+ "Discard pixel-scaled font metrics but (!!) keep glyph cache."
+ self reset.!
Item was added:
+ ----- Method: TTCFont>>privateFamilyName: (in category 'editing') -----
+ privateFamilyName: newNameOrNil
+ "Rename the receiver to reflect custom edits such as #extraGlyphScale and #extraLineGap. Changing the name will override the receiver's #textStyleName and #familyName."
+
+ familyName := newNameOrNil.!
Item was changed:
----- Method: TTCFont>>scale (in category 'private') -----
scale
self flag: #deprecated.
+ ^ self pixelScale
- ^ self pixelSize / ttcDescription unitsPerEm
!
Item was added:
+ ----- Method: TTCFont>>setPointSize: (in category 'initialize') -----
+ setPointSize: aPointSize
+ "For fast initialization only. See #pointSize: and #asPointSize:."
+
+ pointSize := aPointSize.!
Item was added:
+ ----- Method: TTCFont>>setPointSize:familyName:extraGlyphScale:extraLineGap: (in category 'initialize') -----
+ setPointSize: aPointSize familyName: aString extraGlyphScale: aFloat extraLineGap: anInteger
+ "For fast initialization only. Tweak the receiver's font description with a custom scale and gap. Rename it to make that adjustments clear in tools. See #pointSize:, #familyName:, #extraGlyphScale:, and #extraLineGap: for later adjustments."
+
+ pointSize := aPointSize.
+
+ familyName := aString. "Override what's in #ttcDescription."
+ extraGlyphScale := aFloat.
+ extraLineGap := anInteger.!
Item was removed:
- ----- Method: TTFileDescription>>isExternal (in category 'testing') -----
- isExternal
- "Answer whether the receiver get's its data from an external file."
-
- ^ true!
Item was added:
+ ----- Method: TTFileDescription>>isRemoteFont (in category 'testing') -----
+ isRemoteFont
+ "Answer whether the receiver get's its data from an external file."
+
+ ^ true!
Item was added:
+ ----- Method: TTFileDescription>>renderGlyph:height:extraScale:fgColor:bgColor:depth: (in category 'rendering') -----
+ renderGlyph: code height: fontHeight extraScale: extraScale fgColor: fgColor bgColor: bgColor depth: depth
+ "Render the glyph with the given code point at the specified pixel height."
+
+ ^ self
+ renderGlyph: code height: fontHeight extraScale: extraScale
+ fgColor: fgColor bgColor: bgColor depth: depth
+ lineGlyph: nil lineGlyphWidth: 0 emphasis: 0!
Item was added:
+ ----- Method: TTFileDescription>>renderGlyph:height:extraScale:fgColor:bgColor:depth:lineGlyph:lineGlyphWidth:emphasis: (in category 'rendering') -----
+ renderGlyph: code height: fontHeight extraScale: extraScale fgColor: fgColor bgColor: bgColor depth: depth lineGlyph: lineGlyphOrNil lineGlyphWidth: lWidth emphasis: emphasis
+ "Render the glyph with the given code point at the specified pixel height. Underline it with lineGlyph."
+
+ | form pixelScale offset |
+ pixelScale := fontHeight asFloat / self fontHeight.
+ offset := 0 @ ( ((self ascender - (self ascender * extraScale)) * pixelScale) truncated ).
+ form := (self at: code)
+ asFormWithScale: pixelScale * extraScale
+ ascender: self ascender
+ descender: self descender
+ fgColor: fgColor bgColor: bgColor depth: depth
+ replaceColor: false
+ lineGlyph: lineGlyphOrNil lineGlyphWidth: lWidth
+ emphasis: emphasis.
+ form offset: form offset + offset.
+ ^ form!
Item was removed:
- ----- Method: TTFontDescription>>isExternal (in category 'testing') -----
- isExternal
- "Answer whether the receiver get's its data from an external file."
-
- ^ false!
Item was added:
+ ----- Method: TTFontDescription>>isRemoteFont (in category 'testing') -----
+ isRemoteFont
+ "Answer whether the receiver get's its data from an external file."
+
+ ^ false!
Item was changed:
----- Method: TTFontDescription>>name (in category 'accessing') -----
name
+ "Compact the receiver's #familyName to be used in index structures such as a font's #textStyle."
+
+ ^ self familyName copyWithout: Character space!
-
- ^ self familyName copyWithout: Character space.
- !
Item was added:
+ ----- Method: TTFontDescription>>renderGlyph:height:extraScale:fgColor:bgColor:depth: (in category 'rendering') -----
+ renderGlyph: code height: fontHeight extraScale: extraScale fgColor: fgColor bgColor: bgColor depth: depth
+ "Render the glyph with the given code point at the specified pixel height."
+
+ ^ self
+ renderGlyph: code height: fontHeight extraScale: extraScale
+ fgColor: fgColor bgColor: bgColor depth: depth
+ lineGlyph: nil lineGlyphWidth: 0 emphasis: 0!
Item was added:
+ ----- Method: TTFontDescription>>renderGlyph:height:extraScale:fgColor:bgColor:depth:lineGlyph:lineGlyphWidth:emphasis: (in category 'rendering') -----
+ renderGlyph: code height: fontHeight extraScale: extraScale fgColor: fgColor bgColor: bgColor depth: depth lineGlyph: lineGlyphOrNil lineGlyphWidth: lWidth emphasis: emphasis
+ "Render the glyph with the given code point at the specified pixel height. Underline it with lineGlyph."
+
+ | form pixelScale offset |
+ pixelScale := fontHeight asFloat / self fontHeight.
+ offset := 0 @ ( ((self ascender - (self ascender * extraScale)) * pixelScale) truncated ).
+ form := (self at: code)
+ asFormWithScale: pixelScale * extraScale
+ ascender: self ascender
+ descender: self descender
+ fgColor: fgColor bgColor: bgColor depth: depth
+ replaceColor: false
+ lineGlyph: lineGlyphOrNil lineGlyphWidth: lWidth
+ emphasis: emphasis.
+ form offset: form offset + offset.
+ ^ form!
Item was added:
+ Form subclass: #TTGlyphForm
+ instanceVariableNames: 'advanceWidth'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'TrueType-Fonts'!
+
+ !TTGlyphForm commentStamp: 'mt 2/19/2022 07:36' prior: 0!
+ I am a form that holds extra information about #advanceWidth in pixels.!
Item was added:
+ ----- Method: TTGlyphForm>>advanceWidth (in category 'accessing') -----
+ advanceWidth
+
+ ^ advanceWidth!
Item was added:
+ ----- Method: TTGlyphForm>>advanceWidth: (in category 'accessing') -----
+ advanceWidth: anObject
+
+ advanceWidth := anObject.!
Item was added:
+ ----- Method: TTGlyphForm>>initialize (in category 'initialize-release') -----
+ initialize
+
+ super initialize.
+ advanceWidth := 0.!
Eliot Miranda uploaded a new version of SystemReporter to project The Trunk:
http://source.squeak.org/trunk/SystemReporter-eem.57.mcz
==================== Summary ====================
Name: SystemReporter-eem.57
Author: eem
Time: 24 February 2022, 11:13:41.758845 am
UUID: 33cb7103-3c28-4a75-9660-5d1709c79c21
Ancestors: SystemReporter-mt.56
Accurately describe the meaning of bit 5 in vmParameter 65's Cog VM feature flags.
=============== Diff against SystemReporter-mt.56 ===============
Item was changed:
----- Method: SystemReporter>>reportVMParameters: (in category 'reporting') -----
reportVMParameters: aStream
| vmParameters isStack isCog isSpur |
self header: 'Virtual Machine Parameters' on: aStream.
vmParameters := Smalltalk vm getVMParameters.
isStack := (vmParameters at: 42 ifAbsent: [0]) ~= 0. "42 = number of stack pages available"
isCog := isStack and: [(vmParameters at: 46) ~= 0]. "46 is machine code zone size"
isSpur := isStack and: [(vmParameters at: 41) anyMask: 2r10000]. "41 is imageFormatVersion for the VM; bit 16 is the Spur bit"
(isSpur
ifFalse:
[#( 1 'size of old space'
2 'size of young+old space'
3 'size of memory'
4 'allocationCount'
5 'allocations between GCs')]
ifTrue:
[#( 1 'size of old space'
2 'used bytes in new space (used eden + used past space)'
3 'size of heap')]),
#( 6 'survivor count tenuring threshold'
7 'full GCs since startup'
8 'total milliseconds in full GCs since startup'),
(isSpur
ifFalse: [#( 9 'incremental GCs since startup'
10 'total milliseconds in incremental GCs since startup'
11 'tenures of surving objects since startup'),
{12 to: 19. 'specific to the translating VM'}]
ifTrue: [#( 9 'scavenging GCs since startup'
10 'total milliseconds in scavenging GCs since startup'
11 'tenures of surving objects since startup'
12 'event trace mask (for debugging input events)'
13 'VM ticker start microseconds (Croquet/QwaqVM)'
14 'VM ticker count (Croquet/QwaqVM)'
15 'VM ticker call count (Croquet/QwaqVM)'
16 'total microseconds in idle since startup'
17 'proportion of code zone available for use (Sista VMs only; read-write)'
18 'total milliseconds in full GC compaction since startup (a portion of parameter 8)'
19 'scavenge threshold; the effective size of eden')]),
#( 20 'utc microseconds at startup (if non-zero)'
21 'root/remembered table size (occupancy)'
22 'root/remembered table overflows since startup'
23 'bytes of extra memory to reserve for VM buffers, plugins, etc.'
24 'free memory threshold above which object memory will be shrunk'
25 'memory headroom when growing object memory'),
(isStack
ifFalse:
[#( 26 'interruptChecksEveryNms - force an ioProcessEvents every N milliseconds, in case the image is not calling getNextEvent often')]
ifTrue:
[#( 26 'heartbeat period (ms; see #58)')]),
(isSpur
ifFalse:
[#( 27 'number of times mark loop iterated for current IGC/FGC includes ALL marking'
28 'number of times sweep loop iterated for current IGC/FGC'
29 'number of times make forward loop iterated for current IGC/FGC'
30 'number of times compact move loop iterated for current IGC/FGC')]
ifTrue: [#()]),
#( 31 'number of grow memory requests'
32 'number of shrink memory requests'),
(isSpur
ifFalse:
[#( 33 'number of root table entries used for current IGC/FGC'
34 'number of allocations done before current IGC/FGC'
35 'number of survivor objects after current IGC/FGC'
36 'millisecond clock when current IGC/FGC completed'
37 'number of marked objects for Roots of the world, not including Root Table entries for current IGC/FGC'
38 'milliseconds taken by current IGC'
39 'Number of finalization signals for Weak Objects pending when current IGC/FGC completed')]
ifTrue:
[#( 33 'number of root table entries at last scavenge'
35 'number of survivor objects at last scavenge (if non-zero)'
36 'millisecond clock when current scavenge completed'
38 'milliseconds taken by current scavenge'
39 'Number of finalization signals for Weak Objects pending when current SGC/FGC completed')]),
#( 40 'VM word size - 4 or 8'),
(isStack
ifTrue:
[#(
41 'imageFormatVersion for the VM'
42 'number of stack pages available'
43 'desired number of stack pages (stored in image file header, max 65535)'
44 'size of eden, in bytes'
45 'desired size of eden, in bytes (stored in image file header)'
46 'machine code zone size, in bytes (0 in Stack VM)'
47 'desired machine code zone size (0 => default 1Mb to 2Mb depending on processor)'),
{ 48. 'Persistent image header flags\ bit 0: implies Process has threadId as its 4th inst var\ bit 1: if set, methods that are interpreted will have the flag bit set in their header\ bit 2: if set, implies preempting a process does not put it to the back of its run queue\ bit 3: if set, implies the GUI should run on the first thread and event queues should not be accessed from other threads\ bit 4: if set, implies the new finalization scheme where WeakArrays are queued\ bit 5: if set, implies wheel events will be delivered as such and not mapped to arrow key events\ bit 6: if set, implies arithmetic primitives will fail if given arguments of different types (float vs int)\ bit 7: if set, causes times delivered from file primitives to be in UTC rather than local time.' withCRs },
#( 49 'max size the image promises to grow the external semaphore table to'),
(isSpur
ifFalse:
[{ 50 to: 51. 'reserved for VM parameters that persist in the image (such as size of eden above)'.
52 to: 56. 'specific to Spur' }]
ifTrue:
[{ 50 to: 51. 'reserved for VM parameters that persist in the image (such as size of eden above)' },
#( 52 'root/remembered table capacity'
53 'number of old space segments'
54 'total free old space'
55 'ratio of growth and image size at or above which a GC will be performed post scavenge')]),
#( 56 'number of process switches since startup'
57 'number of ioProcessEvents calls since startup'
58 'number of forceInterruptCheck calls since startup'
59 'number of check event calls since startup'
60 'number of stack page overflows since startup'
61 'number of stack page divorces since startup'
62 'compiled code compactions since startup'),
(isCog
ifFalse:
[#()]
ifTrue:
[#( 63 'total milliseconds in compiled code compactions since startup'
64 'the number of methods that currently have jitted machine-code')]),
+ { 65. 'Cog feature flags\ bit 0: set if the VM supports MULTIPLE_BYTECODE_SETS.\ bit 1: set if the VM supports read-only objects (IMMUTABILITY).\ bit 2: set if the VM has an ITIMER_HEARTBEAT\ bit 3: set if the VM supports cross-platform BIT_IDENTICAL_FLOATING_POINT arithmetic\ bit 4: set if the VM can catch exceptions in FFI calls and answer them as primitive failures\ bit 5: set if the VM has primitives 568 and 578, versions of the suspend primitive which back up the process to before the wait if it was waiting on a condition variable' withCRs.
- { 65. 'Cog feature flags\ bit 0: set if the VM supports MULTIPLE_BYTECODE_SETS.\ bit 1: set if the VM supports read-only objects (IMMUTABILITY).\ bit 2: set if the VM has an ITIMER_HEARTBEAT\ bit 3: set if the VM supports cross-platform BIT_IDENTICAL_FLOATING_POINT arithmetic\ bit 4: set if the VM can catch exceptions in FFI calls and answer them as primitive failures\ bit 5: set if the VM''s suspend primitive backs up the process to before the wait if it was waiting on a condition variable' withCRs.
66. 'the byte size of a stack page'.},
(isSpur
ifFalse:
[{ 67 to: 69. 'reserved for more Cog-related info' }]
ifTrue:
[#( 67 'the maximum allowed size of old space (if zero there is no limit)'
68 'the average number of live stack pages when scanned by scavenge/gc/become'
69 'the maximum number of live stack pages when scanned by scavenge/gc/become')]),
#( 70 'the vmProxyMajorVersion (the interpreterProxy VM_MAJOR_VERSION)'
71 'the vmProxyMinorVersion (the interpreterProxy VM_MINOR_VERSION)'),
(isSpur
ifFalse: [#()]
ifTrue:
[#( 72 'milliseconds spent marking since startup'
73 'reserved for more Spur-related info'
74 'reserved for more Spur-related info'
75 'do mixed arithmetic; if false binary arithmetic primitives will fail unless receiver and argument are of the same type')]),
(isCog
ifFalse: [#()]
ifTrue: [#(76 'minimum unused bytes of headroom on all stack pages')])]
ifFalse:
[#()])
pairsDo: [:idx :desc | | value values |
(idx isInteger ifTrue: [idx] ifFalse: [idx last]) <= vmParameters size ifTrue:
[aStream nextPut: $#.
idx isInteger
ifTrue:
[value := vmParameters at: idx.
aStream
print: idx; tab: (idx < 10 ifTrue: [2] ifFalse: [1]);
nextPutAll: ((value isInteger and: [idx ~= 41])
ifTrue: [(desc includesSubstring: 'bit 0:')
ifTrue: [value printStringBase: 2 nDigits: value highBit]
ifFalse: [value asStringWithCommas]]
ifFalse: [value printString])]
ifFalse:
[value := vmParameters at: idx first.
aStream print: idx first; next: 2 put: $.; print: idx last; tab.
values := idx collect: [:i| vmParameters at: i].
values asSet size = 1
ifTrue: [aStream print: value]
ifFalse: [values do: [:v| aStream print: v] separatedBy: [aStream nextPutAll: ', ']]].
aStream tab; nextPutAll: desc; cr]]!