Cairo__FontFace.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sun, 21 Sep 2014 00:44:10 +0100
changeset 20 18a3e6b5f310
parent 12 e5f0c18af8a9
child 23 38ee47dbd976
permissions -rw-r--r--
Added const modifier to FFI specs (required by recent STX)

"{ Package: 'stx:goodies/libcairo' }"

"{ NameSpace: Cairo }"

RefCountedStructure subclass:#FontFace
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Cairo-Objects'
!


!FontFace class methodsFor:'accessing'!

dllPath

    OperatingSystem isMSWINDOWSlike ifTrue:[
        ^ #( 'C:\Windows' 'C:\Windows\System32' "Wild guess, should not harm" )
    ].

    OperatingSystem isUNIXlike ifTrue:[
        OperatingSystem getSystemType == #linux ifTrue:[
            | path |

            path := #( '/lib' '/usr/lib' '/usr/local/lib' ).
            (OperatingSystem getSystemInfo at:#machine) = 'x86_64' ifTrue:[
                "If the machine is 64bit, prepend standard path for 32bit libs.
                 Leave standard paths at the end, as the system might be completely 
                 32bit but running on 64bit-capable CPU.

                CAVEAT: This is bit dangerous, as on 64bit OS, if ia32 libs are
                not installed byt 64bit sqlite libs are, then 64bit libs are found
                and when a function is called, segfault will occur!!

                Q: Is there a way how to figure out if the OS itself is 32bit,
                regardles on CPU?"
                path := #( '/lib32' '/usr/lib32' '/usr/local/lib32' ) , path.
            ].
            ^path

        ].
    ].

    self error:'Unsupported operating system'

    "
        SqliteLibrary dllPath
    "

    "Created: / 31-08-2011 / 18:02:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

libraryName

	OperatingSystem isUNIXlike ifTrue:[^'libcairo.so.2'].

	OperatingSystem isMSWINDOWSlike ifTrue:[^'cairo.dll'].

	self error:'Library name for host OS is not known'

    "Modified: / 10-09-2008 / 18:19:53 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

structSize

	^0

    "Modified: / 10-09-2008 / 18:19:53 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!FontFace class methodsFor:'primitives'!

primDestroy: font_face 

	<cdecl: const void "cairo_font_face_destroy" ( Cairo::FontFace ) >
	self primitiveFailed

    "Modified: / 10-09-2008 / 18:19:54 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

primFtFontFaceCreateForFtFace: face loadFlags: load_flags 

	<cdecl: const Cairo::FontFace "cairo_ft_font_face_create_for_ft_face" ( pointer int32 ) >
	self primitiveFailed

    "Created: / 10-07-2008 / 23:05:54 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

primFtFontFaceCreateForPattern: pattern 

	<cdecl: const Cairo::FontFace "cairo_ft_font_face_create_for_pattern" ( pointer ) >
	self primitiveFailed

    "Created: / 10-07-2008 / 23:05:54 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

primGetReferenceCount: font_face 

	<cdecl: const uint32 "cairo_font_face_get_reference_count" ( Cairo::FontFace ) >
	self primitiveFailed

    "Modified: / 10-09-2008 / 18:19:55 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

primGetType: font_face 

	<cdecl: const int32 "cairo_font_face_get_type" ( Cairo::FontFace ) >
	self primitiveFailed

    "Modified: / 10-09-2008 / 18:19:55 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

primGetUserData: font_face key: key 

	<cdecl: const pointer "cairo_font_face_get_user_data" ( Cairo::FontFace Cairo::UserDataKey ) >
	self primitiveFailed

    "Modified: / 10-09-2008 / 18:19:55 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

primReference: font_face 

	<cdecl: const Cairo::FontFace "cairo_font_face_reference" ( Cairo::FontFace ) >
	self primitiveFailed

    "Modified: / 10-09-2008 / 18:19:54 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

primSetUserData: font_face key: key userData: user_data destroy: destroy 

	<cdecl: const int32 "cairo_font_face_set_user_data" ( Cairo::FontFace Cairo::UserDataKey pointer pointer ) >
	self primitiveFailed

    "Modified: / 10-09-2008 / 18:19:54 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

primStatus: font_face 

	<cdecl: const int32 "cairo_font_face_status" ( Cairo::FontFace ) >
	self primitiveFailed

    "Modified: / 10-09-2008 / 18:19:55 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!FontFace class methodsFor:'documentation'!

version
    ^'$Id$'
!

version_SVN
    ^ '$Id::                                                                                                                        $'
! !