|
Class: XftFontDescription
Object
|
+--FontDescription
|
+--XftFontDescription
- Package:
- stx:libview
- Category:
- Graphics-Support
- Version:
- rev:
1.147
date: 2024/04/22 17:47:40
- user: stefan
- file: XftFontDescription.st directory: libview
- module: stx stc-classLibrary: libview
WARNING: Unfinished.
Experimental implementation of custom font rendered using
Xft library (UNIX / X Window only), To actually use it,
add following definitions to the end of stx/configurations/myConf
(works on Ubuntu 12.10)
--- snip ---
XDEFS+=-DXFT
XINCLUDE+=$(shell pkg-config --cflags xft)
LIB_XFT=-l:libXft.so.2 -l:libfontconfig.so.1
--- snip --
NOTE: This class should be named XftFont, however then
there would be a name clash with XftFont structure
defined in Xft.h - therefore the class is named
XftFontDescription to avoid that name clash.
[instance variables:]
[class variables:]
copyrightCOPYRIGHT (c) 2013 by Jan Vrany
COPYRIGHT (c) 2013 by Claus Gittinger / eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
change & update
-
aboutToDestroyViewWithDevice: aDevice id: aWindowId
-
a view is going to be destroyed.
Have to disassociate the XftDrawId from the drawableId aWindowId
class initialization
-
initialize
-
Invoked at system start or when the class is dynamically loaded.
examples
-
example1
-
XftFontDescription example1
-
example2
-
XftFontDescription example2
-
example3
-
XftFontDescription example2
initialization
-
flushListOfAvailableFonts
-
XftFontDescription flushListOfAvailableFonts
instance creation
-
for: aFontOrFontDescription
-
-
new
-
(comment from inherited method)
return an instance of myself without indexed variables
primitives
-
xftAvailable
-
-
xftFontClose: fontIdArg displayId: displayId
-
-
xftFontGetAscent: fontIdArg
-
-
xftFontGetDescent: fontIdArg
-
-
xftFontGetHeight: fontIdArg
-
-
xftFontGetMaxAdvanceWidth: fontIdArg
-
-
xftFontGetPattern: fontIdArg
-
queries
-
listOfAvailableFonts
-
uses fc-list to get a list of available fontDescriptions
Usage example(s):
XftFontDescription flushListOfAvailableFonts.
XftFontDescription listOfAvailableFonts
|
utilities
-
fixedLC_CTYPE
-
to suppress the disturbing warning messages from fontconfig,
if LC_CTYPE is wrong (osx problem only?)
accessing
-
encoding
-
(comment from inherited method)
return the font's encoding, as a symbol
such as #'iso8859', #'jis0208.1983' or #ascii.
If the encoding is not known, return nil;
You should assume ascii/iso8859-encoding then.
-
face
-
(comment from inherited method)
return the face, a string
-
fullName
-
-
graphicsDevice
-
(comment from inherited method)
return the device I am on
-
maxCode
-
16rFFFF
-
maxCode: something
-
-
minCode
-
(comment from inherited method)
return the smallest UCS code in font.
Dummy for now
-
minCode: something
-
-
style
-
(comment from inherited method)
return the style, a string
-
weight: aNumber
-
set the weight. The face is the string representation of weight.
accessing-private
-
getXftFontId
-
-
setFontId: fontIdArg
-
converting
-
asNonXftFont
-
in some situations, we do not want an Xft font.
Return an abstract fontDescription corresponding to the receiver
Usage example(s):
|view1 view2|
view1 := TextView new openAndWaitUntilVisible.
view2 := TextView new openAndWaitUntilVisible.
view1 font:(Button defaultFont).
view1 contents:'Hello world'.
view2 font:(Button defaultFont asNonXftFont onDevice:Display).
view2 contents:'Hello world'.
|
displaying
-
displayString: aString from: index1 to: index2 x: x y: y in: aGC opaque: opaque
-
this is only called for fonts which have a nil fontId,
and therefore use the replacementFont. Should never be called
for non-replacement fonts.
error reporting
-
primitiveFailed
-
(comment from inherited method)
report an error that some primitive code failed.
The error is reported by raising the PrimitiveFailure exception.
-
primitiveFailed: errorString
-
(comment from inherited method)
report an error that some primitive code failed.
The error is reported by raising the PrimitiveFailureSignal exception.
finalization
-
finalize
-
(comment from inherited method)
this is invoked for executor objects which have been registered
in a Registry, when the original object dies.
Subclasses may redefine this method
This interface is also VW-compatible
getting a device font
-
installInDeviceForGCId: aGCId
-
install the font for aGCId
-
onDevice: aGraphicsDevice
-
Create a new XftFont representing the font closest to
myself on aDevice; if one already exists, return that one.
-
onDevice: aGraphicsDevice ifAbsent: aBlock
-
Create a new XftFont representing the font closest to
myself on aDevice; if one already exists, return that one.
Usage example(s):
(XftFontDescription family:'monospace' size:16) onDevice:Screen current ifAbsent:[self halt].
|
initialization
-
initialize
-
Invoked when a new instance is created.
-
isScaledFont
-
-
reinitialize
-
fontId is no longer valid after snapIn
-
setDevice: deviceArg patternId: patternIdArg fontId: fontIdArg
-
name := patternIdArg get: 'fullname' index: 0.
primitives
-
xftTextExtents: displayIdArg string: aString from: start to: stop into: extentsArrayOrNil
-
get the extents of aString.
Answer thr width of aString (in reality the xOff).
If extentArrayOrNil is an Array, fill is with the extent info:
#(width height x y xOff yOff ascent descent).
queries-dimensions
-
ascent
-
return the ascent - the number of pixels above the baseLine.
-
descent
-
return the descent - the number of pixels below the baseLine.
-
getFontMetrics
-
-
getFontResolution
-
-
height
-
return the height - the number of pixels above plus below the baseLine.
-
isFixedWidth
-
return true, if this is a fixed pitch font
(i.e. all characters are of the same width).
Also called monospaced fonts
-
maxAscent
-
return the font's maximum-ascent (i.e. the maximum of all characters);
That is the number of units (usually pixels) above the baseline.
-
maxDescent
-
return the font's maximum-descent (i.e. the maximum of all characters);
That is the number of units (usually pixels) below the baseline.
-
maxWidth
-
return the font's maximum-width character (i.e. the maximum of all characters);
That is a number of units (usually pixels).
-
patternStringForId: patternIdArg
-
-
width
-
return the font's characters width;
That is a number of units (usually pixels).
For variable pitch fonts, the width of the space character is returned.
For fixed fonts, this is the same as minWidth or maxWidth (or any character).
The receiver must be associated to a device, for this query to be legal.
-
widthOf: aString from: start to: stop
-
return the width of a sub string
release
-
releaseFromDevice
-
I am no longer available on the device
-
restored
-
private: instance has been restored (either from snapin or binary store);
flush device handles
testing
-
isAlienFont
-
my GraphicsContext knows how to disply strings in my font.
Alien fonts are eg. Hershey or Bitmap fonts, which are drawn by st/x itself.
-
isXftFont
-
anwer true, if this is an Xft font.
Sure, I am
FCFontListParser
FCPatternHandle
XftDrawHandle
XftFontHandle
|