pango is gir-based now (very draft version)
parent
da25daeb51
commit
56280003c5
|
@ -1,2 +1 @@
|
||||||
Matthew Willis
|
Anton Gorenko
|
||||||
Slava Pestov
|
|
|
@ -1,36 +1,64 @@
|
||||||
! Copyright (C) 2008 Matthew Willis.
|
! Copyright (C) 2009 Anton Gorenko.
|
||||||
! Copyright (C) 2009 Slava Pestov.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
! See http://factorcode.org/license.txt for BSD license
|
USING: alien.c-types alien.libraries alien.syntax combinators gir
|
||||||
USING: alien alien.c-types alien.syntax alien.destructors
|
kernel system vocabs.parser words ;
|
||||||
combinators system alien.libraries ;
|
|
||||||
IN: glib
|
|
||||||
|
|
||||||
<<
|
<<
|
||||||
|
"glib" {
|
||||||
{
|
{ [ os winnt? ] [ "libglib-2.0-0.dll" "cdecl" add-library ] }
|
||||||
{ [ os winnt? ] [ "glib" "libglib-2.0-0.dll" cdecl add-library ] }
|
{ [ os macosx? ] [ "/opt/local/lib/libglib-2.0.0.dylib" "cdecl" add-library ] }
|
||||||
{ [ os macosx? ] [ "glib" "/opt/local/lib/libglib-2.0.0.dylib" cdecl add-library ] }
|
{ [ os unix? ] [ drop ] }
|
||||||
{ [ os unix? ] [ ] }
|
|
||||||
} cond
|
} cond
|
||||||
|
|
||||||
{
|
|
||||||
{ [ os winnt? ] [ "gobject" "libgobject-2.0-0.dll" cdecl add-library ] }
|
|
||||||
{ [ os macosx? ] [ "gobject" "/opt/local/lib/libgobject-2.0.0.dylib" cdecl add-library ] }
|
|
||||||
{ [ os unix? ] [ ] }
|
|
||||||
} cond
|
|
||||||
|
|
||||||
>>
|
>>
|
||||||
|
|
||||||
LIBRARY: glib
|
IN: glib.ffi
|
||||||
|
|
||||||
|
<< double "long double" current-vocab create typedef >>
|
||||||
|
|
||||||
|
TYPEDEF: char gchar
|
||||||
|
TYPEDEF: uchar guchar
|
||||||
|
TYPEDEF: short gshort
|
||||||
|
TYPEDEF: ushort gushort
|
||||||
|
TYPEDEF: long glong
|
||||||
|
TYPEDEF: ulong gulong
|
||||||
|
TYPEDEF: int gint
|
||||||
|
TYPEDEF: uint guint
|
||||||
|
TYPEDEF: gint gboolean
|
||||||
|
|
||||||
|
TYPEDEF: char gint8
|
||||||
|
TYPEDEF: uchar guint8
|
||||||
|
TYPEDEF: short gint16
|
||||||
|
TYPEDEF: ushort guint16
|
||||||
|
TYPEDEF: int gint32
|
||||||
|
TYPEDEF: uint guint32
|
||||||
|
TYPEDEF: longlong gint64
|
||||||
|
TYPEDEF: ulonglong guint64
|
||||||
|
|
||||||
|
TYPEDEF: float gfloat
|
||||||
|
TYPEDEF: double gdouble
|
||||||
|
|
||||||
|
TYPEDEF: long ssize_t
|
||||||
|
TYPEDEF: long time_t
|
||||||
|
TYPEDEF: size_t gsize
|
||||||
|
TYPEDEF: ssize_t gssize
|
||||||
|
TYPEDEF: size_t GType
|
||||||
|
|
||||||
TYPEDEF: void* gpointer
|
TYPEDEF: void* gpointer
|
||||||
TYPEDEF: int gint
|
TYPEDEF: void* gconstpointer
|
||||||
TYPEDEF: bool gboolean
|
|
||||||
|
|
||||||
FUNCTION: void g_free ( gpointer mem ) ;
|
TYPEDEF: guint8 GDateDay
|
||||||
|
TYPEDEF: guint16 GDateYear
|
||||||
|
TYPEDEF: gint GPid
|
||||||
|
TYPEDEF: guint32 GQuark
|
||||||
|
TYPEDEF: gint32 GTime
|
||||||
|
TYPEDEF: glong gintptr
|
||||||
|
TYPEDEF: gint64 goffset
|
||||||
|
TYPEDEF: gulong guintptr
|
||||||
|
TYPEDEF: guint32 gunichar
|
||||||
|
TYPEDEF: guint16 gunichar2
|
||||||
|
|
||||||
LIBRARY: gobject
|
! Разобраться, почему в .gir есть такие типы
|
||||||
|
TYPEDEF: void any
|
||||||
|
|
||||||
FUNCTION: void g_object_unref ( gpointer object ) ;
|
IN-GIR: glib vocab:glib/GLib-2.0.gir
|
||||||
|
|
||||||
DESTRUCTOR: g_object_unref
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Binding for GLib
|
|
|
@ -1 +0,0 @@
|
||||||
bindings
|
|
|
@ -1,2 +1 @@
|
||||||
Matthew Willis
|
Anton Gorenko
|
||||||
Slava Pestov
|
|
|
@ -1,99 +1,37 @@
|
||||||
! Copyright (C) 2008 Matthew Willis.
|
! Copyright (C) 2010 Anton Gorenko.
|
||||||
! Copyright (C) 2009 Slava Pestov.
|
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
!
|
USING: alien alien.c-types alien.destructors
|
||||||
! pangocairo bindings, from pango/pangocairo.h
|
alien.libraries alien.syntax alien.strings arrays math math.functions
|
||||||
USING: arrays sequences alien alien.c-types alien.destructors
|
math.vectors destructors combinators colors fonts accessors assocs
|
||||||
alien.libraries alien.syntax math math.functions math.vectors
|
namespaces kernel unicode.data images sequences
|
||||||
destructors combinators colors fonts accessors assocs namespaces
|
|
||||||
kernel pango pango.fonts pango.layouts glib unicode.data images
|
|
||||||
cache init system math.rectangles fry memoize io.encodings.utf8
|
cache init system math.rectangles fry memoize io.encodings.utf8
|
||||||
classes.struct cairo cairo.ffi ;
|
classes.struct cairo cairo.ffi
|
||||||
IN: pango.cairo
|
gir pango pango.ffi gobject gobject.ffi ;
|
||||||
|
|
||||||
<< {
|
<<
|
||||||
{ [ os winnt? ] [ "pangocairo" "libpangocairo-1.0-0.dll" cdecl add-library ] }
|
"pango.cairo" {
|
||||||
{ [ os macosx? ] [ "pangocairo" "/opt/local/lib/libpangocairo-1.0.0.dylib" cdecl add-library ] }
|
{ [ os winnt? ] [ "libpangocairo-1.0-0.dll" cdecl add-library ] }
|
||||||
{ [ os unix? ] [ ] }
|
{ [ os macosx? ] [ "/opt/local/lib/libpangocairo-1.0.0.dylib" cdecl add-library ] }
|
||||||
} cond >>
|
{ [ os unix? ] [ drop ] }
|
||||||
|
} cond
|
||||||
|
>>
|
||||||
|
|
||||||
LIBRARY: pangocairo
|
IN-GIR: pango.cairo vocab:pango/cairo/PangoCairo-1.0.gir
|
||||||
|
|
||||||
C-TYPE: PangoCairoFontMap
|
|
||||||
C-TYPE: PangoCairoFont
|
|
||||||
|
|
||||||
FUNCTION: PangoFontMap*
|
|
||||||
pango_cairo_font_map_new ( ) ;
|
|
||||||
|
|
||||||
FUNCTION: PangoFontMap*
|
IN: pango.cairo.ffi
|
||||||
pango_cairo_font_map_new_for_font_type ( cairo_font_type_t fonttype ) ;
|
|
||||||
|
|
||||||
FUNCTION: PangoFontMap*
|
|
||||||
pango_cairo_font_map_get_default ( ) ;
|
|
||||||
|
|
||||||
FUNCTION: cairo_font_type_t
|
|
||||||
pango_cairo_font_map_get_font_type ( PangoCairoFontMap* fontmap ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_cairo_font_map_set_resolution ( PangoCairoFontMap* fontmap, double dpi ) ;
|
|
||||||
|
|
||||||
FUNCTION: double
|
|
||||||
pango_cairo_font_map_get_resolution ( PangoCairoFontMap* fontmap ) ;
|
|
||||||
|
|
||||||
FUNCTION: PangoContext*
|
|
||||||
pango_cairo_font_map_create_context ( PangoCairoFontMap* fontmap ) ;
|
|
||||||
|
|
||||||
FUNCTION: cairo_scaled_font_t*
|
|
||||||
pango_cairo_font_get_scaled_font ( PangoCairoFont* font ) ;
|
|
||||||
|
|
||||||
! Update a Pango context for the current state of a cairo context
|
|
||||||
FUNCTION: void
|
|
||||||
pango_cairo_update_context ( cairo_t* cr, PangoContext* context ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_cairo_context_set_font_options ( PangoContext* context, cairo_font_options_t* options ) ;
|
|
||||||
|
|
||||||
FUNCTION: cairo_font_options_t*
|
|
||||||
pango_cairo_context_get_font_options ( PangoContext* context ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_cairo_context_set_resolution ( PangoContext* context, double dpi ) ;
|
|
||||||
|
|
||||||
FUNCTION: double
|
|
||||||
pango_cairo_context_get_resolution ( PangoContext* context ) ;
|
|
||||||
|
|
||||||
! Convenience
|
|
||||||
FUNCTION: PangoLayout*
|
|
||||||
pango_cairo_create_layout ( cairo_t* cr ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
FUNCTION: void
|
||||||
pango_cairo_update_layout ( cairo_t* cr, PangoLayout* layout ) ;
|
pango_cairo_update_layout ( cairo_t* cr, PangoLayout* layout ) ;
|
||||||
|
|
||||||
! Rendering
|
|
||||||
FUNCTION: void
|
|
||||||
pango_cairo_show_glyph_string ( cairo_t* cr, PangoFont* font, PangoGlyphString* glyphs ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_cairo_show_layout_line ( cairo_t* cr, PangoLayoutLine* line ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
FUNCTION: void
|
||||||
pango_cairo_show_layout ( cairo_t* cr, PangoLayout* layout ) ;
|
pango_cairo_show_layout ( cairo_t* cr, PangoLayout* layout ) ;
|
||||||
|
|
||||||
FUNCTION: void
|
FUNCTION: PangoLayout*
|
||||||
pango_cairo_show_error_underline ( cairo_t* cr, double x, double y, double width, double height ) ;
|
pango_cairo_create_layout ( cairo_t* cr ) ;
|
||||||
|
|
||||||
! Rendering to a path
|
IN: pango.cairo
|
||||||
FUNCTION: void
|
|
||||||
pango_cairo_glyph_string_path ( cairo_t* cr, PangoFont* font, PangoGlyphString* glyphs ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_cairo_layout_line_path ( cairo_t* cr, PangoLayoutLine* line ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_cairo_layout_path ( cairo_t* cr, PangoLayout* layout ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_cairo_error_underline_path ( cairo_t* cr, double x, double y, double width, double height ) ;
|
|
||||||
|
|
||||||
TUPLE: layout < disposable font string selection layout metrics ink-rect logical-rect image ;
|
TUPLE: layout < disposable font string selection layout metrics ink-rect logical-rect image ;
|
||||||
|
|
||||||
|
@ -107,7 +45,7 @@ SYMBOL: dpi
|
||||||
: set-layout-text ( str layout -- )
|
: set-layout-text ( str layout -- )
|
||||||
#! Replace nulls with something else since Pango uses null-terminated
|
#! Replace nulls with something else since Pango uses null-terminated
|
||||||
#! strings
|
#! strings
|
||||||
swap -1 pango_layout_set_text ;
|
swap utf8 string>alien -1 pango_layout_set_text ;
|
||||||
|
|
||||||
: layout-extents ( layout -- ink-rect logical-rect )
|
: layout-extents ( layout -- ink-rect logical-rect )
|
||||||
PangoRectangle <struct>
|
PangoRectangle <struct>
|
||||||
|
@ -241,3 +179,4 @@ SYMBOL: cached-layouts
|
||||||
cached-layout layout>> first-line ;
|
cached-layout layout>> first-line ;
|
||||||
|
|
||||||
[ <cache-assoc> cached-layouts set-global ] "pango.cairo" add-startup-hook
|
[ <cache-assoc> cached-layouts set-global ] "pango.cairo" add-startup-hook
|
||||||
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
Matthew Willis
|
|
||||||
Slava Pestov
|
|
|
@ -1,113 +0,0 @@
|
||||||
! Copyright (C) 2008 Matthew Willis.
|
|
||||||
! Copyright (C) 2009 Slava Pestov.
|
|
||||||
! See http://factorcode.org/license.txt for BSD license
|
|
||||||
USING: pango alien.syntax alien.c-types alien.destructors
|
|
||||||
kernel glib accessors combinators destructors init fonts
|
|
||||||
memoize math ;
|
|
||||||
IN: pango.fonts
|
|
||||||
|
|
||||||
LIBRARY: pango
|
|
||||||
|
|
||||||
ENUM: PangoStyle
|
|
||||||
PANGO_STYLE_NORMAL
|
|
||||||
PANGO_STYLE_OBLIQUE
|
|
||||||
PANGO_STYLE_ITALIC ;
|
|
||||||
|
|
||||||
TYPEDEF: int PangoWeight
|
|
||||||
C-TYPE: PangoFont
|
|
||||||
C-TYPE: PangoFontFamily
|
|
||||||
C-TYPE: PangoFontFace
|
|
||||||
C-TYPE: PangoFontMap
|
|
||||||
C-TYPE: PangoFontMetrics
|
|
||||||
C-TYPE: PangoFontDescription
|
|
||||||
C-TYPE: PangoGlyphString
|
|
||||||
C-TYPE: PangoLanguage
|
|
||||||
|
|
||||||
CONSTANT: PANGO_WEIGHT_THIN 100
|
|
||||||
CONSTANT: PANGO_WEIGHT_ULTRALIGHT 200
|
|
||||||
CONSTANT: PANGO_WEIGHT_LIGHT 300
|
|
||||||
CONSTANT: PANGO_WEIGHT_BOOK 380
|
|
||||||
CONSTANT: PANGO_WEIGHT_NORMAL 400
|
|
||||||
CONSTANT: PANGO_WEIGHT_MEDIUM 500
|
|
||||||
CONSTANT: PANGO_WEIGHT_SEMIBOLD 600
|
|
||||||
CONSTANT: PANGO_WEIGHT_BOLD 700
|
|
||||||
CONSTANT: PANGO_WEIGHT_ULTRABOLD 800
|
|
||||||
CONSTANT: PANGO_WEIGHT_HEAVY 900
|
|
||||||
CONSTANT: PANGO_WEIGHT_ULTRAHEAVY 1000
|
|
||||||
|
|
||||||
FUNCTION: PangoFontDescription*
|
|
||||||
pango_font_description_new ( ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_font_description_free ( PangoFontDescription* desc ) ;
|
|
||||||
|
|
||||||
DESTRUCTOR: pango_font_description_free
|
|
||||||
|
|
||||||
FUNCTION: PangoFontDescription*
|
|
||||||
pango_font_description_from_string ( c-string str ) ;
|
|
||||||
|
|
||||||
FUNCTION: c-string
|
|
||||||
pango_font_description_to_string ( PangoFontDescription* desc ) ;
|
|
||||||
|
|
||||||
FUNCTION: c-string
|
|
||||||
pango_font_description_to_filename ( PangoFontDescription* desc ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_font_description_set_family ( PangoFontDescription* desc, c-string family ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_font_description_set_style ( PangoFontDescription* desc, PangoStyle style ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_font_description_set_weight ( PangoFontDescription* desc, PangoWeight weight ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_font_description_set_size ( PangoFontDescription* desc, gint size ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_font_map_list_families ( PangoFontMap* fontmap, PangoFontFamily*** families, int* n_families ) ;
|
|
||||||
|
|
||||||
FUNCTION: c-string
|
|
||||||
pango_font_family_get_name ( PangoFontFamily* family ) ;
|
|
||||||
|
|
||||||
FUNCTION: int
|
|
||||||
pango_font_family_is_monospace ( PangoFontFamily* family ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_font_family_list_faces ( PangoFontFamily* family, PangoFontFace*** faces, int* n_faces ) ;
|
|
||||||
|
|
||||||
FUNCTION: c-string
|
|
||||||
pango_font_face_get_face_name ( PangoFontFace* face ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_font_face_list_sizes ( PangoFontFace* face, int** sizes, int* n_sizes ) ;
|
|
||||||
|
|
||||||
FUNCTION: void pango_font_metrics_unref ( PangoFontMetrics* metrics ) ;
|
|
||||||
|
|
||||||
DESTRUCTOR: pango_font_metrics_unref
|
|
||||||
|
|
||||||
FUNCTION: int pango_font_metrics_get_ascent ( PangoFontMetrics* metrics ) ;
|
|
||||||
|
|
||||||
FUNCTION: int pango_font_metrics_get_descent ( PangoFontMetrics* metrics ) ;
|
|
||||||
|
|
||||||
FUNCTION: PangoFont* pango_font_map_load_font ( PangoFontMap* fontmap, PangoContext* context, PangoFontDescription* desc ) ;
|
|
||||||
|
|
||||||
FUNCTION: PangoFontMetrics* pango_context_get_metrics ( PangoContext* context, PangoFontDescription* desc, PangoLanguage* language ) ;
|
|
||||||
|
|
||||||
FUNCTION: PangoFontMetrics* pango_font_get_metrics ( PangoFont* font, PangoLanguage* language ) ;
|
|
||||||
|
|
||||||
MEMO: (cache-font-description) ( font -- description )
|
|
||||||
[
|
|
||||||
[ pango_font_description_new |pango_font_description_free ] dip {
|
|
||||||
[ name>> pango_font_description_set_family ]
|
|
||||||
[ size>> float>pango pango_font_description_set_size ]
|
|
||||||
[ bold?>> PANGO_WEIGHT_BOLD PANGO_WEIGHT_NORMAL ? pango_font_description_set_weight ]
|
|
||||||
[ italic?>> PANGO_STYLE_ITALIC PANGO_STYLE_NORMAL ? pango_font_description_set_style ]
|
|
||||||
[ drop ]
|
|
||||||
} 2cleave
|
|
||||||
] with-destructors ;
|
|
||||||
|
|
||||||
: cache-font-description ( font -- description )
|
|
||||||
strip-font-colors (cache-font-description) ;
|
|
||||||
|
|
||||||
[ \ (cache-font-description) reset-memoized ] "pango.fonts" add-startup-hook
|
|
|
@ -1 +0,0 @@
|
||||||
bindings
|
|
|
@ -1,11 +0,0 @@
|
||||||
IN: pango.layouts.tests
|
|
||||||
USING: pango.layouts pango.cairo tools.test glib fonts accessors
|
|
||||||
sequences combinators.short-circuit math destructors ;
|
|
||||||
|
|
||||||
[ t ] [
|
|
||||||
[
|
|
||||||
<font> "Helvetica" >>name 12 >>size
|
|
||||||
"OH, HAI"
|
|
||||||
cached-layout ink-rect>> dim>>
|
|
||||||
] with-destructors [ 0 > ] all?
|
|
||||||
] unit-test
|
|
|
@ -1,66 +0,0 @@
|
||||||
! Copyright (C) 2008 Matthew Willis.
|
|
||||||
! Copyright (C) 2009 Slava Pestov.
|
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
|
||||||
USING: arrays sequences alien alien.c-types alien.destructors
|
|
||||||
alien.syntax math math.functions math.vectors destructors combinators
|
|
||||||
colors fonts accessors assocs namespaces kernel pango pango.fonts
|
|
||||||
glib unicode.data images cache init
|
|
||||||
math.rectangles fry memoize io.encodings.utf8 classes.struct ;
|
|
||||||
IN: pango.layouts
|
|
||||||
|
|
||||||
LIBRARY: pango
|
|
||||||
|
|
||||||
C-TYPE: PangoLayout
|
|
||||||
C-TYPE: PangoLayoutIter
|
|
||||||
C-TYPE: PangoLayoutLine
|
|
||||||
|
|
||||||
FUNCTION: PangoLayout*
|
|
||||||
pango_layout_new ( PangoContext* context ) ;
|
|
||||||
|
|
||||||
FUNCTION: PangoContext*
|
|
||||||
pango_layout_get_context ( PangoLayout* layout ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_layout_set_text ( PangoLayout* layout, c-string text, int length ) ;
|
|
||||||
|
|
||||||
FUNCTION: c-string
|
|
||||||
pango_layout_get_text ( PangoLayout* layout ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_layout_get_size ( PangoLayout* layout, int* width, int* height ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_layout_set_font_description ( PangoLayout* layout, PangoFontDescription* desc ) ;
|
|
||||||
|
|
||||||
FUNCTION: PangoFontDescription*
|
|
||||||
pango_layout_get_font_description ( PangoLayout* layout ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_layout_get_pixel_size ( PangoLayout* layout, int* width, int* height ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_layout_get_extents ( PangoLayout* layout, PangoRectangle* ink_rect, PangoRectangle* logical_rect ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_layout_get_pixel_extents ( PangoLayout* layout, PangoRectangle* ink_rect, PangoRectangle* logical_rect ) ;
|
|
||||||
|
|
||||||
FUNCTION: PangoLayoutLine*
|
|
||||||
pango_layout_get_line_readonly ( PangoLayout* layout, int line ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_layout_line_index_to_x ( PangoLayoutLine* line, int index_, uint trailing, int* x_pos ) ;
|
|
||||||
|
|
||||||
FUNCTION: gboolean
|
|
||||||
pango_layout_line_x_to_index ( PangoLayoutLine* line, int x_pos, int* index_, int* trailing ) ;
|
|
||||||
|
|
||||||
FUNCTION: PangoLayoutIter*
|
|
||||||
pango_layout_get_iter ( PangoLayout* layout ) ;
|
|
||||||
|
|
||||||
FUNCTION: int
|
|
||||||
pango_layout_iter_get_baseline ( PangoLayoutIter* iter ) ;
|
|
||||||
|
|
||||||
FUNCTION: void
|
|
||||||
pango_layout_iter_free ( PangoLayoutIter* iter ) ;
|
|
||||||
|
|
||||||
DESTRUCTOR: pango_layout_iter_free
|
|
||||||
|
|
|
@ -1,31 +1,29 @@
|
||||||
! Copyright (C) 2008 Matthew Willis.
|
! Copyright (C) 2009 Anton Gorenko.
|
||||||
! Copyright (C) 2009 Slava Pestov.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
! See http://factorcode.org/license.txt for BSD license
|
USING: accessors alien.syntax alien.c-types alien.destructors
|
||||||
USING: arrays system alien.destructors alien.c-types alien.syntax alien
|
alien.strings alien.libraries arrays classes.struct combinators
|
||||||
combinators math.rectangles kernel math alien.libraries classes.struct
|
destructors fonts init kernel math math.rectangles memoize
|
||||||
accessors ;
|
io.encodings.utf8 system
|
||||||
IN: pango
|
gir glib glib.ffi ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
<<
|
||||||
! Helpful functions from other parts of pango
|
"pango" {
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
{ [ os winnt? ] [ "libpango-1.0-0.dll" cdecl add-library ] }
|
||||||
|
{ [ os macosx? ] [ "/opt/local/lib/libpango-1.0.0.dylib" cdecl add-library ] }
|
||||||
|
{ [ os unix? ] [ drop ] }
|
||||||
|
} cond
|
||||||
|
>>
|
||||||
|
|
||||||
<< {
|
IN: pango.ffi
|
||||||
{ [ os winnt? ] [ "pango" "libpango-1.0-0.dll" cdecl add-library ] }
|
|
||||||
{ [ os macosx? ] [ "pango" "/opt/local/lib/libpango-1.0.0.dylib" cdecl add-library ] }
|
|
||||||
{ [ os unix? ] [ ] }
|
|
||||||
} cond >>
|
|
||||||
|
|
||||||
LIBRARY: pango
|
TYPEDEF: void PangoLayoutRun ! не совсем верно
|
||||||
|
TYPEDEF: guint32 PangoGlyph
|
||||||
|
|
||||||
CONSTANT: PANGO_SCALE 1024
|
IN-GIR: pango vocab:pango/Pango-1.0.gir
|
||||||
|
|
||||||
: pango>float ( n -- x ) PANGO_SCALE /f ; inline
|
IN: pango.ffi
|
||||||
: float>pango ( x -- n ) PANGO_SCALE * >integer ; inline
|
|
||||||
|
|
||||||
C-TYPE: PangoContext
|
FORGET: PangoRectangle
|
||||||
|
|
||||||
FUNCTION: PangoContext* pango_context_new ( ) ;
|
|
||||||
|
|
||||||
STRUCT: PangoRectangle
|
STRUCT: PangoRectangle
|
||||||
{ x int }
|
{ x int }
|
||||||
|
@ -33,7 +31,36 @@ STRUCT: PangoRectangle
|
||||||
{ width int }
|
{ width int }
|
||||||
{ height int } ;
|
{ height int } ;
|
||||||
|
|
||||||
|
IN: pango
|
||||||
|
|
||||||
|
CONSTANT: PANGO_SCALE 1024
|
||||||
|
|
||||||
|
: pango>float ( n -- x ) PANGO_SCALE /f ; inline
|
||||||
|
: float>pango ( x -- n ) PANGO_SCALE * >integer ; inline
|
||||||
|
|
||||||
: PangoRectangle>rect ( PangoRectangle -- rect )
|
: PangoRectangle>rect ( PangoRectangle -- rect )
|
||||||
[ [ x>> pango>float ] [ y>> pango>float ] bi 2array ]
|
[ [ x>> pango>float ] [ y>> pango>float ] bi 2array ]
|
||||||
[ [ width>> pango>float ] [ height>> pango>float ] bi 2array ] bi
|
[ [ width>> pango>float ] [ height>> pango>float ] bi 2array ] bi
|
||||||
<rect> ;
|
<rect> ;
|
||||||
|
|
||||||
|
DESTRUCTOR: pango_font_description_free
|
||||||
|
|
||||||
|
DESTRUCTOR: pango_layout_iter_free
|
||||||
|
|
||||||
|
! перенести в ui.*?
|
||||||
|
MEMO: (cache-font-description) ( font -- description )
|
||||||
|
[
|
||||||
|
[ pango_font_description_new |pango_font_description_free ] dip {
|
||||||
|
[ name>> utf8 string>alien pango_font_description_set_family ]
|
||||||
|
[ size>> float>pango pango_font_description_set_size ]
|
||||||
|
[ bold?>> PANGO_WEIGHT_BOLD PANGO_WEIGHT_NORMAL ? pango_font_description_set_weight ]
|
||||||
|
[ italic?>> PANGO_STYLE_ITALIC PANGO_STYLE_NORMAL ? pango_font_description_set_style ]
|
||||||
|
[ drop ]
|
||||||
|
} 2cleave
|
||||||
|
] with-destructors ;
|
||||||
|
|
||||||
|
: cache-font-description ( font -- description )
|
||||||
|
strip-font-colors (cache-font-description) ;
|
||||||
|
|
||||||
|
[ \ (cache-font-description) reset-memoized ] "pango" add-startup-hook
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
! Copyright (C) 2009, 2010 Slava Pestov.
|
! Copyright (C) 2009, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors assocs cache kernel math math.vectors
|
USING: accessors assocs cache kernel math math.vectors
|
||||||
namespaces pango.cairo pango.layouts ui.text ui.text.private
|
namespaces pango pango.cairo ui.text ui.text.private
|
||||||
pango sequences ;
|
sequences ;
|
||||||
IN: ui.text.pango
|
IN: ui.text.pango
|
||||||
|
|
||||||
SINGLETON: pango-renderer
|
SINGLETON: pango-renderer
|
||||||
|
|
Loading…
Reference in New Issue