]> git.sur5r.net Git - glabels/commitdiff
2007-01-19 Jim Evins <evins@snaught.com>
authorJim Evins <evins@snaught.com>
Sat, 20 Jan 2007 04:52:11 +0000 (04:52 +0000)
committerJim Evins <evins@snaught.com>
Sat, 20 Jan 2007 04:52:11 +0000 (04:52 +0000)
* src/label-barcode.h:
* src/label-object.c: (gl_label_object_set_font_weight),
(gl_label_object_set_text_alignment),
(gl_label_object_get_font_weight),
(gl_label_object_get_text_alignment):
* src/label-object.h:
* src/label-text.c: (gl_label_text_instance_init), (copy),
(get_size), (set_font_family), (set_font_weight),
(set_text_alignment), (get_font_weight), (get_text_alignment):
* src/label-text.h:
* src/object-editor-text-page.c:
(gl_object_editor_prepare_text_page),
(gl_object_editor_set_font_family),
(gl_object_editor_set_font_weight),
(gl_object_editor_get_font_weight),
(gl_object_editor_set_text_alignment),
(gl_object_editor_get_text_alignment),
(gl_object_editor_set_text_color):
* src/object-editor.h:
* src/prefs-dialog.c: (construct_object_page),
(update_object_page_from_prefs), (update_prefs_from_object_page):
* src/prefs-model.c: (gl_prefs_model_save_settings),
(gl_prefs_model_load_settings):
* src/prefs-model.h:
* src/print.c: (draw_text_object):
* src/ui-property-bar.c: (gl_ui_property_bar_construct),
(reset_to_default_properties), (update_text_properties),
(font_bold_toggled_cb), (text_align_toggled_cb):
* src/ui-sidebar.c:
* src/util.c: (gl_util_align_to_string), (gl_util_string_to_align),
(gl_util_weight_to_string), (gl_util_string_to_weight),
(gl_util_get_font_family_list), (gl_util_font_family_list_free):
* src/util.h:
* src/view-text.c: (update_object_from_editor_cb),
(update_editor_from_object_cb), (draw_hacktext), (draw_cursor):
* src/view.c: (gl_view_set_selection_text_alignment),
(gl_view_set_default_text_alignment),
(gl_view_get_default_text_alignment):
* src/view.h:
* src/xml-label-04.c: (xml04_parse_text_props):
* src/xml-label-191.c: (xml191_parse_text_props):
* src/xml-label.c: (xml_parse_object_text),
(xml_parse_toplevel_span), (xml_create_object_text),
(xml_create_toplevel_span):
Converted all model internals to Pango.  GnomeFont remains in
view until GnomeCanvas can be replaced with a cairo-based canvas.

git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@608 f5e0f49d-192f-0410-a22d-a8d8700d0965

22 files changed:
glabels2/ChangeLog
glabels2/src/label-barcode.h
glabels2/src/label-object.c
glabels2/src/label-object.h
glabels2/src/label-text.c
glabels2/src/label-text.h
glabels2/src/object-editor-text-page.c
glabels2/src/object-editor.h
glabels2/src/prefs-dialog.c
glabels2/src/prefs-model.c
glabels2/src/prefs-model.h
glabels2/src/print.c
glabels2/src/ui-property-bar.c
glabels2/src/ui-sidebar.c
glabels2/src/util.c
glabels2/src/util.h
glabels2/src/view-text.c
glabels2/src/view.c
glabels2/src/view.h
glabels2/src/xml-label-04.c
glabels2/src/xml-label-191.c
glabels2/src/xml-label.c

index 1194dcf2b7ea5abbb28fc12162f757a34a3a8b9b..c2e8f648011e9bfe5c2d6b3c8b5a2b52f3a643e0 100644 (file)
@@ -1,3 +1,52 @@
+2007-01-19  Jim Evins  <evins@snaught.com>
+
+       * src/label-barcode.h:
+       * src/label-object.c: (gl_label_object_set_font_weight),
+       (gl_label_object_set_text_alignment),
+       (gl_label_object_get_font_weight),
+       (gl_label_object_get_text_alignment):
+       * src/label-object.h:
+       * src/label-text.c: (gl_label_text_instance_init), (copy),
+       (get_size), (set_font_family), (set_font_weight),
+       (set_text_alignment), (get_font_weight), (get_text_alignment):
+       * src/label-text.h:
+       * src/object-editor-text-page.c:
+       (gl_object_editor_prepare_text_page),
+       (gl_object_editor_set_font_family),
+       (gl_object_editor_set_font_weight),
+       (gl_object_editor_get_font_weight),
+       (gl_object_editor_set_text_alignment),
+       (gl_object_editor_get_text_alignment),
+       (gl_object_editor_set_text_color):
+       * src/object-editor.h:
+       * src/prefs-dialog.c: (construct_object_page),
+       (update_object_page_from_prefs), (update_prefs_from_object_page):
+       * src/prefs-model.c: (gl_prefs_model_save_settings),
+       (gl_prefs_model_load_settings):
+       * src/prefs-model.h:
+       * src/print.c: (draw_text_object):
+       * src/ui-property-bar.c: (gl_ui_property_bar_construct),
+       (reset_to_default_properties), (update_text_properties),
+       (font_bold_toggled_cb), (text_align_toggled_cb):
+       * src/ui-sidebar.c:
+       * src/util.c: (gl_util_align_to_string), (gl_util_string_to_align),
+       (gl_util_weight_to_string), (gl_util_string_to_weight),
+       (gl_util_get_font_family_list), (gl_util_font_family_list_free):
+       * src/util.h:
+       * src/view-text.c: (update_object_from_editor_cb),
+       (update_editor_from_object_cb), (draw_hacktext), (draw_cursor):
+       * src/view.c: (gl_view_set_selection_text_alignment),
+       (gl_view_set_default_text_alignment),
+       (gl_view_get_default_text_alignment):
+       * src/view.h:
+       * src/xml-label-04.c: (xml04_parse_text_props):
+       * src/xml-label-191.c: (xml191_parse_text_props):
+       * src/xml-label.c: (xml_parse_object_text),
+       (xml_parse_toplevel_span), (xml_create_object_text),
+       (xml_create_toplevel_span):
+               Converted all model internals to Pango.  GnomeFont remains in
+       view until GnomeCanvas can be replaced with a cairo-based canvas.
+       
 2007-01-17  Jim Evins  <evins@snaught.com>
 
        * src/Makefile.am:
index 38bdf045083bca47c74ee9f8ab8e9a60b15f3a21..507cdcd41fde7317afc44a2d04d0ecf393c6639e 100644 (file)
@@ -23,8 +23,6 @@
 #ifndef __LABEL_BARCODE_H__
 #define __LABEL_BARCODE_H__
 
-#include <gtk/gtkenums.h>
-#include <libgnomeprint/gnome-font.h>
 #include "bc.h"
 #include "text-node.h"
 #include "label-object.h"
