|
Class: FontPanel
Object
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--View
|
+--TopView
|
+--StandardSystemView
|
+--ModalBox
|
+--DialogBox
|
+--FontPanel
- Package:
- stx:libwidg
- Category:
- Views-DialogBoxes
- Version:
- rev:
1.157
date: 2019/06/11 09:47:16
- user: sr
- file: FontPanel.st directory: libwidg
- module: stx stc-classLibrary: libwidg
- Author:
- Claus Gittinger
this class implements the font chooser.
Notice:
this is a very old dialog;
it was written before the UI-framework was available and the UI is completely
programmed manually (see initialize method).
Therefore, it desperately asks to be rewritten using the UIPainter...
Font
FontDescription
View
Dialog
defaults
-
defaultAsciiSampleString
-
-
defaultExtent
-
return the default extent of my instances.
The value returned here is usually ignored, and
the value from preferredExtent taken instead.
-
defaultJIS0201SampleString
-
return the sample jis preview text
-
defaultJISSampleString
-
return the sample jis preview text
-
defaultLatin1SampleString
-
return the sample latin1 preview text
-
defaultSampleStringForEncoding: enc
-
substitute a default value for codes that cannot be represented
in the new character set
-
defaultUnicodeSampleString
-
return the sample unicode preview text
-
sampleStringWithAllLetters
-
help
-
helpSpec
-
menu specs
-
previewMenu
-
This resource specification was automatically generated
by the MenuEditor of ST/X.
usage example(s):
MenuEditor new openOnClass:FontPanel andSelector:#previewMenu
(Menu new fromLiteralArrayEncoding:(FontPanel previewMenu)) startUp
|
startup
-
fontFromUser
-
open a fontPanel and return the selected font,
or nil if abort is pressed
usage example(s):
-
fontFromUserInitial: aFont
-
open a fontPanel showing aFont initially,
and return the selected font, or nil if abort is pressed
usage example(s):
FontPanel fontFromUserInitial:(Font family:'courier' size:12)
FontPanel fontFromUserInitial:MenuPanel defaultFont
|
-
fontFromUserInitial: aFont title: someTitle
-
open a fontPanel with title and return the selected font,
or nil if abort is pressed
usage example(s):
FontPanel fontFromUserInitial:(Font family:'courier' size:12) title:'select some font'
|
-
fontFromUserInitial: initialFont title: someTitle filter: aFilterBlock
-
open a fontPanel with title and font-filter
and return the selected font, or nil if abort is pressed
usage example(s):
FontPanel fontFromUserInitial:(Font family:'courier' size:12) title:'select some font'
|
-
fontFromUserInitial: initialFont title: someTitle filter: aFilterBlock encoding: encoding
-
open a fontPanel with title and font-filter
and return the selected font, or nil if abort is pressed
usage example(s):
FontPanel fontFromUserInitial:(Font family:'courier' size:12) title:'select some font'
|
-
fontFromUserInitial: initialFont title: someTitle filter: aFilterBlock encoding: encoding enabled: enabled
-
open a fontPanel with title and font-filter
and return the selected font, or nil if abort is pressed
usage example(s):
FontPanel fontFromUserInitial:(Font family:'courier' size:12) title:'select some font'
|
-
fontFromUserInitial: initialFont title: someTitle filter: aFilterBlock encoding: encoding enabled: enabled onChangeAll: actionToChangeAll
-
open a fontPanel with title and font-filter
and return the selected font, or nil if abort is pressed
usage example(s):
FontPanel fontFromUserInitial:(Font family:'courier' size:12) title:'select some font'
|
-
openOn: aFont
-
open a fontPanel showing aFont initially.
This panel is for information only - no font selection is possible.
usage example(s):
FontPanel openOn:(Font family:'courier' size:12)
FontPanel openOn:MenuPanel defaultFont
FontPanel fontFromUser
|
accessing
-
action: aFourArgBlock
-
set the action to be evaluated on ok.
The block will be evaluated with family, face, style, size and encoding.
-
changeFontInAllViews
-
valid after closing
-
changeFontInAllViewsHolder
-
-
decorativeOnlyHolder
-
-
encoding: aPattern
-
set the encoding goal
-
encodingFilter: aOneArgBlockOrNil
-
set a filter
-
filter: aOneArgBlockOrNil
-
set a filter; if non-nil, only fonts for which the filterBlock
returns true will be offered
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
filterChanged
-
construct a combined a filter
-
initialFont: aFont
-
set the font to be selected initially
-
monospacedOnlyHolder
-
-
nonDecorativeOnlyHolder
-
-
nonMonospacedOnlyHolder
-
-
refreshFamilyList
-
-
withChangeFontInAllViewsCheckBoxVisibleHolder
-
-
withChangeFontInViewsAllCheckBox: aBoolean
-
to make that check box visible;
call before opening
-
xftFontsOnlyHolder
-
initialization
-
createFontSelectionBrowserIn: aView
-
-
enabled: aBoolean
-
FontPanel openOn:(Font family:'courier' size:12)
FontPanel openOn:MenuPanel defaultFont
FontPanel fontFromUser
-
initialize
-
sigh: hand-crafted box creation; TODO: rewrite using UI painter
-
listOfEncodingsInFilterCombo
-
-
postRealize
-
kludge for sco - xlsfont fails sometimes - try again here
-
previewMenu
-
-
showEncodingFilter
-
private
-
clearPreview
-
clear the preview subview
-
extractFaceAndStyleFrom: aString
-
given a string, extract currentFace and currentStyle
-
fontForPreview
-
get the preview font
-
getFacesForFamily: aFamilyName filtering: filter
-
the list of font faces for a given family
-
getFamilyList
-
the list of font families
-
getSizesInFamily: aFamilyName face: face style: style filtering: filter
-
(filteredFonts contains:[:fntDescr | fntDescr isXftFont])
-
getStylesInFamily: aFamilyName face: aFace filtering: filter
-
the list of font styles for a given family-face
-
showPreview
-
show the preview text
-
showSelectedFont
-
sr: no comment why changed from #getFamilyList to #updateFamilyList
problem: #updateFamilyList will not set #fontsPerFamily and calls
myself #showSelectedFont again -> recursion -> stx crash
-
updateFamilyList
-
-
updateFamilyListAndDoShowSelectedFont: doShowSelectedFont
-
update the list of font families
-
updateSizeList
-
self halt.
-
xftFontsOnlyChanged
-
will update combinedFilter
queries
-
characterSetViewClassAvailable
-
-
characterSetViewClassAvailableOrOSIsUNIX
-
-
computePreferredExtent
-
return the boxes preferredExtent
-
osIsUNIX
-
-
osIsUNIXAndXfdIsAvailable
-
-
xfdCanBeUsed
-
startup
-
fontFromUser
-
open this fontPanel and return the selected font,
or nil if abort is pressed
usage example(s):
FontPanel fontFromUser
FontPanel new
withChangeFontInViewsAllCheckBox:true;
fontFromUser
|
-
fontFromUserInitial: aFont
-
open this fontPanel showing aFont initially,
and return the selected font, or nil if abort is pressed
usage example(s):
FontPanel fontFromUserInitial:(Font family:'courier' size:12)
FontPanel fontFromUserInitial:MenuPanel defaultFont
|
-
fontFromUserInitial: aFont title: someTitle
-
open this fontPanel with title and return the selected font,
or nil if abort is pressed
usage example(s):
FontPanel fontFromUserInitial:(Font family:'courier' size:12) title:'select some font'
|
-
fontFromUserInitial: initialFont title: someTitle filter: aFilterBlock
-
open this fontPanel with title and font-filter
and return the selected font, or nil if abort is pressed
usage example(s):
FontPanel fontFromUserInitial:(Font family:'courier' size:12) title:'select some font'
|
-
fontFromUserInitial: initialFont title: someTitle filter: aFilterBlock encoding: encoding
-
open this fontPanel with title and font-filter
and return the selected font, or nil if abort is pressed
usage example(s):
FontPanel fontFromUserInitial:(Font family:'courier' size:12) title:'select some font'
|
-
fontFromUserInitial: initialFont title: someTitle filter: aFilterBlock encoding: encoding enabled: enabled
-
open this fontPanel with title and font-filter
and return the selected font, or nil if abort is pressed
usage example(s):
FontPanel fontFromUserInitial:(Font family:'courier' size:12) title:'select some font'.
FontPanel new
withChangeFontInViewsAllCheckBox:true;
fontFromUserInitial:(Font family:'courier' size:12) title:'select some font'
|
-
fontFromUserInitial: initialFont title: someTitle filter: aFilterBlock encoding: encoding enabled: enabled withChangeAllOption: changeAllBoolean
-
open this fontPanel with title and font-filter
and return the selected font, or nil if abort is pressed
usage example(s):
FontPanel fontFromUserInitial:(Font family:'courier' size:12) title:'select some font'.
FontPanel new
withChangeFontInViewsAllCheckBox:true;
fontFromUserInitial:(Font family:'courier' size:12) title:'select some font'
|
user interaction
-
copyFontName
-
-
encodingFilterSelected: anEncodingPattern
-
another encoding was selected; find available fonts and update lists
-
faceSelected: aFaceAndStyleName
-
a fonts face was selected; find available sizes and update lists
-
faceSelected: aFaceAndStyleName showPreview: showPreview
-
a fonts face was selected; find available sizes and update lists
-
familySelected: aFamilyName
-
a fonts family was selected; find available faces and update lists
-
familySelected: aFamilyName showPreview: showPreview
-
a fonts family was selected; find available faces and update lists
-
flushListOfAvailableFonts
-
this may take some time, especially with X11 XFT fonts
-
fontAttributeFilterChanged
-
a filter toggled (decorative/monospaced etc.)
-
okPressed
-
ok was pressed; hide myself and evaluate the okAction, passing
family, face, style and size as arguments
-
previewBlackOnWhite
-
-
previewCopySelection
-
-
previewInspectFont
-
-
previewShowCharacterSet
-
-
previewShowCharacterSetUsingXFD
-
-
previewWhiteOnBlack
-
-
previewWhiteOnGreen
-
-
sizeSelected: aNumberOrString
-
a size was selected; update preview
-
sizeSelected: aNumberOrString showPreview: showPreview
-
a size was selected; update preview
-
sizeUnitSelected: unitSymbol
-
very simple:
|font|
font := FontPanel fontFromUser.
Transcript showCR:font
|
with initial font:
|font|
font := FontPanel
fontFromUserInitial:(Font
family:'courier'
size:12).
Transcript showCR:font
|
with initial font & title:
|font|
font := FontPanel
fontFromUserInitial:(Font
family:'courier'
size:12)
title:'select a fooBar font'.
Transcript showCR:font
|
full setup; setting a filter to only present iso fonts
and callBack action:
|panel|
panel := FontPanel new.
panel label:'hi there - which iso font ?'.
panel filter:[:fd | fd encoding notNil
and:[fd encoding startsWith:'iso']].
panel action:[:family :face :style :size |
Transcript showCR:'family:' , family.
Transcript showCR:'face:' , face.
Transcript showCR:'style:' , style.
Transcript showCR:'size:' , size printString.
].
panel open
|
|