Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pango independent #14

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
12 changes: 11 additions & 1 deletion src/BaselineOfGtk/BaselineOfGtk.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ BaselineOfGtk >> baseline: spec [

self glib: spec.
self gio: spec.
self pango: spec.

spec
"core"
package: 'Gdk' with: [ spec requires: #('GIO') ];
package: 'Pango' with: [ spec requires: #('Glib') ];
package: 'Gtk' with: [ spec requires: #('Glib' 'Gdk' 'Pango') ];

"code"
Expand Down Expand Up @@ -79,6 +79,16 @@ BaselineOfGtk >> installGtkDriver [
ifPresent: [ :driverClass | OSWindowDriver driverClass: driverClass ]
]

{ #category : #baseline }
BaselineOfGtk >> pango: spec [

spec baseline: 'Pango' with: [
spec
loads: #('default');
repository: self packageRepositoryURL ].

]

{ #category : #doits }
BaselineOfGtk >> postLoad [

Expand Down
29 changes: 29 additions & 0 deletions src/BaselineOfPango/BaselineOfPango.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Class {
#name : #BaselineOfPango,
#superclass : #BaselineOf,
#category : #BaselineOfPango
}

{ #category : #baseline }
BaselineOfPango >> baseline: spec [
<baseline>

spec
for: #common
do: [
self glib: spec.

spec
package: 'Pango' with: [ spec requires: #('Glib') ]].

]

{ #category : #baseline }
BaselineOfPango >> glib: spec [

spec baseline: 'Glib' with: [
spec
loads: #('default');
repository: self packageRepositoryURL ].

]
1 change: 1 addition & 0 deletions src/BaselineOfPango/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : #BaselineOfPango }
5 changes: 5 additions & 0 deletions src/Pango/PangoFT2FontMap.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ PangoFT2FontMap >> createContext [
^ self ffiCall: #(PangoContext *pango_ft2_font_map_create_context (self))
]

{ #category : #misc }
PangoFT2FontMap >> ft2Library [
^ self ffiCall: #(void *_pango_cairo_fc_font_map_get_library (self))
]

{ #category : #initialization }
PangoFT2FontMap >> initialize [
self autoRelease
Expand Down
46 changes: 44 additions & 2 deletions src/Pango/PangoFontDescription.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ PangoFontDescription class >> new [
^ self pango_font_description_new initialize
]

{ #category : #'instance creation' }
PangoFontDescription class >> new [

^ self pango_font_description_new initialize
]

{ #category : #'instance creation' }
PangoFontDescription class >> newFromString: aString [

Expand All @@ -48,7 +54,13 @@ PangoFontDescription class >> pango_font_description_from_string: str [

{ #category : #private }
PangoFontDescription class >> pango_font_description_new [
^ self ffiCall: #(PangoFontDescription *pango_font_description_new ())
self ffiCall: #(PangoFontDescription* pango_font_description_new ())
]

{ #category : #accessing }
PangoFontDescription >> absoluteSize: size [

^ self ffiCall: #( void pango_font_description_set_absolute_size(self , uint size ) )
]

{ #category : #accessing }
Expand All @@ -63,10 +75,40 @@ PangoFontDescription >> familyName: family [
^ self ffiCall: #(void pango_font_description_set_family(self, String family))
]

{ #category : #'initialize-release' }
PangoFontDescription >> free [

self class pango_font_description_free: handle
]

{ #category : #isValid }
PangoFontDescription >> isValid [

^ handle isNull not
]

{ #category : #accessing }
PangoFontDescription >> fontSize [

^ self ffiCall: #(gint pango_font_description_get_size ( self ))
^ self ffiCall: #( uint pango_font_description_get_size(self) )
]

{ #category : #accessing }
PangoFontDescription >> fontSize: size [

^ self ffiCall: #( void pango_font_description_set_size(self , uint size ) )
]

{ #category : #accessing }
PangoFontDescription >> stretch: stretch [

^ self ffiCall: #( void pango_font_description_set_stretch( self , PangoStretch stretch ) )
]

{ #category : #accessing }
PangoFontDescription >> weight: weight [

^ self ffiCall: #( void pango_font_description_set_weight( self , PangoStyle weight ) )
]

{ #category : #accessing }
Expand Down
23 changes: 23 additions & 0 deletions src/Pango/PangoLayout.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ PangoLayout >> fontDescription: desc [
self ffiCall: #(void pango_layout_set_font_description (self, const PangoFontDescription *desc))
]

{ #category : #accessing }
PangoLayout >> free [

^ self class g_object_unref: handle
]

{ #category : #accessing }
PangoLayout >> indent [

self ffiCall: #(int pango_layout_get_indent (self))
]

{ #category : #accessing }
PangoLayout >> getAttributes [
"https://docs.gtk.org/Pango/method.Layout.get_attributes.html"
Expand Down Expand Up @@ -165,11 +177,22 @@ PangoLayout >> size [
^ (widthBuffer signedLongAt: 1) @ (heightBuffer signedLongAt: 1)
]

{ #category : #accessing }
PangoLayout >> spacing [

self ffiCall: #(int pango_layout_get_spacing (self))
]

{ #category : #accessing }
PangoLayout >> text: text [
self ffiCall: #(void pango_layout_set_text (self, const char *text, -1))
]

{ #category : #accessing }
PangoLayout >> text: text length: len [
self ffiCall: #(void pango_layout_set_text (self, const char *text, int len))
]

{ #category : #accessing }
PangoLayout >> width [

Expand Down
33 changes: 33 additions & 0 deletions src/Pango/PangoStretch.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Class {
#name : #PangoStretch,
#superclass : #GEnumeration,
#classVars : [
'PANGO_STRETCH_CONDENSED',
'PANGO_STRETCH_EXPANDED',
'PANGO_STRETCH_EXTRA_CONDENSED',
'PANGO_STRETCH_EXTRA_EXPANDED',
'PANGO_STRETCH_NORMAL',
'PANGO_STRETCH_SEMI_CONDENSED',
'PANGO_STRETCH_SEMI_EXPANDED',
'PANGO_STRETCH_ULTRA_CONDENSED',
'PANGO_STRETCH_ULTRA_EXPANDED'
],
#category : #'Pango-Base'
}

{ #category : #'enum declaration' }
PangoStretch class >> enumDecl [

"self initialize"

^ #(
PANGO_STRETCH_ULTRA_CONDENSED 0
PANGO_STRETCH_EXTRA_CONDENSED 1
PANGO_STRETCH_CONDENSED 2
PANGO_STRETCH_SEMI_CONDENSED 3
PANGO_STRETCH_NORMAL 4
PANGO_STRETCH_SEMI_EXPANDED 5
PANGO_STRETCH_EXPANDED 6
PANGO_STRETCH_EXTRA_EXPANDED 7
PANGO_STRETCH_ULTRA_EXPANDED 8)
]