#displayString: in CairoGraphicsContext revamped
Introduced a CairoScaledFont, a kind of FontDescription for Cairo fonts
(Cairo::ScaledFont / cairo_scaled_font_t). CairoScaledFont provides a bridge
between Smalltalk/X font API and Cairo the same way CairoGraphicsContext
provides a bridge bewtween Smalltalk/X drawing API and Cairo.
Don't use Cairo's "toy" text API to select font. Under X11, use FontConfig
to select a proper font. However, for actual text rendering and measurements,
Cairo's "toy" API is still used - it seems to be good enough, certainly as good
as Core X11 / Xft text rendering for Latin-based left-to-right languages.
At this point a TextEditView can be rendered using Cairo.
"{ Package: 'stx:goodies/libcairo' }"
"{ NameSpace: Cairo }"
ExternalAddress subclass:#CObject
instanceVariableNames:''
classVariableNames:'Lobby'
poolDictionaries:''
category:'Cairo-Objects'
!
!CObject class methodsFor:'initialization'!
initialize
"Invoked at system start or when the class is dynamically loaded."
"/ please change as required (and remove this comment)
Lobby := Registry new
"Modified: / 09-01-2015 / 11:22:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CObject class methodsFor:'instance creation'!
fromExternalAddress: anExternalAddress
^ self new fromExternalAddress: anExternalAddress
"Created: / 24-12-2014 / 22:18:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 25-12-2014 / 10:33:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CObject methodsFor:'accessing'!
referenceCount
"Return value or reference counter"
^ self subclassResponsibility
"Created: / 09-09-2008 / 20:33:48 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 28-12-2014 / 22:09:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CObject methodsFor:'finalization'!
executor
^self class basicNew
setAddress: self address;
yourself
"Created: / 10-09-2008 / 18:57:28 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 25-12-2014 / 10:36:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
finalize
self infoPrintCR:'Instance destroyed'.
self destroy
"Created: / 09-09-2008 / 20:30:22 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 10-09-2008 / 18:45:23 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 28-12-2014 / 21:39:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CObject methodsFor:'initialization & release'!
release
self unregisterForFinalization.
^self destroy
"Created: / 25-12-2014 / 10:34:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 13-02-2016 / 16:10:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CObject methodsFor:'private'!
destroy
"Tell Cairo library to destroy the corresponding C object.
Remember that object is physically destroyed only if internal
refcounter goes to zero. However, after calling destroy,
this instance should be treated as invalid."
^ self subclassResponsibility
"Created: / 28-12-2014 / 21:41:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
fromExternalAddress:anExternalAddress
self setAddress: anExternalAddress address.
self registerForFinalization.
self infoPrintCR:'Instance created'.
"Created: / 09-09-2008 / 20:35:23 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 10-09-2008 / 18:45:23 / Jan Vrany <vranyj1@fel.cvut.cz>"
"Modified: / 25-12-2014 / 10:36:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
infoPrintCR:aString
Stdout
nextPutAll:'Cairo [info] (';
nextPutAll:self class nameWithoutPrefix;
nextPutAll:' @ 0x';
nextPutAll:(self address printStringRadix:16);
nextPutAll:' @ ';
nextPutAll:(self referenceCount printString);
nextPutAll:': ';
nextPutAll:aString;
cr
"Created: / 10-09-2008 / 18:45:23 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !
!CObject class methodsFor:'documentation'!
version
^'$Id$'
!
version_HG
^ '$Changeset: <not expanded> $'
! !
CObject initialize!