index b1bdec06a486532603a2ef4f1036d11639035aa8..7d31868bac1bb653b9154fed801dfdb75c88b649 100644 (file)
@@ -1,9 +1,11 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
 /*
  *  (GLABELS) Label and Business Card Creation program for GNOME
  *
  *  label_object.c:  GLabels label object base class
  *
- *  Copyright (C) 2001-2002  Jim Evins <evins@snaught.com>.
+ *  Copyright (C) 2001-2007  Jim Evins <evins@snaught.com>.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -707,7 +709,7 @@ gl_label_object_set_font_size (glLabelObject     *object,
 /****************************************************************************/
 void
 gl_label_object_set_font_weight (glLabelObject     *object,
-                                GnomeFontWeight    font_weight)
+                                PangoWeight        font_weight)
 {
        gl_debug (DEBUG_LABEL, "START");
 
@@ -750,7 +752,7 @@ gl_label_object_set_font_italic_flag (glLabelObject     *object,
 /****************************************************************************/
 void
 gl_label_object_set_text_alignment (glLabelObject     *object,
-                                   GtkJustification   text_alignment)
+                                   PangoAlignment     text_alignment)
 {
        gl_debug (DEBUG_LABEL, "START");
 
@@ -860,14 +862,14 @@ gl_label_object_get_font_size (glLabelObject     *object)
 /****************************************************************************/
 /* Get font weight for all text contained in object.                        */
 /****************************************************************************/
-GnomeFontWeight
+PangoWeight    
 gl_label_object_get_font_weight (glLabelObject     *object)
 {
-       GnomeFontWeight ret = GNOME_FONT_BOOK;
+       PangoWeight     ret = PANGO_WEIGHT_NORMAL;
 
        gl_debug (DEBUG_LABEL, "START");
 
-       g_return_val_if_fail (object && GL_IS_LABEL_OBJECT (object), GNOME_FONT_BOOK);
+       g_return_val_if_fail (object && GL_IS_LABEL_OBJECT (object), PANGO_WEIGHT_NORMAL);
 
        if ( GL_LABEL_OBJECT_GET_CLASS(object)->get_font_weight != NULL ) {
 
@@ -908,14 +910,14 @@ gl_label_object_get_font_italic_flag (glLabelObject     *object)
 /****************************************************************************/
 /* Get text alignment for all text contained in object.                     */
 /****************************************************************************/
-GtkJustification
+PangoAlignment
 gl_label_object_get_text_alignment (glLabelObject     *object)
 {
-       GtkJustification ret = GTK_JUSTIFY_LEFT;
+       PangoAlignment ret = PANGO_ALIGN_LEFT;
 
        gl_debug (DEBUG_LABEL, "START");
 
-       g_return_val_if_fail (object && GL_IS_LABEL_OBJECT (object), GTK_JUSTIFY_LEFT);
+       g_return_val_if_fail (object && GL_IS_LABEL_OBJECT (object), PANGO_ALIGN_LEFT);
 
        if ( GL_LABEL_OBJECT_GET_CLASS(object)->get_text_alignment != NULL ) {
 
index 8464118e6a933502d142553ca47ed4170889e900..a7b6bb8973718deb0172181ecbe2585e3ed9ed6d 100644 (file)
@@ -1,9 +1,11 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
 /*
  *  (GLABELS) Label and Business Card Creation program for GNOME
  *
  *  label_object.h:  GLabels label object base class
  *
- *  Copyright (C) 2001-2002  Jim Evins <evins@snaught.com>.
+ *  Copyright (C) 2001-2007  Jim Evins <evins@snaught.com>.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -24,8 +26,7 @@
 #define __LABEL_OBJECT_H__
 
 #include <glib-object.h>
-#include <gtk/gtkenums.h>
-#include <libgnomeprint/gnome-font.h>
+#include <pango/pango.h>
 
 G_BEGIN_DECLS
 
@@ -57,100 +58,100 @@ typedef struct _glLabelObjectPrivate   glLabelObjectPrivate;
 #include "color.h"
 
 struct _glLabelObject {
-       GObject               object;
+        GObject               object;
 
-       glLabel              *parent;
+        glLabel              *parent;
 
-       glLabelObjectPrivate *private;
+        glLabelObjectPrivate *private;
 };
 
 struct _glLabelObjectClass {
-       GObjectClass          parent_class;
+        GObjectClass          parent_class;
 
-       /*
-        * Methods
-        */
+        /*
+         * Methods
+         */
 
-       void              (*set_size)             (glLabelObject     *object,
-                                                  gdouble            w,
-                                                  gdouble            h);
+        void              (*set_size)             (glLabelObject     *object,
+                                                   gdouble            w,
+                                                   gdouble            h);
 
-       void              (*get_size)             (glLabelObject     *object,
-                                                  gdouble           *w,
-                                                  gdouble           *h);
+        void              (*get_size)             (glLabelObject     *object,
+                                                   gdouble           *w,
+                                                   gdouble           *h);
 
-       void              (*set_font_family)      (glLabelObject     *object,
-                                                  const gchar       *font_family);
+        void              (*set_font_family)      (glLabelObject     *object,
+                                                   const gchar       *font_family);
 
-       void              (*set_font_size)        (glLabelObject     *object,
-                                                  gdouble            font_size);
+        void              (*set_font_size)        (glLabelObject     *object,
+                                                   gdouble            font_size);
 
-       void              (*set_font_weight)      (glLabelObject     *object,
-                                                  GnomeFontWeight    font_weight);
+        void              (*set_font_weight)      (glLabelObject     *object,
+                                                   PangoWeight        font_weight);
 
-       void              (*set_font_italic_flag) (glLabelObject     *object,
-                                                  gboolean           font_italic_flag);
+        void              (*set_font_italic_flag) (glLabelObject     *object,
+                                                   gboolean           font_italic_flag);
 
-       void              (*set_text_alignment)   (glLabelObject     *object,
-                                                  GtkJustification   text_alignment);
+        void              (*set_text_alignment)   (glLabelObject     *object,
+                                                   PangoAlignment     text_alignment);
 
-       void              (*set_text_line_spacing) (glLabelObject    *object,
-                                                   gdouble           text_line_spacing);
+        void              (*set_text_line_spacing) (glLabelObject    *object,
+                                                    gdouble           text_line_spacing);
 
-       void              (*set_text_color)       (glLabelObject     *object,
-                                                  glColorNode       *text_color_node);
+        void              (*set_text_color)       (glLabelObject     *object,
+                                                   glColorNode       *text_color_node);
 
-       void              (*set_fill_color)       (glLabelObject     *object,
-                                                  glColorNode       *fill_color_node);
+        void              (*set_fill_color)       (glLabelObject     *object,
+                                                   glColorNode       *fill_color_node);
 
-       void              (*set_line_color)       (glLabelObject     *object,
-                                                  glColorNode       *line_color_node);
+        void              (*set_line_color)       (glLabelObject     *object,
+                                                   glColorNode       *line_color_node);
 
-       void              (*set_line_width)       (glLabelObject     *object,
-                                                  gdouble            line_width);
+        void              (*set_line_width)       (glLabelObject     *object,
+                                                   gdouble            line_width);
 
-       gchar            *(*get_font_family)      (glLabelObject     *object);
+        gchar            *(*get_font_family)      (glLabelObject     *object);
 
-       gdouble           (*get_font_size)        (glLabelObject     *object);
+        gdouble           (*get_font_size)        (glLabelObject     *object);
 
-       GnomeFontWeight   (*get_font_weight)      (glLabelObject     *object);
+        PangoWeight       (*get_font_weight)      (glLabelObject     *object);
 
-       gboolean          (*get_font_italic_flag) (glLabelObject     *object);
+        gboolean          (*get_font_italic_flag) (glLabelObject     *object);
 
-       GtkJustification  (*get_text_alignment)   (glLabelObject     *object);
+        PangoAlignment    (*get_text_alignment)   (glLabelObject     *object);
 
-       gdouble           (*get_text_line_spacing) (glLabelObject    *object);
+        gdouble           (*get_text_line_spacing) (glLabelObject    *object);
 
-       glColorNode*      (*get_text_color)       (glLabelObject     *object);
+        glColorNode*      (*get_text_color)       (glLabelObject     *object);
 
-       glColorNode*      (*get_fill_color)       (glLabelObject     *object);
+        glColorNode*      (*get_fill_color)       (glLabelObject     *object);
 
-       glColorNode*      (*get_line_color)       (glLabelObject     *object);
+        glColorNode*      (*get_line_color)       (glLabelObject     *object);
 
-       gdouble           (*get_line_width)       (glLabelObject     *object);
+        gdouble           (*get_line_width)       (glLabelObject     *object);
 
-       void              (*copy)                 (glLabelObject     *dst_object,
-                                                  glLabelObject     *src_object);
+        void              (*copy)                 (glLabelObject     *dst_object,
+                                                   glLabelObject     *src_object);
 
-       /*
-        * Signals
-        */
-       void (*changed)     (glLabelObject     *object,
-                            gpointer            user_data);
+        /*
+         * Signals
+         */
+        void (*changed)     (glLabelObject     *object,
+                             gpointer            user_data);
 
-       void (*moved)       (glLabelObject     *object,
-                            gdouble            dx,
-                            gdouble            dy,
-                            gpointer           user_data);
+        void (*moved)       (glLabelObject     *object,
+                             gdouble            dx,
+                             gdouble            dy,
+                             gpointer           user_data);
 
-       void (*flip_rotate) (glLabelObject     *object,
-                            gpointer           user_data);
+        void (*flip_rotate) (glLabelObject     *object,
+                             gpointer           user_data);
 
-       void (*top)         (glLabelObject     *object,
-                            gpointer           user_data);
+        void (*top)         (glLabelObject     *object,
+                             gpointer           user_data);
 
-       void (*bottom)      (glLabelObject     *object,
-                            gpointer           user_data);
+        void (*bottom)      (glLabelObject     *object,
+                             gpointer           user_data);
 };
 
 GType          gl_label_object_get_type              (void) G_GNUC_CONST;
@@ -159,87 +160,87 @@ GObject       *gl_label_object_new                   (glLabel           *label);
 
 
 glLabelObject *gl_label_object_dup                   (glLabelObject     *src_object,
-                                                     glLabel           *label);
+                                                      glLabel           *label);
 
 void           gl_label_object_emit_changed          (glLabelObject     *object);
 
 
 void           gl_label_object_set_parent            (glLabelObject     *object,
-                                                     glLabel           *label);
+                                                      glLabel           *label);
 
 glLabel       *gl_label_object_get_parent            (glLabelObject     *object);
 
 
 void           gl_label_object_set_name              (glLabelObject     *object,
-                                                     gchar             *name);
+                                                      gchar             *name);
 
 gchar         *gl_label_object_get_name              (glLabelObject     *object);
 
 
 void           gl_label_object_set_position          (glLabelObject     *object,
-                                                     gdouble            x,
-                                                     gdouble            y);
+                                                      gdouble            x,
+                                                      gdouble            y);
 
 void           gl_label_object_set_position_relative (glLabelObject     *object,
-                                                     gdouble            dx,
-                                                     gdouble            dy);
+                                                      gdouble            dx,
+                                                      gdouble            dy);
 
 void           gl_label_object_get_position          (glLabelObject     *object,
-                                                     gdouble           *x,
-                                                     gdouble           *y);
+                                                      gdouble           *x,
+                                                      gdouble           *y);
 
 void           gl_label_object_set_size              (glLabelObject     *object,
-                                                     gdouble            w,
-                                                     gdouble            h);
+                                                      gdouble            w,
+                                                      gdouble            h);
 
 void           gl_label_object_set_size_honor_aspect (glLabelObject     *object,
-                                                     gdouble            w,
-                                                     gdouble            h);
+                                                      gdouble            w,
+                                                      gdouble            h);
 
 void           gl_label_object_get_size              (glLabelObject     *object,
-                                                     gdouble           *w,
-                                                     gdouble           *h);
+                                                      gdouble           *w,
+                                                      gdouble           *h);
 
 void           gl_label_object_get_extent            (glLabelObject     *object,
-                                                     gdouble           *x1,
-                                                     gdouble           *y1,
-                                                     gdouble           *x2,
-                                                     gdouble           *y2);
+                                                      gdouble           *x1,
+                                                      gdouble           *y1,
+                                                      gdouble           *x2,
+                                                      gdouble           *y2);
 
 
 gboolean       gl_label_object_can_text              (glLabelObject     *object);
 
 void           gl_label_object_set_font_family       (glLabelObject     *object,
-                                                     const gchar       *font_family);
+                                                      const gchar       *font_family);
 
 void           gl_label_object_set_font_size         (glLabelObject     *object,
-                                                     gdouble            font_size);
+                                                      gdouble            font_size);
 
 void           gl_label_object_set_font_weight       (glLabelObject     *object,
-                                                     GnomeFontWeight    font_weight);
+                                                      PangoWeight        font_weight);
 
 void           gl_label_object_set_font_italic_flag  (glLabelObject     *object,
-                                                     gboolean           font_italic_flag);
+                                                      gboolean           font_italic_flag);
 
 void           gl_label_object_set_text_alignment    (glLabelObject     *object,
-                                                     GtkJustification   text_alignment);
+                                                      PangoAlignment     text_alignment);
 
 void           gl_label_object_set_text_color        (glLabelObject     *object,
-                                                     glColorNode       *text_color_node);
+                                                      glColorNode       *text_color_node);
 
 void           gl_label_object_set_text_line_spacing (glLabelObject     *object,
-                                                     gdouble            text_line_spacing);
+                                                      gdouble            text_line_spacing);
 
 
 gchar           *gl_label_object_get_font_family       (glLabelObject     *object);
 
 gdouble          gl_label_object_get_font_size         (glLabelObject     *object);
 
-GnomeFontWeight  gl_label_object_get_font_weight       (glLabelObject     *object);
+PangoWeight      gl_label_object_get_font_weight       (glLabelObject     *object);
 
 gboolean         gl_label_object_get_font_italic_flag  (glLabelObject     *object);
 
-GtkJustification gl_label_object_get_text_alignment    (glLabelObject     *object);
+PangoAlignment   gl_label_object_get_text_alignment    (glLabelObject     *object);
 
 gdouble          gl_label_object_get_text_line_spacing (glLabelObject     *object);
 
@@ -249,7 +250,7 @@ glColorNode     *gl_label_object_get_text_color        (glLabelObject     *objec
 gboolean       gl_label_object_can_fill              (glLabelObject     *object);
 
 void           gl_label_object_set_fill_color        (glLabelObject     *object,
-                                                     glColorNode       *fill_color_node);
+                                                      glColorNode       *fill_color_node);
 
 glColorNode*   gl_label_object_get_fill_color        (glLabelObject     *object);
 
@@ -257,14 +258,14 @@ glColorNode*   gl_label_object_get_fill_color        (glLabelObject     *object)
 gboolean       gl_label_object_can_line_color        (glLabelObject     *object);
 
 void           gl_label_object_set_line_color        (glLabelObject     *object,
-                                                     glColorNode       *line_color_node);
+                                                      glColorNode       *line_color_node);
 
 glColorNode   *gl_label_object_get_line_color        (glLabelObject     *object);
 
 gboolean       gl_label_object_can_line_width        (glLabelObject     *object);
 
 void           gl_label_object_set_line_width        (glLabelObject     *object,
-                                                     gdouble            line_width);
+                                                      gdouble            line_width);
 
 gdouble        gl_label_object_get_line_width        (glLabelObject     *object);
 
@@ -279,38 +280,38 @@ void           gl_label_object_flip_horiz            (glLabelObject     *object)
 void           gl_label_object_flip_vert             (glLabelObject     *object);
 
 void           gl_label_object_rotate                (glLabelObject     *object,
-                                                     gdouble            theta_degs);
+                                                      gdouble            theta_degs);
 
 void           gl_label_object_set_affine            (glLabelObject     *object,
-                                                     gdouble           affine[6]);
+                                                      gdouble           affine[6]);
 
 void           gl_label_object_get_affine            (glLabelObject     *object,
-                                                     gdouble           affine[6]);
+                                                      gdouble           affine[6]);
 
 void           gl_label_object_get_i2w_affine        (glLabelObject     *object,
-                                                     gdouble           affine[6]);
+                                                      gdouble           affine[6]);
 
 void           gl_label_object_get_w2i_affine        (glLabelObject     *object,
-                                                     gdouble           affine[6]);
+                                                      gdouble           affine[6]);
 
 void           gl_label_object_set_shadow_state      (glLabelObject     *object,
-                                                     gboolean           state);
+                                                      gboolean           state);
 
 void           gl_label_object_set_shadow_offset     (glLabelObject     *object,
-                                                     gdouble            x,
-                                                     gdouble            y);
+                                                      gdouble            x,
+                                                      gdouble            y);
 
 void           gl_label_object_set_shadow_color      (glLabelObject     *object,
-                                                     glColorNode       *color_node);
+                                                      glColorNode       *color_node);
 
 void           gl_label_object_set_shadow_opacity    (glLabelObject     *object,
-                                                     gdouble            alpha);
+                                                      gdouble            alpha);
 
 gboolean       gl_label_object_get_shadow_state      (glLabelObject     *object);
 
 void           gl_label_object_get_shadow_offset     (glLabelObject     *object,
-                                                     gdouble           *x,
-                                                     gdouble           *y);
+                                                      gdouble           *x,
+                                                      gdouble           *y);
 
 glColorNode*   gl_label_object_get_shadow_color      (glLabelObject     *object);
 
index fd8da7e17344a85bc269f7ad461c135289a1a90a..bb61ff05134e1d785e7e92ca3704e1ff746ad411 100644 (file)
@@ -1,9 +1,11 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
 /*
  *  (GLABELS) Label and Business Card Creation program for GNOME
  *
  *  label_text.c:  GLabels label text object
  *
- *  Copyright (C) 2001-2002  Jim Evins <evins@snaught.com>.
+ *  Copyright (C) 2001-2007  Jim Evins <evins@snaught.com>.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -25,7 +27,9 @@
 #include <glib/gmem.h>
 #include <glib/gstrfuncs.h>
 #include <glib/gmessages.h>
-#include <libgnomeprint/gnome-glyphlist.h>
+#include <pango/pango.h>
+
+#include "util.h"
 
 #include "debug.h"
 
 
 #define DEFAULT_FONT_FAMILY       "Sans"
 #define DEFAULT_FONT_SIZE         14.0
-#define DEFAULT_FONT_WEIGHT       GNOME_FONT_BOOK
+#define DEFAULT_FONT_WEIGHT       PANGO_WEIGHT_NORMAL
 #define DEFAULT_FONT_ITALIC_FLAG  FALSE
-#define DEFAULT_JUST              GTK_JUSTIFY_LEFT
-#define DEFAULT_COLOR             GNOME_CANVAS_COLOR (0,0,0)
+#define DEFAULT_ALIGN             PANGO_ALIGN_LEFT
+#define DEFAULT_COLOR             GL_COLOR (0,0,0)
 #define DEFAULT_TEXT_LINE_SPACING 1.0
 #define DEFAULT_AUTO_SHRINK       FALSE
 
+#define FONT_SCALE (72.0/96.0)
+
 /*========================================================*/
 /* Private types.                                         */
 /*========================================================*/
@@ -52,9 +58,9 @@ struct _glLabelTextPrivate {
 
        gchar           *font_family;
        gdouble          font_size;
-       GnomeFontWeight  font_weight;
+       PangoWeight      font_weight;
        gboolean         font_italic_flag;
-       GtkJustification just;
+       PangoAlignment   align;
        glColorNode     *color_node;
        gdouble          line_spacing;
        gboolean         auto_shrink;
@@ -93,13 +99,13 @@ static void set_font_size               (glLabelObject    *object,
                                         gdouble           font_size);
 
 static void set_font_weight             (glLabelObject    *object,
-                                        GnomeFontWeight   font_weight);
+                                        PangoWeight       font_weight);
 
 static void set_font_italic_flag        (glLabelObject    *object,
                                         gboolean          font_italic_flag);
 
 static void set_text_alignment          (glLabelObject    *object,
-                                        GtkJustification  text_alignment);
+                                        PangoAlignment    text_alignment);
 
 static void set_text_line_spacing       (glLabelObject    *object,
                                         gdouble           text_line_spacing);
@@ -111,11 +117,11 @@ static gchar          *get_font_family             (glLabelObject    *object);
 
 static gdouble         get_font_size               (glLabelObject    *object);
 
-static GnomeFontWeight get_font_weight             (glLabelObject    *object);
+static PangoWeight     get_font_weight             (glLabelObject    *object);
 
 static gboolean        get_font_italic_flag        (glLabelObject    *object);
 
-static GtkJustification get_text_alignment         (glLabelObject    *object);
+static PangoAlignment  get_text_alignment         (glLabelObject    *object);
 
 static gdouble         get_text_line_spacing       (glLabelObject    *object);
 
@@ -193,7 +199,7 @@ gl_label_text_instance_init (glLabelText *ltext)
        ltext->private->font_size         = DEFAULT_FONT_SIZE;
        ltext->private->font_weight       = DEFAULT_FONT_WEIGHT;
        ltext->private->font_italic_flag  = DEFAULT_FONT_ITALIC_FLAG;
-       ltext->private->just              = DEFAULT_JUST;
+       ltext->private->align              = DEFAULT_ALIGN;
        ltext->private->color_node        = gl_color_node_new_default ();
        ltext->private->color_node->color = DEFAULT_COLOR;
        ltext->private->line_spacing      = DEFAULT_TEXT_LINE_SPACING;
@@ -262,7 +268,7 @@ copy (glLabelObject *dst_object,
        new_ltext->private->font_weight      = ltext->private->font_weight;
        new_ltext->private->font_italic_flag = ltext->private->font_italic_flag;
        set_text_color (dst_object, text_color_node);
-       new_ltext->private->just             = ltext->private->just;
+       new_ltext->private->align             = ltext->private->align;
        new_ltext->private->line_spacing     = ltext->private->line_spacing;
        new_ltext->private->auto_shrink      = ltext->private->auto_shrink;
 
@@ -350,16 +356,17 @@ get_size (glLabelObject *object,
          gdouble       *w,
          gdouble       *h)
 {
-       glLabelText    *ltext = (glLabelText *)object;
-       GnomeFont      *font;
-       GtkTextIter     start, end;
-       gchar          *text;
-       gchar         **line;
-       gint            i;
-       GnomeGlyphList *glyphlist;
-       ArtDRect        bbox;
-       gdouble         affine[6];
-       gdouble         w_parent, h_parent;
+       glLabelText          *ltext = (glLabelText *)object;
+       PangoFontMap         *fontmap;
+       PangoContext         *context;
+       cairo_font_options_t *options;
+        PangoStyle            style;
+        PangoLayout          *layout;
+        PangoFontDescription *desc;
+       GtkTextIter           start, end;
+       gchar                *text;
+       gdouble               w_parent, h_parent;
+       gint                  iw, ih;
 
        gl_debug (DEBUG_LABEL, "START");
 
@@ -373,49 +380,39 @@ get_size (glLabelObject *object,
                return;
        }
 
-       font = gnome_font_find_closest_from_weight_slant (
-               (guchar *)ltext->private->font_family,
-               ltext->private->font_weight,
-               ltext->private->font_italic_flag,
-               ltext->private->font_size);
-
        gtk_text_buffer_get_bounds (ltext->private->buffer, &start, &end);
        text = gtk_text_buffer_get_text (ltext->private->buffer,
                                         &start, &end, FALSE);
-       line = g_strsplit (text, "\n", -1);
-       g_free (text);
-
-       art_affine_identity (affine);
-
-       *w = 0.0;
-       *h = 0.0;
-       for (i = 0; line[i] != NULL; i++) {
-
-               glyphlist = gnome_glyphlist_from_text_dumb (font, 0,
-                                                           0.0, 0.0,
-                                                           (guchar *)line[i]);
-
-               gnome_glyphlist_bbox (glyphlist, affine, 0, &bbox);
-
-               gnome_glyphlist_unref (glyphlist);
 
-               if ( bbox.x1 > *w ) *w = bbox.x1;
-
-               if (i) {
-                       *h += ltext->private->line_spacing * ltext->private->font_size;
-               } else {
-                       *h += ltext->private->font_size;
-               }
-
-       }
-
-       if ( *h == 0.0 ) *h = ltext->private->font_size;
-
-       *w += 2*GL_LABEL_TEXT_MARGIN;
-       *h += 2*GL_LABEL_TEXT_MARGIN;
-
-
-       g_strfreev (line);
+       
+       fontmap = pango_cairo_font_map_new ();
+       context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap));
+       options = cairo_font_options_create ();
+       cairo_font_options_set_hint_metrics (options, CAIRO_HINT_METRICS_OFF);
+       pango_cairo_context_set_font_options (context, options);
+       cairo_font_options_destroy (options);
+
+       layout = pango_layout_new (context);
+
+        style = GL_LABEL_TEXT (object)->private->font_italic_flag ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL;
+
+       desc = pango_font_description_new ();
+       pango_font_description_set_family (desc, GL_LABEL_TEXT (object)->private->font_family);
+       pango_font_description_set_weight (desc, GL_LABEL_TEXT (object)->private->font_weight);
+       pango_font_description_set_style  (desc, style);
+       pango_font_description_set_size   (desc, GL_LABEL_TEXT (object)->private->font_size * PANGO_SCALE * FONT_SCALE);
+       pango_layout_set_font_description (layout, desc);
+       pango_font_description_free       (desc);
+
+       pango_layout_set_text (layout, text, -1);
+       pango_layout_get_size (layout, &iw, &ih);
+       *w = iw / PANGO_SCALE + 2*GL_LABEL_TEXT_MARGIN;
+       *h = ih / PANGO_SCALE;
+
+       g_object_unref (layout);
+       g_object_unref (context);
+       g_object_unref (fontmap);
+       g_free (text);
 
        gl_debug (DEBUG_LABEL, "END");
 }
@@ -436,7 +433,7 @@ set_font_family (glLabelObject *object,
        g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext));
        g_return_if_fail (font_family);
 
-       family_names = gnome_font_family_list ();
+       family_names = gl_util_get_font_family_list ();
        if (g_list_find_custom (family_names, font_family, (GCompareFunc)g_utf8_collate)) {
                good_font_family = g_strdup (font_family);
        } else {
@@ -446,7 +443,7 @@ set_font_family (glLabelObject *object,
                        good_font_family = g_strdup (font_family);
                }
        }
-       gnome_font_family_list_free (family_names);
+       gl_util_font_family_list_free (family_names);
 
        if (ltext->private->font_family) {
                if (g_strcasecmp (ltext->private->font_family, good_font_family) == 0) {
@@ -494,7 +491,7 @@ set_font_size (glLabelObject *object,
 /*---------------------------------------------------------------------------*/
 static void
 set_font_weight (glLabelObject   *object,
-                GnomeFontWeight  font_weight)
+                PangoWeight      font_weight)
 {
        glLabelText    *ltext = (glLabelText *)object;
 
@@ -540,7 +537,7 @@ set_font_italic_flag (glLabelObject *object,
 /*---------------------------------------------------------------------------*/
 static void
 set_text_alignment (glLabelObject    *object,
-                   GtkJustification  text_alignment)
+                   PangoAlignment    text_alignment)
 {
        glLabelText    *ltext = (glLabelText *)object;
 
@@ -548,9 +545,9 @@ set_text_alignment (glLabelObject    *object,
 
        g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext));
 
-       if (ltext->private->just != text_alignment) {
+       if (ltext->private->align != text_alignment) {
 
-               ltext->private->just = text_alignment;
+               ltext->private->align = text_alignment;
                gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext));
 
        }
@@ -639,14 +636,14 @@ get_font_size (glLabelObject *object)
 /*---------------------------------------------------------------------------*/
 /* PRIVATE.  get font weight method.                                         */
 /*---------------------------------------------------------------------------*/
-static GnomeFontWeight
+static PangoWeight
 get_font_weight (glLabelObject   *object)
 {
        glLabelText    *ltext = (glLabelText *)object;
 
        gl_debug (DEBUG_LABEL, "");
 
-       g_return_val_if_fail (ltext && GL_IS_LABEL_TEXT (ltext), GNOME_FONT_BOOK);
+       g_return_val_if_fail (ltext && GL_IS_LABEL_TEXT (ltext), PANGO_WEIGHT_NORMAL);
 
        return ltext->private->font_weight;
 }
@@ -669,7 +666,7 @@ get_font_italic_flag (glLabelObject *object)
 /*---------------------------------------------------------------------------*/
 /* PRIVATE.  get text alignment method.                                      */
 /*---------------------------------------------------------------------------*/
-static GtkJustification
+static PangoAlignment
 get_text_alignment (glLabelObject    *object)
 {
        glLabelText    *ltext = (glLabelText *)object;
@@ -678,7 +675,7 @@ get_text_alignment (glLabelObject    *object)
 
        g_return_val_if_fail (ltext && GL_IS_LABEL_TEXT (ltext), GTK_JUSTIFY_LEFT);
 
-       return ltext->private->just;
+       return ltext->private->align;
 }
 
 /*---------------------------------------------------------------------------*/
index 57deadb19d0d5643279b3f14a6f47ae33dfd0b30..50a359a0d54c23e244d911b6532ed5c8fef723e5 100644 (file)
@@ -1,3 +1,5 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
 /*
  *  (GLABELS) Label and Business Card Creation program for GNOME
  *
@@ -23,9 +25,7 @@
 #ifndef __LABEL_TEXT_H__
 #define __LABEL_TEXT_H__
 
-#include <gtk/gtkenums.h>
 #include <gtk/gtktextbuffer.h>
-#include <libgnomeprint/gnome-font.h>
 #include "text-node.h"
 #include "label-object.h"
 
index ab93283bb160e987da1d9b1dce2d3fcaa8f11791..be4e231e3dfd925113e149d03c939af00f956fbf 100644 (file)
@@ -32,6 +32,7 @@
 #include "prefs.h"
 #include "mygal/widget-color-combo.h"
 #include "color.h"
+#include "util.h"
 
 #include "object-editor-private.h"
 
@@ -102,10 +103,10 @@ gl_object_editor_prepare_text_page (glObjectEditor       *editor)
        gl_util_combo_box_add_text_model ( GTK_COMBO_BOX(editor->priv->text_color_key_combo));
 
        /* Load family names */
-       family_names = gnome_font_family_list ();
+       family_names = gl_util_get_font_family_list ();
        gl_util_combo_box_set_strings (GTK_COMBO_BOX(editor->priv->text_family_combo),
                                       family_names);
-       gnome_font_family_list_free (family_names);
+       gl_util_font_family_list_free (family_names);
 
        /* Modify widgets */
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_color_radio), TRUE);
@@ -232,7 +233,7 @@ gl_object_editor_set_font_family (glObjectEditor      *editor,
                                         editor);
 
         /* Make sure we have a valid font family.  if not provide a good default. */
-        family_names = gnome_font_family_list ();
+        family_names = gl_util_get_font_family_list ();
         if (g_list_find_custom (family_names, font_family, (GCompareFunc)g_utf8_collate)) {
                 good_font_family = g_strdup (font_family);
         } else {
@@ -242,7 +243,7 @@ gl_object_editor_set_font_family (glObjectEditor      *editor,
                         good_font_family = NULL;
                 }
         }
-        gnome_font_family_list_free (family_names);
+        gl_util_font_family_list_free (family_names);
         gl_util_combo_box_set_active_text (GTK_COMBO_BOX (editor->priv->text_family_combo), good_font_family);
         g_free (good_font_family);
 
@@ -316,7 +317,7 @@ gl_object_editor_get_font_size (glObjectEditor      *editor)
 /*****************************************************************************/
 void
 gl_object_editor_set_font_weight (glObjectEditor      *editor,
-                                 GnomeFontWeight      font_weight)
+                                 PangoWeight          font_weight)
 {
        gl_debug (DEBUG_EDITOR, "START");
 
@@ -325,7 +326,7 @@ gl_object_editor_set_font_weight (glObjectEditor      *editor,
                                         editor);
 
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_bold_toggle),
-                                      (font_weight == GNOME_FONT_BOLD));
+                                      (font_weight == PANGO_WEIGHT_BOLD));
 
        g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_bold_toggle),
                                           gl_object_editor_changed_cb,
@@ -337,18 +338,18 @@ gl_object_editor_set_font_weight (glObjectEditor      *editor,
 /*****************************************************************************/
 /* Query font weight.                                                        */
 /*****************************************************************************/
-GnomeFontWeight
+PangoWeight
 gl_object_editor_get_font_weight (glObjectEditor      *editor)
 {
-       GnomeFontWeight font_weight;
+       PangoWeight font_weight;
 
        gl_debug (DEBUG_EDITOR, "START");
 
         if (gtk_toggle_button_get_active
            (GTK_TOGGLE_BUTTON (editor->priv->text_bold_toggle))) {
-                font_weight = GNOME_FONT_BOLD;
+                font_weight = PANGO_WEIGHT_BOLD;
         } else {
-                font_weight = GNOME_FONT_BOOK;
+                font_weight = PANGO_WEIGHT_NORMAL;
         }
 
        gl_debug (DEBUG_EDITOR, "END");
@@ -404,7 +405,7 @@ gl_object_editor_get_font_italic_flag (glObjectEditor      *editor)
 /*****************************************************************************/
 void
 gl_object_editor_set_text_alignment (glObjectEditor      *editor,
-                                    GtkJustification     just)
+                                    PangoAlignment       align)
 {
        gl_debug (DEBUG_EDITOR, "START");
 
@@ -419,11 +420,11 @@ gl_object_editor_set_text_alignment (glObjectEditor      *editor,
                                         editor);
 
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_left_toggle),
-                                      (just == GTK_JUSTIFY_LEFT));
+                                      (align == PANGO_ALIGN_LEFT));
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_center_toggle),
-                                      (just == GTK_JUSTIFY_CENTER));
+                                      (align == PANGO_ALIGN_CENTER));
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_right_toggle),
-                                      (just == GTK_JUSTIFY_RIGHT));
+                                      (align == PANGO_ALIGN_RIGHT));
 
        g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_left_toggle),
                                           align_toggle_cb,
@@ -441,31 +442,31 @@ gl_object_editor_set_text_alignment (glObjectEditor      *editor,
 /*****************************************************************************/
 /* Query text alignment.                                                     */
 /*****************************************************************************/
-GtkJustification
+PangoAlignment
 gl_object_editor_get_text_alignment (glObjectEditor      *editor)
 {
-       GtkJustification just;
+       PangoAlignment align;
 
        gl_debug (DEBUG_EDITOR, "START");
 
         if (gtk_toggle_button_get_active
             (GTK_TOGGLE_BUTTON (editor->priv->text_left_toggle))) {
-                just = GTK_JUSTIFY_LEFT;
+                align = PANGO_ALIGN_LEFT;
         } else
             if (gtk_toggle_button_get_active
                 (GTK_TOGGLE_BUTTON (editor->priv->text_right_toggle))) {
-                just = GTK_JUSTIFY_RIGHT;
+                align = PANGO_ALIGN_RIGHT;
         } else
             if (gtk_toggle_button_get_active
                 (GTK_TOGGLE_BUTTON (editor->priv->text_center_toggle))) {
-                just = GTK_JUSTIFY_CENTER;
+                align = PANGO_ALIGN_CENTER;
         } else {
-                just = GTK_JUSTIFY_LEFT;       /* Should not happen. */
+                align = PANGO_ALIGN_LEFT;       /* Should not happen. */
         }
 
        gl_debug (DEBUG_EDITOR, "END");
 
-       return just;
+       return align;
 }
 
 /*****************************************************************************/
@@ -517,7 +518,7 @@ gl_object_editor_set_text_color (glObjectEditor      *editor,
                gtk_widget_set_sensitive (editor->priv->text_color_key_combo, TRUE);
                
                gl_debug (DEBUG_EDITOR, "color field true 1");
-               gl_util_combo_box_set_active_text (GTK_COMBO_BOX (editor->priv->text_color_key_combo));
+               gl_util_combo_box_set_active_text (GTK_COMBO_BOX (editor->priv->text_color_key_combo), "");
                gl_debug (DEBUG_EDITOR, "color field true 2");
        }
 
index a67a652e64aab178af280e5872d2597ddeb01f72..41424a7b10f0e6218b15505dce0ed2451c52edc3 100644 (file)
@@ -23,8 +23,6 @@
 #define __OBJECT_EDITOR_H__
 
 #include <gtk/gtkvbox.h>
-#include <gtk/gtkenums.h>
-#include <libgnomeprint/gnome-font.h>
 #include <gtk/gtktextbuffer.h>
 
 #include "text-node.h"
@@ -192,9 +190,9 @@ void        gl_object_editor_set_font_size        (glObjectEditor      *editor,
 gdouble     gl_object_editor_get_font_size        (glObjectEditor      *editor);
 
 void        gl_object_editor_set_font_weight      (glObjectEditor      *editor,
-                                                  GnomeFontWeight      font_weight);
+                                                  PangoWeight          font_weight);
 
-GnomeFontWeight gl_object_editor_get_font_weight  (glObjectEditor      *editor);
+PangoWeight gl_object_editor_get_font_weight      (glObjectEditor      *editor);
 
 void        gl_object_editor_set_font_italic_flag (glObjectEditor      *editor,
                                                   gboolean             font_italic_flag);
@@ -202,9 +200,9 @@ void        gl_object_editor_set_font_italic_flag (glObjectEditor      *editor,
 gboolean    gl_object_editor_get_font_italic_flag (glObjectEditor      *editor);
 
 void        gl_object_editor_set_text_alignment   (glObjectEditor      *editor,
-                                                  GtkJustification     text_alignment);
+                                                  PangoAlignment       text_alignment);
 
-GtkJustification gl_object_editor_get_text_alignment (glObjectEditor      *editor);
+PangoAlignment gl_object_editor_get_text_alignment (glObjectEditor      *editor);
 
 void        gl_object_editor_set_text_line_spacing (glObjectEditor      *editor,
                                                   gdouble               text_line_spacing);
index 69fe674cdbecc08ca1f352443049c15ca70cd047..d97516bc0a15942af98b708fae3a687e97b8cd74 100644 (file)
@@ -26,7 +26,6 @@
 #include "prefs-dialog.h"
 
 #include <glib/gi18n.h>
-#include <libgnomeprint/gnome-font.h>
 #include <glade/glade-xml.h>
 #include <gtk/gtktogglebutton.h>
 #include <gtk/gtkstock.h>
@@ -363,10 +362,10 @@ construct_object_page (glPrefsDialog *dlg)
        gl_util_combo_box_add_text_model (GTK_COMBO_BOX (dlg->priv->text_family_combo));
 
         /* Load family names */
-        family_names = gnome_font_family_list ();
+        family_names = gl_util_get_font_family_list ();
        gl_util_combo_box_set_strings (GTK_COMBO_BOX (dlg->priv->text_family_combo),
                                       family_names);
-        gnome_font_family_list_free (family_names);
+        gl_util_font_family_list_free (family_names);
                                                                                 
 
        g_signal_connect_swapped (G_OBJECT(dlg->priv->text_family_combo),
@@ -585,7 +584,7 @@ update_object_page_from_prefs (glPrefsDialog *dlg)
 
 
         /* Make sure we have a valid font family.  if not provide a good default. */
-        family_names = gnome_font_family_list ();
+        family_names = gl_util_get_font_family_list ();
         if (g_list_find_custom (family_names,
                                gl_prefs->default_font_family,
                                (GCompareFunc)g_utf8_collate)) {
@@ -597,7 +596,7 @@ update_object_page_from_prefs (glPrefsDialog *dlg)
                         good_font_family = NULL;
                 }
         }
-        gnome_font_family_list_free (family_names);
+        gl_util_font_family_list_free (family_names);
        gl_util_combo_box_set_active_text (GTK_COMBO_BOX (dlg->priv->text_family_combo),
                                           good_font_family);
         g_free (good_font_family);
@@ -606,7 +605,7 @@ update_object_page_from_prefs (glPrefsDialog *dlg)
                                    gl_prefs->default_font_size);
  
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->text_bold_toggle),
-                                      (gl_prefs->default_font_weight == GNOME_FONT_BOLD));
+                                      (gl_prefs->default_font_weight == PANGO_WEIGHT_BOLD));
  
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->text_italic_toggle),
                                       gl_prefs->default_font_italic_flag);
@@ -725,9 +724,9 @@ update_prefs_from_object_page (glPrefsDialog *dlg)
 
         if (gtk_toggle_button_get_active
             (GTK_TOGGLE_BUTTON (dlg->priv->text_bold_toggle))) {
-                gl_prefs->default_font_weight = GNOME_FONT_BOLD;
+                gl_prefs->default_font_weight = PANGO_WEIGHT_BOLD;
         } else {
-                gl_prefs->default_font_weight = GNOME_FONT_BOOK;
+                gl_prefs->default_font_weight = PANGO_WEIGHT_NORMAL;
         }
 
         gl_prefs->default_font_italic_flag =
index 333f57f3399159ded181249a49fd05ea2065de19..881ad8337131bc2bf4470c89f0bee0b11fff3150 100644 (file)
@@ -75,9 +75,9 @@
 
 #define DEFAULT_FONT_FAMILY        "Sans"
 #define DEFAULT_FONT_SIZE          14.0
-#define DEFAULT_FONT_WEIGHT_STRING gl_util_weight_to_string (GNOME_FONT_BOOK)
+#define DEFAULT_FONT_WEIGHT_STRING gl_util_weight_to_string (PANGO_WEIGHT_NORMAL)
 #define DEFAULT_FONT_ITALIC_FLAG   FALSE
-#define DEFAULT_TEXT_JUST_STRING   gl_util_just_to_string (GTK_JUSTIFY_LEFT)
+#define DEFAULT_TEXT_ALIGN_STRING  gl_util_align_to_string (PANGO_ALIGN_LEFT)
 #define DEFAULT_TEXT_COLOR         GNOME_CANVAS_COLOR (0,0,0)
 #define DEFAULT_TEXT_LINE_SPACING  1.0
 
@@ -300,7 +300,7 @@ gl_prefs_model_save_settings (glPrefsModel *prefs_model)
 
        gconf_client_set_string (prefs_model->gconf_client,
                                 BASE_KEY PREF_DEFAULT_TEXT_ALIGNMENT,
-                                gl_util_just_to_string(prefs_model->default_text_alignment),
+                                gl_util_align_to_string(prefs_model->default_text_alignment),
                                 NULL);
 
        gconf_client_set_float  (prefs_model->gconf_client,
@@ -443,8 +443,8 @@ gl_prefs_model_load_settings (glPrefsModel *prefs_model)
        string =
                get_string (prefs_model->gconf_client,
                            BASE_KEY PREF_DEFAULT_TEXT_ALIGNMENT,
-                           DEFAULT_TEXT_JUST_STRING);
-       prefs_model->default_text_alignment = gl_util_string_to_just( string );
+                           DEFAULT_TEXT_ALIGN_STRING);
+       prefs_model->default_text_alignment = gl_util_string_to_align( string );
        g_free( string );
 
        prefs_model->default_text_line_spacing =
index b2983097eaafa3cee08b69f4e01354b91bbda04f..e85b058fa727a0b7244bb411db9fb8e73ea6d4d8 100644 (file)
@@ -23,9 +23,8 @@
 #define __PREFS_MODEL_H__
 
 #include <glib-object.h>
-#include <gtk/gtkenums.h>
 #include <gconf/gconf-client.h>
-#include <libgnomeprint/gnome-font.h>
+#include <pango/pango.h>
 #include <libglabels/enums.h>
 
 G_BEGIN_DECLS
@@ -64,10 +63,10 @@ struct _glPrefsModel {
        /* Text properties */
        gchar            *default_font_family;
        gdouble           default_font_size;
-       GnomeFontWeight   default_font_weight;
+       PangoWeight       default_font_weight;
        gboolean          default_font_italic_flag;
        guint             default_text_color;
-       GtkJustification  default_text_alignment;
+       PangoAlignment    default_text_alignment;
        gdouble           default_text_line_spacing;
        
        /* Line properties */
index d3cbd39cf505392d1c2de0207bdee371f0accf71..196219bf4314ac1e1199991be4bdbd97159bacb5 100644 (file)
@@ -29,7 +29,6 @@
 #include <math.h>
 #include <time.h>
 #include <ctype.h>
-#include <gtk/gtkenums.h>
 
 #include "label.h"
 #include "label-text.h"
@@ -670,11 +669,10 @@ draw_text_object (PrintInfo     *pi,
        GList           *lines;
        gchar           *font_family;
        gdouble          font_size;
-       GnomeFontWeight  font_weight;
+       PangoWeight      font_weight;
        gboolean         font_italic_flag;
        guint            color;
        glColorNode     *color_node;
-       GtkJustification just;
        gboolean         auto_shrink;
        ArtDRect         bbox;
        gdouble          affine[6];
@@ -703,7 +701,7 @@ draw_text_object (PrintInfo     *pi,
        color = gl_color_node_expand (color_node, record);
        gl_color_node_free (&color_node);
        
-       just = gl_label_object_get_text_alignment (GL_LABEL_OBJECT(object));
+       alignment = gl_label_object_get_text_alignment (GL_LABEL_OBJECT(object));
        text_line_spacing =
                gl_label_object_get_text_line_spacing (GL_LABEL_OBJECT(object));
        auto_shrink = gl_label_text_get_auto_shrink (object);
@@ -721,21 +719,6 @@ draw_text_object (PrintInfo     *pi,
 
        text = gl_text_node_lines_expand (lines, record);
 
-        switch (just) {
-        case GTK_JUSTIFY_LEFT:
-                alignment = PANGO_ALIGN_LEFT;
-                break;
-        case GTK_JUSTIFY_CENTER:
-                alignment = PANGO_ALIGN_CENTER;
-                break;
-        case GTK_JUSTIFY_RIGHT:
-                alignment = PANGO_ALIGN_RIGHT;
-                break;
-        default:
-                alignment = PANGO_ALIGN_LEFT;
-                break; /* shouldn't happen */
-        }
-
         style = font_italic_flag ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL;
 
 
index 6af07594a96fe8766684d44989135a50dc844e36..604f7d0e601f1695ce84780e93fe81d4d4cbfec0 100644 (file)
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
 
 /**
  *  (GLABELS) Label and Business Card Creation program for GNOME
@@ -32,7 +32,6 @@
 #include <gtk/gtkspinbutton.h>
 #include <gtk/gtktoolbar.h>
 #include <gtk/gtktoggletoolbutton.h>
-#include <libgnomeprint/gnome-font.h>
 #include <gtk/gtktooltips.h>
 #include <string.h>
 
@@ -306,7 +305,7 @@ gl_ui_property_bar_construct (glUIPropertyBar   *property_bar)
 
        /* Font family entry widget */
        gl_util_combo_box_add_text_model (GTK_COMBO_BOX (property_bar->priv->font_family_combo));
-       family_names = gnome_font_family_list ();
+       family_names = gl_util_get_font_family_list ();
        gl_util_combo_box_set_strings (GTK_COMBO_BOX (property_bar->priv->font_family_combo),
                                       family_names);
        gtk_widget_set_size_request (property_bar->priv->font_family_combo, 200, -1);
@@ -322,7 +321,7 @@ gl_ui_property_bar_construct (glUIPropertyBar   *property_bar)
        } else {
                gtk_combo_box_set_active (GTK_COMBO_BOX (property_bar->priv->font_family_combo), 0);
        }
-       gnome_font_family_list_free (family_names);
+       gl_util_font_family_list_free (family_names);
 
        g_signal_connect (G_OBJECT (property_bar->priv->font_family_combo),
                          "changed", G_CALLBACK (font_family_changed_cb), property_bar);
@@ -337,7 +336,7 @@ gl_ui_property_bar_construct (glUIPropertyBar   *property_bar)
 
        /* Bold and Italic toggles */
        gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_bold_toggle),
-                                          (gl_prefs->default_font_weight == GNOME_FONT_BOLD));
+                                          (gl_prefs->default_font_weight == PANGO_WEIGHT_BOLD));
        g_signal_connect (G_OBJECT (property_bar->priv->font_bold_toggle),
                          "toggled", G_CALLBACK (font_bold_toggled_cb), property_bar);
        gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_italic_toggle),
@@ -348,15 +347,15 @@ gl_ui_property_bar_construct (glUIPropertyBar   *property_bar)
 
        /* Text alignment radio group */
        gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_left_radio),
-                                          (gl_prefs->default_text_alignment == GTK_JUSTIFY_LEFT));
+                                          (gl_prefs->default_text_alignment == PANGO_ALIGN_LEFT));
        g_signal_connect (G_OBJECT (property_bar->priv->text_align_left_radio),
                          "toggled", G_CALLBACK (text_align_toggled_cb), property_bar);
        gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_center_radio),
-                                          (gl_prefs->default_text_alignment == GTK_JUSTIFY_CENTER));
+                                          (gl_prefs->default_text_alignment == PANGO_ALIGN_CENTER));
        g_signal_connect (G_OBJECT (property_bar->priv->text_align_center_radio),
                          "toggled", G_CALLBACK (text_align_toggled_cb), property_bar);
        gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_right_radio),
