Cairo__FontExtents.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 14 Jun 2012 09:18:25 +0000
changeset 12 e5f0c18af8a9
parent 11 fdc697f4f190
child 23 38ee47dbd976
permissions -rw-r--r--
- Cairo::Format added: #version_SVN - Cairo::LineCap added: #version_SVN - Cairo::Extend added: #version_SVN - Cairo::RefCountedStructure added: #dllPath #version_SVN - Cairo::Operator added: #version_SVN - Cairo::PathData added: #dllPath #version_SVN - Cairo::SubpixelOrder added: #version_SVN - Cairo::ScaledFont added: #dllPath #version_SVN - Cairo::PathDataType added: #version_SVN - Cairo::Surface added: #dllPath #version_SVN - Cairo::GLXWorkstation added: #version_SVN - Cairo::LineJoin added: #version_SVN - Cairo::FillRule added: #version_SVN - Cairo::Path added: #dllPath #version_SVN - Cairo::RectangleList added: #dllPath #version_SVN - Cairo::FontSlant added: #version_SVN - Cairo::SurfaceType added: #version_SVN - Cairo::PatternType added: #version_SVN - stx_goodies_libcairo added: #extensionsVersion_SVN #svnRepositoryUrlString #svnRevisionNr #version_SVN - Cairo::Matrix added: #dllPath #version_SVN - Cairo::Filter added: #version_SVN - Cairo::Glyph added: #dllPath #version_SVN - Cairo::FontOptions added: #dllPath #version_SVN - Cairo::GraphicsContext added: #dllPath #version_SVN - Cairo::FontType added: #version_SVN - Cairo::Antialias added: #version_SVN - Cairo::SvgVersion added: #version_SVN - Cairo::HintMetrics added: #version_SVN - Cairo::FontFace added: #dllPath #version_SVN - Cairo::Rectangle added: #dllPath #version_SVN - Cairo::Pattern added: #dllPath #version_SVN - Cairo::FontExtents added: #dllPath #version_SVN - Cairo::FontWeight added: #version_SVN - Cairo::TextExtents added: #dllPath #version_SVN - Cairo::Content added: #version_SVN - Cairo::HintStyle added: #version_SVN - Cairo::UserDataKey added: #dllPath #version_SVN - Cairo::Status added: #version_SVN - extensions ...

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

"{ NameSpace: Cairo }"

ExternalStructure subclass:#FontExtents
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Cairo-Objects'
!


!FontExtents 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

	^320

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

!FontExtents methodsFor:'accessing'!

ascent

	^self doubleAt:1 + 0

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

ascent: value

	self doubleAt:1 + 0 put:value

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

descent

	^self doubleAt:1 + 8

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

descent: value

	self doubleAt:1 + 8 put:value

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

height

	^self doubleAt:1 + 16

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

height: value

	self doubleAt:1 + 16 put:value

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

maxXAdvance

	^self doubleAt:1 + 24

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

maxXAdvance: value

	self doubleAt:1 + 24 put:value

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

maxYAdvance

	^self doubleAt:1 + 32

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

maxYAdvance: value

	self doubleAt:1 + 32 put:value

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

!FontExtents class methodsFor:'documentation'!

version
    ^'$Id$'
!

version_SVN
    ^ '$Id::                                                                                                                        $'
! !