eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'XftFontDescription':



Class: XftFontDescription



rev: 1.131 date: 2019/06/21 21:51:35
user: cg
file: XftFontDescription.st directory: libview
module: stx stc-classLibrary: libview
Jan Vrany <jan.vrany@fit.cvut.cz>


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 ---
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:]

Related information:

Class protocol:

change & update
o  aboutToDestroyViewWithDevice: aDevice id: aWindowId
a view is going to be destroyed.
Have to disassociate the XftDrawId from the drawableId aWindowId

o  example1
XftFontDescription example1

o  example2
XftFontDescription example2

o  example3
XftFontDescription example2

o  flushListOfAvailableFonts
XftFontDescription flushListOfAvailableFonts

o  initialize
Invoked at system start or when the class is dynamically loaded.

instance creation
o  for: aFontOrFontDescription

o  new

o  xftAvailable

o  xftFontClose: fontIdArg displayId: displayId

o  xftFontGetAscent: fontIdArg

o  xftFontGetDescent: fontIdArg

o  xftFontGetHeight: fontIdArg

o  xftFontGetMaxAdvanceWidth: fontIdArg

o  xftFontGetPattern: fontIdArg

o  listOfAvailableFonts
uses fc-list to get a list of available fontDescriptions

usage example(s):

     XftFontDescription flushListOfAvailableFonts.
     XftFontDescription listOfAvailableFonts

o  fixedLC_CTYPE
to suppress the disturbing warning messages from fontconfig,
if LC_CTYPE is wrong (osx problem only?)

Instance protocol:

o  encoding

o  face

o  fullName

o  graphicsDevice
(comment from inherited method)
return the device I am on

o  maxCode

o  maxCode: something

o  minCode

o  minCode: something

o  style

o  weight: aNumber
set the weight. The face is the string representation of weight.

o  getXftFontId

o  setFontId: fontIdArg

o  asNonXftFont
in some situations, we do not want an Xft font.
Return an abstract fontDescription corresponding to the receiver

o  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
o  primitiveFailed

o  primitiveFailed: errorString

o  finalize

getting a device font
o  installInDeviceForGCId: aGCId
install the font for aGCId

o  onDevice: aGraphicsDevice
Create a new XftFont representing the closes font as
myself on aDevice; if one already exists, return the one.

o  onDevice: aGraphicsDevice ifAbsent: aBlock
Create a new XftFont representing the closest font as
myself on aDevice; if one already exists, return the one.

usage example(s):

     (XftFontDescription family:'monospace' size:16) onDevice:Screen current ifAbsent:[self halt].

o  initialize
Invoked when a new instance is created.

o  isScaledFont

o  setDevice: deviceArg patternId: patternIdArg fontId: fontIdArg
name := patternIdArg get: 'fullname' index: 0.

o  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).

o  ascent
return the ascent - the number of pixels above the baseLine.

o  descent
return the descent - the number of pixels below the baseLine.

o  getFontMetrics

o  getFontResolution

o  height
return the height - the number of pixels above plus below the baseLine.

o  isFixedWidth
return true, if this is a fixed pitch font
(i.e. all characters are of the same width).
Also called monospaced fonts

o  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.

o  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.

o  maxWidth
return the font's maximum-width character (i.e. the maximum of all characters);
That is a number of units (usually pixels).

o  patternStringForId: patternIdArg

o  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.

o  widthOf: aString from: start to: stop
return the width of a sub string

o  releaseFromDevice
I am no longer available on the device

o  restored
flush device handles when restored

o  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.

o  isXftFont
anwer true, if this is an Xft font.
Sure, I am

Private classes:


ST/X; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Sun, 03 Mar 2024 18:13:03 GMT