-                                          (gl_prefs->default_text_alignment == GTK_JUSTIFY_RIGHT));
+                                          (gl_prefs->default_text_alignment == PANGO_ALIGN_RIGHT));
        g_signal_connect (G_OBJECT (property_bar->priv->text_align_right_radio),
                          "toggled", G_CALLBACK (text_align_toggled_cb), property_bar);
 
@@ -406,7 +405,7 @@ reset_to_default_properties (glView *view,
        GdkColor  *gdk_color;
 
        /* Make sure we have a valid font.  if not provide a good default. */
-       family_names = gnome_font_family_list ();
+       family_names = gl_util_get_font_family_list ();
        if (g_list_find_custom (family_names,
                                view->default_font_family,
                                (GCompareFunc)g_utf8_collate)) {
@@ -421,22 +420,22 @@ reset_to_default_properties (glView *view,
        gl_util_combo_box_set_active_text (GTK_COMBO_BOX (property_bar->priv->font_family_combo),
                                           good_font_family);
        g_free (good_font_family);
-       gnome_font_family_list_free (family_names);
+       gl_util_font_family_list_free (family_names);
 
        gtk_spin_button_set_value (GTK_SPIN_BUTTON(property_bar->priv->font_size_spin),
                                   view->default_font_size);
 
        gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_bold_toggle),
-                                          (view->default_font_weight == GNOME_FONT_BOLD));
+                                          (view->default_font_weight == PANGO_WEIGHT_BOLD));
        gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_italic_toggle),
                                           view->default_font_italic_flag);
 
        gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_left_radio),
-                                          (view->default_text_alignment == GTK_JUSTIFY_LEFT));
+                                          (view->default_text_alignment == PANGO_ALIGN_LEFT));
        gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_center_radio),
-                                          (view->default_text_alignment == GTK_JUSTIFY_CENTER));
+                                          (view->default_text_alignment == PANGO_ALIGN_CENTER));
        gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_right_radio),
-                                          (view->default_text_alignment == GTK_JUSTIFY_RIGHT));
+                                          (view->default_text_alignment == PANGO_ALIGN_RIGHT));
 
        gdk_color = gl_color_to_gdk_color (view->default_text_color);
        color_combo_set_color (COLOR_COMBO(property_bar->priv->text_color_combo), gdk_color);
@@ -517,20 +516,20 @@ static void
 update_text_properties (glView *view,
                        glUIPropertyBar *property_bar)
 {
-       gboolean can_text, is_first_object;
-       gboolean is_same_font_family, is_same_font_size;
-       gboolean is_same_text_color, is_same_is_italic;
-       gboolean is_same_is_bold, is_same_justification;
-       GList *p;
-       glLabelObject *object;
-       gchar *selection_font_family, *font_family;
-       gdouble selection_font_size, font_size;
-       guint selection_text_color, text_color;
-       glColorNode *text_color_node;
-       gboolean selection_is_italic, is_italic;
-       gboolean selection_is_bold, is_bold;
-       GtkJustification selection_justification, justification;
-       GdkColor *gdk_color;
+       gboolean        can_text, is_first_object;
+       gboolean        is_same_font_family, is_same_font_size;
+       gboolean        is_same_text_color, is_same_is_italic;
+       gboolean        is_same_is_bold, is_same_align;
+       GList          *p;
+       glLabelObject  *object;
+       gchar          *selection_font_family, *font_family;
+       gdouble         selection_font_size, font_size;
+       guint           selection_text_color, text_color;
+       glColorNode    *text_color_node;
+       gboolean        selection_is_italic, is_italic;
+       gboolean        selection_is_bold, is_bold;
+       PangoAlignment  selection_align, align;
+       GdkColor       *gdk_color;
 
        can_text = gl_view_can_selection_text (view);
        set_text_items_sensitive (property_bar, can_text);
@@ -540,7 +539,7 @@ update_text_properties (glView *view,
 
        is_same_is_italic =
        is_same_is_bold =
-       is_same_justification =
+       is_same_align =
        is_same_text_color =
        is_same_font_size =
        is_same_font_family = TRUE;
@@ -577,15 +576,15 @@ update_text_properties (glView *view,
                gl_color_node_free (&text_color_node);
                
                is_italic = gl_label_object_get_font_italic_flag (object);
-               is_bold = gl_label_object_get_font_weight (object) == GNOME_FONT_BOLD;
-               justification = gl_label_object_get_text_alignment (object);
+               is_bold = gl_label_object_get_font_weight (object) == PANGO_WEIGHT_BOLD;
+               align = gl_label_object_get_text_alignment (object);
 
                if (is_first_object) {
                        selection_font_size = font_size;
                        selection_text_color = text_color;
                        selection_is_italic = is_italic;
                        selection_is_bold = is_bold;
-                       selection_justification = justification;
+                       selection_align = align;
                } else {
                        if (font_size != selection_font_size) 
                                is_same_font_size = FALSE;
@@ -595,8 +594,8 @@ update_text_properties (glView *view,
                                is_same_is_italic = FALSE;
                        if (is_bold != selection_is_bold)
                                is_same_is_bold = FALSE;
-                       if (justification != selection_justification)
-                               is_same_justification = FALSE;
+                       if (align != selection_align)
+                               is_same_align = FALSE;
                }
                is_first_object = FALSE;
        }
@@ -637,17 +636,17 @@ update_text_properties (glView *view,
        gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_bold_toggle),
                                           selection_is_bold && is_same_is_bold);
 
-       if (is_same_justification) 
-               gl_debug (DEBUG_PROPERTY_BAR, "same justification");
+       if (is_same_align) 
+               gl_debug (DEBUG_PROPERTY_BAR, "same align");
        gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_left_radio),
-                                          (selection_justification == GTK_JUSTIFY_LEFT) &&
-                                          is_same_justification);
+                                          (selection_align == PANGO_ALIGN_LEFT) &&
+                                          is_same_align);
        gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_center_radio),
-                                          (selection_justification == GTK_JUSTIFY_CENTER) &&
-                                          is_same_justification);
+                                          (selection_align == PANGO_ALIGN_CENTER) &&
+                                          is_same_align);
        gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_right_radio),
-                                          (selection_justification == GTK_JUSTIFY_RIGHT) &&
-                                          is_same_justification);
+                                          (selection_align == PANGO_ALIGN_RIGHT) &&
+                                          is_same_align);
 }
 
 static void
@@ -1112,7 +1111,7 @@ font_bold_toggled_cb (GtkToggleToolButton  *toggle,
                      glUIPropertyBar      *property_bar)
 {
        gboolean        state;
-       GnomeFontWeight weight;
+       PangoWeight     weight;
 
 
        if (property_bar->priv->stop_signals)
@@ -1126,7 +1125,7 @@ font_bold_toggled_cb (GtkToggleToolButton  *toggle,
 
        state = gtk_toggle_tool_button_get_active (toggle);
 
-       weight = state ? GNOME_FONT_BOLD : GNOME_FONT_BOOK;
+       weight = state ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL;
 
        gl_view_set_selection_font_weight (property_bar->priv->view, weight);
        gl_view_set_default_font_weight   (property_bar->priv->view, weight);
@@ -1187,25 +1186,25 @@ text_align_toggled_cb (GtkToggleToolButton  *toggle,
        if (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_left_radio)))
        {               
                gl_view_set_selection_text_alignment (property_bar->priv->view,
-                                                     GTK_JUSTIFY_LEFT);
+                                                     PANGO_ALIGN_LEFT);
                gl_view_set_default_text_alignment   (property_bar->priv->view,
-                                                     GTK_JUSTIFY_LEFT);
+                                                     PANGO_ALIGN_LEFT);
        }
 
        if (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_center_radio)))
        {               
                gl_view_set_selection_text_alignment (property_bar->priv->view,
-                                                     GTK_JUSTIFY_CENTER);
+                                                     PANGO_ALIGN_CENTER);
                gl_view_set_default_text_alignment   (property_bar->priv->view,
-                                                     GTK_JUSTIFY_CENTER);
+                                                     PANGO_ALIGN_CENTER);
        }
 
        if (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_right_radio)))
        {
                gl_view_set_selection_text_alignment (property_bar->priv->view,
-                                                     GTK_JUSTIFY_RIGHT);
+                                                     PANGO_ALIGN_RIGHT);
                gl_view_set_default_text_alignment   (property_bar->priv->view,
-                                                     GTK_JUSTIFY_RIGHT);
+                                                     PANGO_ALIGN_RIGHT);
        }
 
        g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->priv->view->label),
index 6d59ec679093ad149d370967ec2cec602c07ce13..2c13e557c2485c9b574cf6e0d77c91570c9d0e34 100644 (file)
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
 
 /**
  *  (GLABELS) Label and Business Card Creation program for GNOME
@@ -27,7 +27,6 @@
 #include "ui-sidebar.h"
 
 #include <glib/gi18n.h>
-#include <libgnomeprint/gnome-font.h>
 
 #include "ui-util.h"
 #include "object-editor.h"
index 9e261164653903e1ed92388f140e92208cd8ad72..0273abfca37c1fbae6cc3660a3bb6fb79b646a01 100644 (file)
@@ -27,7 +27,6 @@
 #include <string.h>
 #include <glib.h>
 #include <math.h>
-#include <libgnomeprint/gnome-font.h>
 #include <gtk/gtkliststore.h>
 #include <gtk/gtkcellrenderertext.h>
 #include <gtk/gtkcelllayout.h>
@@ -132,65 +131,65 @@ gl_util_fraction (gdouble x)
 }
 
 /****************************************************************************/
-/* Utilities to deal with GTK_JUSTIFICATION types.                          */
+/* Utilities to deal with PangoAlignment types.                             */
 /****************************************************************************/
 const gchar *
-gl_util_just_to_string (GtkJustification just)
+gl_util_align_to_string (PangoAlignment align)
 {
-       switch (just) {
-       case GTK_JUSTIFY_LEFT:
+       switch (align) {
+       case PANGO_ALIGN_LEFT:
                return "Left";
-       case GTK_JUSTIFY_CENTER:
+       case PANGO_ALIGN_CENTER:
                return "Center";
-       case GTK_JUSTIFY_RIGHT:
+       case PANGO_ALIGN_RIGHT:
                return "Right";
        default:
                return "?";
        }
 }
 
-GtkJustification
-gl_util_string_to_just (const gchar *string)
+PangoAlignment
+gl_util_string_to_align (const gchar *string)
 {
 
        if (g_strcasecmp (string, "Left") == 0) {
-               return GTK_JUSTIFY_LEFT;
+               return PANGO_ALIGN_LEFT;
        } else if (g_strcasecmp (string, "Center") == 0) {
-               return GTK_JUSTIFY_CENTER;
+               return PANGO_ALIGN_CENTER;
        } else if (g_strcasecmp (string, "Right") == 0) {
-               return GTK_JUSTIFY_RIGHT;
+               return PANGO_ALIGN_RIGHT;
        } else {
-               return GTK_JUSTIFY_LEFT;
+               return PANGO_ALIGN_LEFT;
        }
 
 }
 
 /****************************************************************************/
-/* Utilities to deal with GNOME_FONT_WEIGHT types                           */
+/* Utilities to deal with PangoWeight types                                 */
 /****************************************************************************/
 const gchar *
-gl_util_weight_to_string (GnomeFontWeight weight)
+gl_util_weight_to_string (PangoWeight weight)
 {
        switch (weight) {
-       case GNOME_FONT_BOOK:
+       case PANGO_WEIGHT_NORMAL:
                return "Regular";
-       case GNOME_FONT_BOLD:
+       case PANGO_WEIGHT_BOLD:
                return "Bold";
        default:
                return "?";
        }
 }
 
-GnomeFontWeight
+PangoWeight
 gl_util_string_to_weight (const gchar *string)
 {
 
        if (g_strcasecmp (string, "Regular") == 0) {
-               return GNOME_FONT_BOOK;
+               return PANGO_WEIGHT_NORMAL;
        } else if (g_strcasecmp (string, "Bold") == 0) {
-               return GNOME_FONT_BOLD;
+               return PANGO_WEIGHT_BOLD;
        } else {
-               return GNOME_FONT_BOOK;
+               return PANGO_WEIGHT_NORMAL;
        }
 
 }
@@ -303,3 +302,52 @@ gl_util_combo_box_add_text_model (GtkComboBox       *combo)
                                        NULL);
 }
 
+/****************************************************************************/
+/* Get list of available font families.                                     */
+/****************************************************************************/
+GList  *
+gl_util_get_font_family_list (void)
+{
+       GList                *list = NULL;
+       PangoFontMap         *fontmap;
+       PangoContext         *context;
+       PangoFontFamily     **families;
+       gint                  n;
+       gint                  i;
+       gchar                *name;
+
+       fontmap = pango_cairo_font_map_new ();
+       context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap));
+
+       pango_context_list_families (context, &families, &n);
+
+       for ( i=0; i<n; i++ )
+       {
+               name = g_strdup (pango_font_family_get_name (families[i]));
+               list = g_list_append (list, name);
+       }
+
+       g_free (families);
+
+       g_object_unref (context);
+       g_object_unref (fontmap);
+
+       return list;
+}
+
+/****************************************************************************/
+/* Free previosly allocated list of font families.                          */
+/****************************************************************************/
+void    gl_util_font_family_list_free (GList *list)
+{
+        GList *p;
+
+        for (p = list; p != NULL; p = p->next) {
+                g_free (p->data);
+                p->data = NULL;
+        }
+
+        g_list_free (list);
+}
+
+
index 7b55867b27391b66e40bbd6a94f27bf73b00b59a..89fb800d3711dae074438d18f4cdca6b221aef08 100644 (file)
@@ -23,9 +23,9 @@
 #ifndef __UTIL_H__
 #define __UTIL_H__
 
-#include <gtk/gtkenums.h>
+#include <glib/glist.h>
 #include <gtk/gtkcombobox.h>
-#include <libgnomeprint/gnome-font.h>
+#include <pango/pango.h>
 
 G_BEGIN_DECLS
 
@@ -36,11 +36,11 @@ gchar              *gl_util_make_absolute         (const gchar       *filename);
 
 gchar              *gl_util_fraction              (gdouble            x);
 
-const gchar        *gl_util_just_to_string        (GtkJustification   just);
-GtkJustification    gl_util_string_to_just        (const gchar       *string);
+const gchar        *gl_util_align_to_string       (PangoAlignment     align);
+PangoAlignment      gl_util_string_to_align       (const gchar       *string);
 
-const gchar        *gl_util_weight_to_string      (GnomeFontWeight    weight);
-GnomeFontWeight     gl_util_string_to_weight      (const gchar       *string);
+const gchar        *gl_util_weight_to_string      (PangoWeight        weight);
+PangoWeight         gl_util_string_to_weight      (const gchar       *string);
 
 void gl_util_combo_box_set_strings     (GtkComboBox       *combo,
                                        GList             *list);
@@ -48,6 +48,9 @@ void gl_util_combo_box_set_active_text (GtkComboBox       *combo,
                                        const gchar       *text);
 void gl_util_combo_box_add_text_model  (GtkComboBox       *combo);
 
+GList  *gl_util_get_font_family_list (void);
+void    gl_util_font_family_list_free (GList *list);
+
 G_END_DECLS
 
 #endif /* __UTIL_H__ */
