mirror of https://github.com/GNOME/gimp.git
require gtk+ >= 2.2.
2003-03-25 Sven Neumann <sven@gimp.org> * gimpui-1.3.pc.in: require gtk+ >= 2.2. * app/text/gimpfont.[ch]: implemented basic preview functionality. * app/text/gimptextlayout.c: changed a comment.
This commit is contained in:
parent
47419bbcec
commit
fab72973a2
|
@ -1,3 +1,11 @@
|
||||||
|
2003-03-25 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* gimpui-1.3.pc.in: require gtk+ >= 2.2.
|
||||||
|
|
||||||
|
* app/text/gimpfont.[ch]: implemented basic preview functionality.
|
||||||
|
|
||||||
|
* app/text/gimptextlayout.c: changed a comment.
|
||||||
|
|
||||||
2003-03-25 Michael Natterer <mitch@gimp.org>
|
2003-03-25 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* app/config/gimpcoreconfig.[ch]: added "gchar *default_font".
|
* app/config/gimpcoreconfig.[ch]: added "gchar *default_font".
|
||||||
|
|
|
@ -23,18 +23,46 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
#include <pango/pangoft2.h>
|
||||||
|
|
||||||
#include "text-types.h"
|
#include "text-types.h"
|
||||||
|
|
||||||
|
#include "base/temp-buf.h"
|
||||||
|
|
||||||
#include "gimpfont.h"
|
#include "gimpfont.h"
|
||||||
|
|
||||||
|
|
||||||
static void gimp_font_class_init (GimpFontClass *klass);
|
struct _GimpFont
|
||||||
static void gimp_font_init (GimpFont *font);
|
{
|
||||||
|
GimpViewable parent_instance;
|
||||||
|
};
|
||||||
|
|
||||||
static void gimp_font_finalize (GObject *object);
|
struct _GimpFontClass
|
||||||
|
{
|
||||||
|
GimpViewableClass parent_class;
|
||||||
|
|
||||||
static gsize gimp_font_get_memsize (GimpObject *object);
|
PangoContext *pango_context;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static void gimp_font_class_init (GimpFontClass *klass);
|
||||||
|
static void gimp_font_init (GimpFont *font);
|
||||||
|
|
||||||
|
static void gimp_font_get_preview_size (GimpViewable *viewable,
|
||||||
|
gint size,
|
||||||
|
gboolean popup,
|
||||||
|
gboolean dot_for_dot,
|
||||||
|
gint *width,
|
||||||
|
gint *height);
|
||||||
|
static gboolean gimp_font_get_popup_size (GimpViewable *viewable,
|
||||||
|
gint width,
|
||||||
|
gint height,
|
||||||
|
gboolean dot_for_dot,
|
||||||
|
gint *popup_width,
|
||||||
|
gint *popup_height);
|
||||||
|
static TempBuf * gimp_font_get_new_preview (GimpViewable *viewable,
|
||||||
|
gint width,
|
||||||
|
gint height);
|
||||||
|
|
||||||
|
|
||||||
static GimpViewableClass *parent_class = NULL;
|
static GimpViewableClass *parent_class = NULL;
|
||||||
|
@ -71,17 +99,17 @@ gimp_font_get_type (void)
|
||||||
static void
|
static void
|
||||||
gimp_font_class_init (GimpFontClass *klass)
|
gimp_font_class_init (GimpFontClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class;
|
GimpViewableClass *viewable_class;
|
||||||
GimpObjectClass *gimp_object_class;
|
|
||||||
|
|
||||||
object_class = G_OBJECT_CLASS (klass);
|
|
||||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
parent_class = g_type_class_peek_parent (klass);
|
||||||
|
|
||||||
object_class->finalize = gimp_font_finalize;
|
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||||
|
|
||||||
gimp_object_class->get_memsize = gimp_font_get_memsize;
|
viewable_class->get_preview_size = gimp_font_get_preview_size;
|
||||||
|
viewable_class->get_popup_size = gimp_font_get_popup_size;
|
||||||
|
viewable_class->get_new_preview = gimp_font_get_new_preview;
|
||||||
|
|
||||||
|
klass->pango_context = pango_ft2_get_context (72, 72);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -90,24 +118,78 @@ gimp_font_init (GimpFont *font)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_font_finalize (GObject *object)
|
gimp_font_get_preview_size (GimpViewable *viewable,
|
||||||
|
gint size,
|
||||||
|
gboolean popup,
|
||||||
|
gboolean dot_for_dot,
|
||||||
|
gint *width,
|
||||||
|
gint *height)
|
||||||
{
|
{
|
||||||
GimpFont *font;
|
*width = size;
|
||||||
|
*height = size;
|
||||||
font = GIMP_FONT (object);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gsize
|
static gboolean
|
||||||
gimp_font_get_memsize (GimpObject *object)
|
gimp_font_get_popup_size (GimpViewable *viewable,
|
||||||
|
gint width,
|
||||||
|
gint height,
|
||||||
|
gboolean dot_for_dot,
|
||||||
|
gint *popup_width,
|
||||||
|
gint *popup_height)
|
||||||
{
|
{
|
||||||
GimpFont *font;
|
return FALSE;
|
||||||
gsize memsize = 0;
|
}
|
||||||
|
|
||||||
font = GIMP_FONT (object);
|
static TempBuf *
|
||||||
|
gimp_font_get_new_preview (GimpViewable *viewable,
|
||||||
|
gint width,
|
||||||
|
gint height)
|
||||||
|
{
|
||||||
|
GimpFont *font;
|
||||||
|
GimpFontClass *font_class;
|
||||||
|
PangoFontDescription *font_desc;
|
||||||
|
PangoLayout *layout;
|
||||||
|
const gchar *name;
|
||||||
|
TempBuf *temp_buf;
|
||||||
|
FT_Bitmap bitmap;
|
||||||
|
guchar *p;
|
||||||
|
guchar black = 0;
|
||||||
|
|
||||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
font = GIMP_FONT (viewable);
|
||||||
|
font_class = GIMP_FONT_GET_CLASS (font);
|
||||||
|
|
||||||
|
name = gimp_object_get_name (GIMP_OBJECT (font));
|
||||||
|
|
||||||
|
font_desc = pango_font_description_from_string (name);
|
||||||
|
g_return_val_if_fail (font_desc != NULL, NULL);
|
||||||
|
if (!font_desc)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
pango_font_description_set_size (font_desc, PANGO_SCALE * height);
|
||||||
|
|
||||||
|
layout = pango_layout_new (font_class->pango_context);
|
||||||
|
pango_font_description_free (font_desc);
|
||||||
|
|
||||||
|
pango_layout_set_text (layout, "Aa", -1);
|
||||||
|
|
||||||
|
temp_buf = temp_buf_new (width, height, 1, 0, 0, &black);
|
||||||
|
|
||||||
|
bitmap.width = temp_buf->width;
|
||||||
|
bitmap.rows = temp_buf->height;
|
||||||
|
bitmap.pitch = temp_buf->width;
|
||||||
|
bitmap.buffer = temp_buf_data (temp_buf);
|
||||||
|
|
||||||
|
pango_ft2_render_layout (&bitmap, layout, 0, 0);
|
||||||
|
|
||||||
|
g_object_unref (layout);
|
||||||
|
|
||||||
|
p = temp_buf_data (temp_buf);
|
||||||
|
|
||||||
|
for (height = temp_buf->width; height; height--)
|
||||||
|
for (width = temp_buf->width; width; width--, p++)
|
||||||
|
*p = 255 - *p;
|
||||||
|
|
||||||
|
return temp_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
GimpFont *
|
GimpFont *
|
||||||
|
|
|
@ -37,16 +37,6 @@
|
||||||
|
|
||||||
typedef struct _GimpFontClass GimpFontClass;
|
typedef struct _GimpFontClass GimpFontClass;
|
||||||
|
|
||||||
struct _GimpFont
|
|
||||||
{
|
|
||||||
GimpViewable parent_instance;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GimpFontClass
|
|
||||||
{
|
|
||||||
GimpViewableClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
GType gimp_font_get_type (void) G_GNUC_CONST;
|
GType gimp_font_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
|
|
@ -204,7 +204,9 @@ gimp_text_layout_new (GimpText *text,
|
||||||
alignment = PANGO_ALIGN_CENTER;
|
alignment = PANGO_ALIGN_CENTER;
|
||||||
break;
|
break;
|
||||||
case GIMP_TEXT_JUSTIFY_FILL:
|
case GIMP_TEXT_JUSTIFY_FILL:
|
||||||
/* FIXME: This just doesn't work to do this */
|
/* FIXME: This doesn't work since the implementation is missing
|
||||||
|
at the Pango level.
|
||||||
|
*/
|
||||||
alignment = PANGO_ALIGN_LEFT;
|
alignment = PANGO_ALIGN_LEFT;
|
||||||
pango_layout_set_justify (layout->layout, TRUE);
|
pango_layout_set_justify (layout->layout, TRUE);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: GIMP UI
|
Name: GIMP UI
|
||||||
Description: GIMP User Interface Library
|
Description: GIMP User Interface Library
|
||||||
Version: @VERSION@
|
Version: @VERSION@
|
||||||
Requires: gimp-1.3 gtk+-2.0
|
Requires: gimp-1.3 gtk+-2.0 >= 2.2.0
|
||||||
Libs: -L${libdir} -lgimpui-1.3 -lgimpwidgets-1.3
|
Libs: -L${libdir} -lgimpui-1.3 -lgimpwidgets-1.3
|
||||||
Cflags: -I${includedir}/gimp-1.3
|
Cflags: -I${includedir}/gimp-1.3
|
||||||
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: GIMP UI
|
Name: GIMP UI
|
||||||
Description: GIMP User Interface Library
|
Description: GIMP User Interface Library
|
||||||
Version: @VERSION@
|
Version: @VERSION@
|
||||||
Requires: gimp-1.3 gtk+-2.0
|
Requires: gimp-1.3 gtk+-2.0 >= 2.2.0
|
||||||
Libs: -L${libdir} -lgimpui-1.3 -lgimpwidgets-1.3
|
Libs: -L${libdir} -lgimpui-1.3 -lgimpwidgets-1.3
|
||||||
Cflags: -I${includedir}/gimp-1.3
|
Cflags: -I${includedir}/gimp-1.3
|
||||||
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: GIMP UI
|
Name: GIMP UI
|
||||||
Description: GIMP User Interface Library
|
Description: GIMP User Interface Library
|
||||||
Version: @VERSION@
|
Version: @VERSION@
|
||||||
Requires: gimp-1.3 gtk+-2.0
|
Requires: gimp-1.3 gtk+-2.0 >= 2.2.0
|
||||||
Libs: -L${libdir} -lgimpui-1.3 -lgimpwidgets-1.3
|
Libs: -L${libdir} -lgimpui-1.3 -lgimpwidgets-1.3
|
||||||
Cflags: -I${includedir}/gimp-1.3
|
Cflags: -I${includedir}/gimp-1.3
|
||||||
|
|
Loading…
Reference in New Issue