0.5999, 0.5999, 0.5999, 0.5999, 0.5999, 0.5999, 0.5999, 0.5999, /* øùúû */
};
+#ifdef CAIRO_HAS_FT_FONT
+#include <cairo-ft.h>
+#endif
+
#if !defined(DISABLE_CODEGENS) && !defined(HAVE_GD_FREETYPE)
extern codegen_t *Output_codegen;
double textwidth(textline_t * textline, char *fontname, double fontsize)
{
char *fontpath = NULL;
-#ifdef HAVE_CAIRO
+#ifdef CAIRO_HAS_FT_FONT
cairo_t *cr;
cairo_text_extents_t extents;
typedef struct gvrender_engine_s gvrender_engine_t;
typedef struct gvlayout_engine_s gvlayout_engine_t;
typedef struct gvdisplay_engine_s gvdisplay_engine_t;
+ typedef struct gvtext_engine_s gvtext_engine_t;
typedef struct htmllabel_t htmllabel_t;
#LIBS = @LIBLTDL@
-pkginclude_HEADERS = gvc.h gvcint.h gvplugin_render.h \
- gvplugin_layout.h gvplugin_display.h gvplugin.h
+pkginclude_HEADERS = gvc.h gvcint.h gvplugin.h \
+ gvplugin_render.h gvplugin_layout.h \
+ gvplugin_text.h gvplugin_display.h
pkglib_LTLIBRARIES = libgvc.la
pkgconfig_DATA = libgvc.pc
-libgvc_la_SOURCES = gvrender.c gvlayout.c gvcontext.c gvjobs.c \
+libgvc_la_SOURCES = gvrender.c gvlayout.c gvtext.c gvcontext.c gvjobs.c \
gvemit.c gvplugin.c gvconfig.c
EXTRA_DIST = Makefile.old
gv_plugin_t *api[NUM_APIS]; /* array of current plugins for each api */
void *display; /* window display data for gvdisplay plugin */
+ gvtext_engine_t *text_engine; /* current text layout engine */
/* gvrender_begin_job() */
char *layout_type; /* string name of layout type */
#endif
#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
#include "const.h"
#include "types.h"
#include <cairo.h>
+#ifdef CAIRO_HAS_XLIB_SURFACE
+#include <cairo-xlib.h>
+
#define PANFACTOR 10
#define ZOOMFACTOR 1.1
#define EPSILON .0001
}
return 0;
}
+#endif /* CAIRO_HAS_XLIB_SURFACE */
#endif /* X_DISPLAY_MISSING */
void gvemit_graph(GVC_t * gvc, graph_t * g, int flags)
job->flags = flags;
if (flags & GVRENDER_X11_EVENTS) {
-#if !defined(X_DISPLAY_MISSING) && !defined(DISABLE_GVRENDER) && defined(HAVE_CAIRO)
+#ifdef CAIRO_HAS_XLIB_SURFACE
const char *display=NULL;
int argb=0;
* The enumerated type is defined gvplugin.h. The apis array is
* inititialized here by redefining ELEM and reinvoking APIS.
*
- * The last enum is NUM_APIS which is the size of the array.
+ * The NUM_APIS is the size of the array.
*/
#define ELEM(x) #x,
-static char *apis[] = { APIS }; /* "renderer", "scripter", ... */
-
+static char *apis[] = { APIS }; /* "render", "layout", ... */
#undef ELEM
/* translate a string api name to its type, or -1 on error */
api_t gvplugin_api(char *str)
{
- api_t api;
+ int api;
for (api = 0; api < NUM_APIS; api++) {
if (strcmp(str, apis[api]) == 0)
* The enumerated type is defined here. The apis array is
* inititialized in gvplugin.c by redefining ELEM and reinvoking APIS.
*
- * The last enum is NUM_APIS which is the size of the array.
+ * NUM_APIS is the size of the array.
*/
-// #define APIS ELEM(render) ELEM(layout) ELEM(parser) ELEM(scripter) ...
-#define APIS ELEM(render) ELEM(layout) ELEM(display)
+#define APIS ELEM(render) ELEM(layout) ELEM(display) ELEM(text)
+#define NUM_APIS 4
#define ELEM(x) API_##x,
- typedef enum { APIS NUM_APIS } api_t; /* API_render, API_layout, ... */
+ typedef enum { APIS } api_t; /* API_render, API_layout, ... */
#undef ELEM
typedef struct {
} gvplugin_api_t;
typedef struct {
- char *name; /* used instead of a file pathname when this plugin is builtin */
+ char *name; /* used instead of a file pathname
+ when this plugin is builtin */
gvplugin_api_t *apis;
} gvplugin_t;
--- /dev/null
+/* $Id$ $Revision$ */
+/* vim:set shiftwidth=4 ts=8: */
+
+/**********************************************************
+* This software is part of the graphviz package *
+* http://www.graphviz.org/ *
+* *
+* Copyright (c) 1994-2004 AT&T Corp. *
+* and is licensed under the *
+* Common Public License, Version 1.0 *
+* by AT&T Corp. *
+* *
+* Information and Software Systems Research *
+* AT&T Research, Florham Park NJ *
+**********************************************************/
+
+#ifndef GVTEXT_PLUGIN_H
+#define GVTEXT_PLUGIN_H
+
+#include "gvplugin.h"
+#include "gvcint.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ struct gvtext_engine_s {
+ int (*width) (textline_t *textline, char *fontname, double fontsize, char* fontpath);
+ };
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* GVTEXT_PLUGIN_H */
--- /dev/null
+/* $Id$ $Revision$ */
+/* vim:set shiftwidth=4 ts=8: */
+
+/**********************************************************
+* This software is part of the graphviz package *
+* http://www.graphviz.org/ *
+* *
+* Copyright (c) 1994-2004 AT&T Corp. *
+* and is licensed under the *
+* Common Public License, Version 1.0 *
+* by AT&T Corp. *
+* *
+* Information and Software Systems Research *
+* AT&T Research, Florham Park NJ *
+**********************************************************/
+
+/*
+ * text_layout engine wrapper
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+
+#include "const.h"
+#include "types.h"
+#include "macros.h"
+
+#include "gvplugin_text.h"
+#include "gvc.h"
+
+#if 0
+int gvlayout_select(GVC_t * gvc, char *layout)
+{
+ gv_plugin_t *plugin;
+ gvplugin_type_t *typeptr;
+
+ plugin = gvplugin_load(gvc, API_layout, layout);
+ if (plugin) {
+ typeptr = plugin->typeptr;
+ gvc->layout_type = typeptr->type;
+ gvc->layout_engine = (gvlayout_engine_t *) (typeptr->engine);
+ gvc->layout_id = typeptr->id;
+ return GVRENDER_PLUGIN;
+ }
+ return NO_SUPPORT;
+}
+#endif
+
+double gvtext_width(GVC_t *gvc, textline_t *textline, char *fontname, double fontsize, char *fontpath)
+{
+ gvtext_engine_t *gvte = gvc->text_engine;
+ int rc;
+
+ if (gvte && gvte->width) {
+ rc = gvte->width(textline, fontname, fontsize, fontpath);
+ }
+ return textline->width;
+}