index b6b50339dcbe6e177902437c38a93f5ece04ffde..d18ae6862e6a2edcf8ab006c3f13112a304ade21 100644 (file)
@@ -325,7 +325,7 @@ update_object_from_editor_cb (glObjectEditor *editor,
        GnomeFontWeight    font_weight;
        gboolean           font_italic_flag;
        glColorNode       *color_node;
-       GtkJustification   just;
+       PangoAlignment     align;
        gdouble            text_line_spacing;
        gboolean           auto_shrink;
        gboolean           shadow_state;
@@ -349,7 +349,7 @@ update_object_from_editor_cb (glObjectEditor *editor,
        font_weight = gl_object_editor_get_font_weight (editor);
        font_italic_flag = gl_object_editor_get_font_italic_flag (editor);
        color_node = gl_object_editor_get_text_color (editor);
-       just = gl_object_editor_get_text_alignment (editor);
+       align = gl_object_editor_get_text_alignment (editor);
        text_line_spacing = gl_object_editor_get_text_line_spacing (editor);
        auto_shrink = gl_object_editor_get_text_auto_shrink (editor);
 
@@ -359,7 +359,7 @@ update_object_from_editor_cb (glObjectEditor *editor,
        gl_label_object_set_font_weight (object, font_weight);
        gl_label_object_set_font_italic_flag (object, font_italic_flag);
        gl_label_object_set_text_color (object, color_node);
-       gl_label_object_set_text_alignment (object, just);
+       gl_label_object_set_text_alignment (object, align);
        gl_label_object_set_text_line_spacing (object, text_line_spacing);
        gl_label_text_set_auto_shrink (GL_LABEL_TEXT (object), auto_shrink);
 
@@ -434,7 +434,7 @@ update_editor_from_object_cb (glLabelObject  *object,
        GnomeFontWeight    font_weight;
        gboolean           font_italic_flag;
        glColorNode       *color_node;
-       GtkJustification   just;
+       PangoAlignment     align;
        gdouble            text_line_spacing;
        gboolean           auto_shrink;
        gboolean           shadow_state;
@@ -454,7 +454,7 @@ update_editor_from_object_cb (glLabelObject  *object,
        font_weight      = gl_label_object_get_font_weight (object);
        font_italic_flag = gl_label_object_get_font_italic_flag (object);
        color_node       = gl_label_object_get_text_color (object);
-       just             = gl_label_object_get_text_alignment (object);
+       align             = gl_label_object_get_text_alignment (object);
        text_line_spacing = gl_label_object_get_text_line_spacing (object);
        auto_shrink      = gl_label_text_get_auto_shrink (GL_LABEL_TEXT (object));
 
@@ -463,7 +463,7 @@ update_editor_from_object_cb (glLabelObject  *object,
        gl_object_editor_set_font_weight (editor, font_weight);
        gl_object_editor_set_font_italic_flag (editor, font_italic_flag);
        gl_object_editor_set_text_color (editor, (merge != NULL), color_node);
-       gl_object_editor_set_text_alignment (editor, just);
+       gl_object_editor_set_text_alignment (editor, align);
        gl_object_editor_set_text_line_spacing (editor, text_line_spacing);
        gl_object_editor_set_text_auto_shrink (editor, auto_shrink);
 
@@ -707,7 +707,7 @@ draw_hacktext (glViewText *view_text)
        gdouble            font_size;
        gdouble            text_line_spacing;
        glColorNode       *color_node;
-       GtkJustification   just;
+       PangoAlignment     align;
        GnomeFont         *font;
        GnomeGlyphList    *glyphlist;
        ArtDRect           bbox;
@@ -737,7 +737,7 @@ draw_hacktext (glViewText *view_text)
        {
                color_node->color = GL_COLOR_MERGE_DEFAULT;
        }
-       just = gl_label_object_get_text_alignment (object);
+       align = gl_label_object_get_text_alignment (object);
        buffer = gl_label_text_get_buffer(GL_LABEL_TEXT(object));
        gtk_text_buffer_get_bounds (buffer, &start, &end);
        text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
@@ -790,14 +790,14 @@ draw_hacktext (glViewText *view_text)
                        gnome_glyphlist_bbox (glyphlist, affine, 0, &bbox);
                        w = bbox.x1;
 
-                       switch (just) {
-                       case GTK_JUSTIFY_LEFT:
+                       switch (align) {
+                       case PANGO_ALIGN_LEFT:
                                x_offset = GL_LABEL_TEXT_MARGIN;
                                break;
-                       case GTK_JUSTIFY_CENTER:
+                       case PANGO_ALIGN_CENTER:
                                x_offset = (object_w - GL_LABEL_TEXT_MARGIN - w) / 2.0;
                                break;
-                       case GTK_JUSTIFY_RIGHT:
+                       case PANGO_ALIGN_RIGHT:
                                x_offset = object_w - GL_LABEL_TEXT_MARGIN - w;
                                break;
                        default:
@@ -837,14 +837,14 @@ draw_hacktext (glViewText *view_text)
                gnome_glyphlist_bbox (glyphlist, affine, 0, &bbox);
                w = bbox.x1;
 
-               switch (just) {
-               case GTK_JUSTIFY_LEFT:
+               switch (align) {
+               case PANGO_ALIGN_LEFT:
                        x_offset = GL_LABEL_TEXT_MARGIN;
                        break;
-               case GTK_JUSTIFY_CENTER:
+               case PANGO_ALIGN_CENTER:
                        x_offset = (object_w - GL_LABEL_TEXT_MARGIN - w) / 2.0;
                        break;
-               case GTK_JUSTIFY_RIGHT:
+               case PANGO_ALIGN_RIGHT:
                        x_offset = object_w - GL_LABEL_TEXT_MARGIN - w;
                        break;
                default:
@@ -899,7 +899,7 @@ draw_cursor (glViewText *view_text)
        gboolean           font_italic_flag;
        gdouble            font_size;
        glColorNode       *color_node;
-       GtkJustification   just;
+       PangoAlignment     align;
        GnomeFont         *font;
        GnomeGlyphList    *glyphlist;
        ArtDRect           bbox;
@@ -923,7 +923,7 @@ draw_cursor (glViewText *view_text)
        font_weight = gl_label_object_get_font_weight (object);
        font_italic_flag = gl_label_object_get_font_italic_flag (object);
        color_node = gl_label_object_get_text_color (object);
-       just = gl_label_object_get_text_alignment (object);
+       align = gl_label_object_get_text_alignment (object);
        buffer = gl_label_text_get_buffer(GL_LABEL_TEXT(object));
        gtk_text_buffer_get_bounds (buffer, &start, &end);
        text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
@@ -960,14 +960,14 @@ draw_cursor (glViewText *view_text)
                        gnome_glyphlist_unref (glyphlist);
                        w = bbox.x1;
 
-                       switch (just) {
-                       case GTK_JUSTIFY_LEFT:
+                       switch (align) {
+                       case PANGO_ALIGN_LEFT:
                                x_offset = GL_LABEL_TEXT_MARGIN;
                                break;
-                       case GTK_JUSTIFY_CENTER:
+                       case PANGO_ALIGN_CENTER:
                                x_offset = (object_w - GL_LABEL_TEXT_MARGIN - w) / 2.0;
                                break;
-                       case GTK_JUSTIFY_RIGHT:
+                       case PANGO_ALIGN_RIGHT:
                                x_offset = object_w - GL_LABEL_TEXT_MARGIN - w;
                                break;
                        default:
index 9c0eb9a4c20073764fddda76e21ac496ea0f52ce..3ec7d13ce14dce51939268a2fa29cc3fb30e5f5e 100644 (file)
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
 
 /*
  *  (GLABELS) Label and Business Card Creation program for GNOME
@@ -2840,7 +2840,7 @@ gl_view_set_selection_font_italic_flag (glView   *view,
 /*****************************************************************************/
 void
 gl_view_set_selection_text_alignment (glView            *view,
-                                     GtkJustification   text_alignment)
+                                     PangoAlignment     text_alignment)
 {
        GList         *p;
        glLabelObject *object;
@@ -3829,7 +3829,7 @@ gl_view_set_default_text_color (glView *view,
 /****************************************************************************/
 void
 gl_view_set_default_text_alignment (glView           *view,
-                                   GtkJustification  text_alignment)
+                                   PangoAlignment    text_alignment)
 {
        gl_debug (DEBUG_VIEW, "START");
 
@@ -3991,12 +3991,12 @@ gl_view_get_default_text_color (glView *view)
 /****************************************************************************/
 /* Get default text alignment.                                              */
 /****************************************************************************/
-GtkJustification
+PangoAlignment
 gl_view_get_default_text_alignment (glView *view)
 {
        gl_debug (DEBUG_VIEW, "START");
 
-       g_return_val_if_fail (view && GL_IS_VIEW (view), GTK_JUSTIFY_LEFT);
+       g_return_val_if_fail (view && GL_IS_VIEW (view), PANGO_ALIGN_LEFT);
 
        gl_debug (DEBUG_VIEW, "END");
 
index 28c6d4361db96e5886b69595304df17c9538555e..9006ec880ebdc72ef4c3ac3b6971c4b436ea2357 100644 (file)
@@ -26,7 +26,6 @@
 #define __VIEW_H__
 
 #include <gtk/gtkvbox.h>
-#include <gtk/gtkenums.h>
 #include <libgnomecanvas/libgnomecanvas.h>
 #include <libgnomeprint/gnome-font.h>
 
@@ -85,7 +84,7 @@ struct _glView {
        GnomeFontWeight    default_font_weight;
        gboolean           default_font_italic_flag;
        guint              default_text_color;
-       GtkJustification   default_text_alignment;
+       PangoAlignment     default_text_alignment;
        gdouble            default_text_line_spacing;
 
        /* Default object line properties */
@@ -227,7 +226,7 @@ void       gl_view_set_selection_font_italic_flag (glView           *view,
                                                   gboolean          font_italic_flag);
 
 void       gl_view_set_selection_text_alignment   (glView           *view,
-                                                  GtkJustification  text_alignment);
+                                                  PangoAlignment    text_alignment);
 
 void       gl_view_set_selection_text_color       (glView           *view,
                                                   glColorNode      *text_color_node);
@@ -287,7 +286,7 @@ void       gl_view_set_default_text_color       (glView            *view,
                                                 guint              text_color);
 
 void       gl_view_set_default_text_alignment   (glView            *view,
-                                                GtkJustification   text_alignment);
+                                                PangoAlignment     text_alignment);
 
 void       gl_view_set_default_line_width       (glView            *view,
                                                 gdouble            line_width);
@@ -312,7 +311,7 @@ gboolean         gl_view_get_default_font_italic_flag (glView            *view);
 
 guint            gl_view_get_default_text_color       (glView            *view);
 
-GtkJustification gl_view_get_default_text_alignment   (glView            *view);
+PangoAlignment   gl_view_get_default_text_alignment   (glView            *view);
 
 gdouble          gl_view_get_default_text_line_spacing (glView            *view);
 
index c5eb9a76c93721b58099c278ed150c51fc274583..a0c5515bc43a9b9a3212a92c15918597f4be87d0 100644 (file)
@@ -34,6 +34,7 @@
 #include "label-barcode.h"
 #include <libglabels/xml.h>
 
+#include "util.h"
 #include "debug.h"
 
 static gboolean xml04_parse_media_description (xmlNodePtr node,
@@ -194,10 +195,10 @@ xml04_parse_text_props (xmlNodePtr    object_node,
 {
        xmlChar         *font_family;
        gdouble          font_size;
-       GnomeFontWeight  font_weight;
+       PangoWeight      font_weight;
        gboolean         font_italic_flag;
        glColorNode     *color_node;
-       GtkJustification just;
+       PangoAlignment   align;
        xmlNodePtr       line_node, text_node;
        glTextNode      *node_text;
        GList           *nodes, *lines;
@@ -214,7 +215,7 @@ xml04_parse_text_props (xmlNodePtr    object_node,
        font_italic_flag = gl_xml_get_prop_boolean (object_node, "font_italic", FALSE);
 
        string = xmlGetProp (object_node, (xmlChar *)"justify");
-       just = gl_util_string_to_just (string);
+       align = gl_util_string_to_align (string);
        xmlFree (string);
 
        color_node = gl_color_node_new_default ();
@@ -225,7 +226,7 @@ xml04_parse_text_props (xmlNodePtr    object_node,
        gl_label_object_set_font_weight (GL_LABEL_OBJECT(object), font_weight);
        gl_label_object_set_font_italic_flag (GL_LABEL_OBJECT(object), font_italic_flag);
        gl_label_object_set_text_color (GL_LABEL_OBJECT(object), color_node);
-       gl_label_object_set_text_alignment (GL_LABEL_OBJECT(object), just);
+       gl_label_object_set_text_alignment (GL_LABEL_OBJECT(object), align);
        
        gl_color_node_free (&color_node);
 
@@ -282,15 +283,15 @@ xml04_parse_text_props (xmlNodePtr    object_node,
        /* Adjust location.  In 0.4.x, text was anchored at x,y */
        gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y);
        gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h);
-       switch (just) {
-       case GTK_JUSTIFY_LEFT:
+       switch (align) {
+       case PANGO_ALIGN_LEFT:
                /* nothing */
                break;
-       case GTK_JUSTIFY_CENTER:
+       case PANGO_ALIGN_CENTER:
                x -= w/2.0;
                gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
                break;
-       case GTK_JUSTIFY_RIGHT:
+       case PANGO_ALIGN_RIGHT:
                x -= w;
                gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
                break;
index 0b580b7cad02657b6c8d28e8f7b949e93222b06a..21479da099c72ecc92e2fad6680bb1d4e34789db 100644 (file)
@@ -269,10 +269,10 @@ xml191_parse_text_props (xmlNodePtr  object_node,
        gdouble           w, h;
        xmlChar          *font_family;
        gdouble           font_size;
-       GnomeFontWeight   font_weight;
+       PangoWeight       font_weight;
        gboolean          font_italic_flag;
        glColorNode      *color_node;
-       GtkJustification  just;
+       PangoAlignment    align;
        xmlNodePtr        line_node, text_node;
        glTextNode       *node_text;
        GList            *nodes;
@@ -296,7 +296,7 @@ xml191_parse_text_props (xmlNodePtr  object_node,
        font_italic_flag = gl_xml_get_prop_boolean (object_node, "font_italic", FALSE);
 
        string = xmlGetProp (object_node, (xmlChar *)"justify");
-       just = gl_util_string_to_just ((gchar *)string);
+       align = gl_util_string_to_align ((gchar *)string);
        xmlFree (string);
 
        color_node = gl_color_node_new_default ();
@@ -347,7 +347,7 @@ xml191_parse_text_props (xmlNodePtr  object_node,
        gl_label_object_set_font_weight (GL_LABEL_OBJECT(object), font_weight);
        gl_label_object_set_font_italic_flag (GL_LABEL_OBJECT(object), font_italic_flag);
        gl_label_object_set_text_color (GL_LABEL_OBJECT(object), color_node);
-       gl_label_object_set_text_alignment (GL_LABEL_OBJECT(object), just);
+       gl_label_object_set_text_alignment (GL_LABEL_OBJECT(object), align);
 
        gl_color_node_free (&color_node);
        gl_text_node_lines_free (&lines);
index 71ce6ba8b91c093c5bf6dfc69a575b8555ab697f..2234bf3b3ae8889a2201f6da0fe57d310e5c77c4 100644 (file)
@@ -421,7 +421,7 @@ xml_parse_object_text (xmlNodePtr  node,
        gdouble           x, y;
        gdouble           w, h;
        gchar            *string;
-       GtkJustification  just;
+       PangoAlignment    align;
        gboolean          auto_shrink;
        xmlNodePtr        child;
 
@@ -441,9 +441,9 @@ xml_parse_object_text (xmlNodePtr  node,
 
        /* justify attr */
        string = gl_xml_get_prop_string (node, "justify", NULL);
-       just = gl_util_string_to_just (string);
+       align = gl_util_string_to_align (string);
        g_free (string);
-       gl_label_object_set_text_alignment (GL_LABEL_OBJECT(object), just);
+       gl_label_object_set_text_alignment (GL_LABEL_OBJECT(object), align);
 
        /* auto_shrink attr */
        auto_shrink = gl_xml_get_prop_boolean (node, "auto_shrink", FALSE);
@@ -899,7 +899,7 @@ xml_parse_toplevel_span  (xmlNodePtr        node,
 {
        gchar            *font_family;
        gdouble           font_size;
-       GnomeFontWeight   font_weight;
+       PangoWeight       font_weight;
        gboolean          font_italic_flag;
        glColorNode      *color_node;
        gdouble           text_line_spacing;
@@ -1221,7 +1221,7 @@ xml_create_object_text (xmlNodePtr     root,
        xmlNodePtr        node;
        gdouble           x, y;
        gdouble           w, h;
-       GtkJustification  just;
+       PangoAlignment    align;
        gboolean          auto_shrink;
 
        gl_debug (DEBUG_XML, "START");
@@ -1239,8 +1239,8 @@ xml_create_object_text (xmlNodePtr     root,
        gl_xml_set_prop_length (node, "h", h);
 
        /* justify attr */
-       just = gl_label_object_get_text_alignment (object);
-       gl_xml_set_prop_string (node, "justify", gl_util_just_to_string (just));
+       align = gl_label_object_get_text_alignment (object);
+       gl_xml_set_prop_string (node, "justify", gl_util_align_to_string (align));
 
        /* auto_shrink attr */
        auto_shrink = gl_label_text_get_auto_shrink (GL_LABEL_TEXT (object));
@@ -1675,10 +1675,10 @@ xml_create_toplevel_span (xmlNodePtr        root,
        xmlNodePtr        node;
        gchar            *font_family;
        gdouble           font_size;
-       GnomeFontWeight   font_weight;
+       PangoWeight       font_weight;
        gboolean          font_italic_flag;
        glColorNode      *color_node;
-       GtkJustification  just;
+       PangoAlignment    align;
        gdouble           text_line_spacing;
        GList            *lines, *p_line, *p_node;
        glTextNode       *text_node;
@@ -1704,7 +1704,7 @@ xml_create_toplevel_span (xmlNodePtr        root,
        }
        gl_color_node_free (&color_node);
        
-       just = gl_label_object_get_text_alignment (GL_LABEL_OBJECT(object_text));
+       align = gl_label_object_get_text_alignment (GL_LABEL_OBJECT(object_text));
        gl_xml_set_prop_string (node, "font_family", font_family);
        gl_xml_set_prop_double (node, "font_size", font_size);
        gl_xml_set_prop_string (node, "font_weight", gl_util_weight_to_string (font_weight));