Cairo__CStructure.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 17 Feb 2016 06:43:31 +0000
changeset 40 28dfc583beb5
child 88 9d51db2ba641
permissions -rw-r--r--
#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 }"

ByteArray variableByteSubclass:#CStructure
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Cairo-Objects'
!

CStructure class instanceVariableNames:'fields'

"
 No other class instance variables are inherited by this class.
"
!

!CStructure class methodsFor:'instance creation'!

new
    ^self basicNew: self sizeof

    "Created: / 16-02-2016 / 14:22:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

new: size
    self shouldNotImplement

    "Created: / 16-02-2016 / 14:22:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!CStructure class methodsFor:'accessing'!

sizeof
    ^ self subclassResponsibility

    "Created: / 16-02-2016 / 14:21:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!CStructure class methodsFor:'private'!

fields
    ^ fields

    "Created: / 18-02-2016 / 09:05:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!CStructure methodsFor:'inserting'!

inspectorExtraAttributes
    | attrs |

    attrs := super inspectorExtraAttributes.
    self class fields notNil ifTrue:[ 
        self class fields do:[:field | 
            attrs at: '-', field put: [ self perform: field ]
        ].
    ].
    ^ attrs

    "Created: / 18-02-2016 / 09:11:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !