[dia] Remove freetype dependency



commit d2ccbfb0344d3c23719fcb9661e2623830a0142d
Author: Zander Brown <zbrown gnome org>
Date:   Mon Jun 10 11:04:39 2019 +0100

    Remove freetype dependency
    
    It's only used by an alternantive implementation of the postscript plugin

 app/app_procs.c                        |  39 ---
 lib/font-height.c                      |   3 -
 lib/font.c                             |   3 -
 meson.build                            |   2 -
 plug-ins/postscript/diapsft2renderer.c | 485 ---------------------------------
 plug-ins/postscript/diapsft2renderer.h |  34 ---
 plug-ins/postscript/meson.build        |   5 -
 plug-ins/postscript/postscript.c       |   8 -
 plug-ins/postscript/render_eps.c       |  90 ++----
 9 files changed, 26 insertions(+), 643 deletions(-)
---
diff --git a/app/app_procs.c b/app/app_procs.c
index c9532a2a..d4c48408 100644
--- a/app/app_procs.c
+++ b/app/app_procs.c
@@ -29,18 +29,9 @@
 #include <unistd.h>
 #endif
 
-/* wants to be included early to avoid complains about setjmp.h */
-#ifdef HAVE_LIBPNG
-#include <png.h> /* just for the version stuff */
-#endif
-
 #include <gtk/gtk.h>
 #include <gmodule.h>
 
-#ifdef HAVE_FREETYPE
-#include <pango/pangoft2.h>
-#endif
-
 #include <libxml/parser.h>
 #include <libxml/xmlerror.h>
 
@@ -375,29 +366,6 @@ dump_dependencies(void)
    * which may or have cause(d) us trouble in some versions
    */
   g_print ("Library versions (at compile time)\n");
-#ifdef HAVE_LIBPNG
-  g_print ("libpng  : %s (%s)\n", png_get_header_ver(NULL), PNG_LIBPNG_VER_STRING);
-#endif
-#ifdef HAVE_FREETYPE
-  {
-    FT_Library ft_library;
-    FT_Int     ft_major_version;
-    FT_Int     ft_minor_version;
-    FT_Int     ft_micro_version;
-
-    if (FT_Init_FreeType (&ft_library) == 0) {
-      FT_Library_Version (ft_library,
-                          &ft_major_version,
-                          &ft_minor_version,
-                          &ft_micro_version);
-
-      g_print ("freetype: %d.%d.%d\n", ft_major_version, ft_minor_version, ft_micro_version);
-      FT_Done_FreeType (ft_library);
-    }
-    else
-      g_print ("freetype: ?.?.?\n");
-  }
-#endif
   {
     const gchar* libxml_rt_version = "?";
 #if 0
@@ -514,13 +482,6 @@ handle_initial_diagram(const char *in_file_name,
   return made_conversions;
 }
 
-#ifdef HAVE_FREETYPE
-/* Translators:  This is an option, not to be translated */
-#define EPS_PANGO "eps-pango, "
-#else
-#define EPS_PANGO ""
-#endif
-
 #ifdef G_OS_WIN32
 /* Translators:  This is an option, not to be translated */
 #define WMF "wmf, "
diff --git a/lib/font-height.c b/lib/font-height.c
index 4efb58b0..5237bbc4 100644
--- a/lib/font-height.c
+++ b/lib/font-height.c
@@ -21,9 +21,6 @@
 #include <config.h>
 
 #include <pango/pango.h>
-#ifdef HAVE_FREETYPE
-#include <pango/pangoft2.h>
-#endif
 #include <gdk/gdk.h>
 #ifdef GDK_WINDOWING_WIN32
 /* avoid namespace clashes caused by inclusion of windows.h */
diff --git a/lib/font.c b/lib/font.c
index fbce7955..9c7b76f7 100644
--- a/lib/font.c
+++ b/lib/font.c
@@ -27,9 +27,6 @@
 
 #include <pango/pango.h>
 #undef PANGO_DISABLE_DEPRECATED /* pango_ft_get_context */
-#ifdef HAVE_FREETYPE
-#include <pango/pangoft2.h>
-#endif
 #include <gdk/gdk.h>
 #include <gtk/gtk.h> /* just for gtk_get_default_language() */
 #ifdef GDK_WINDOWING_WIN32
diff --git a/meson.build b/meson.build
index 4a18c33b..b5e57a86 100644
--- a/meson.build
+++ b/meson.build
@@ -26,8 +26,6 @@ libm_dep = cc.find_library('m', required: false)
 libc_dep = cc.find_library('c', required: false)
 
 # Optional deps
-freetype_dep = dependency('freetype2', version: ['>= 11.0.5', '< 22.0.0'], required: false)
-conf.set('HAVE_FREETYPE', freetype_dep.found())
 # TODO: Until issue #23 is fixed, we need to keep version below 0.62.
 libpoppler_dep = dependency('poppler', version: '<= 0.62.0', required: false)
 conf.set('HAVE_POPPLER', libpoppler_dep.found())
diff --git a/plug-ins/postscript/meson.build b/plug-ins/postscript/meson.build
index f12b3b14..c5b3bf5e 100644
--- a/plug-ins/postscript/meson.build
+++ b/plug-ins/postscript/meson.build
@@ -7,11 +7,6 @@ sources = files(
 )
 deps = []
 
-if freetype_dep.found()
-    sources += files('diapsft2renderer.c')
-    deps += freetype_dep
-endif
-
 if host_machine.system() == 'windows'
     sources += files('win32print.c')
     deps += cc.find_library('winspool')
diff --git a/plug-ins/postscript/postscript.c b/plug-ins/postscript/postscript.c
index 1859c4b1..e3f004b8 100644
--- a/plug-ins/postscript/postscript.c
+++ b/plug-ins/postscript/postscript.c
@@ -62,10 +62,6 @@ _plugin_unload (PluginInfo *info)
 {
   /* EPS with PS fonts */
   filter_unregister_export(&eps_export_filter);
-#ifdef HAVE_FREETYPE
-  /* EPS with Pango rendering */
-  filter_unregister_export(&eps_ft2_export_filter);
-#endif
 
 #ifndef G_OS_WIN32
   /* on win32 this is too uncommon, can only print to postscript printers */
@@ -86,10 +82,6 @@ dia_plugin_init(PluginInfo *info)
 
   /* EPS with PS fonts */
   filter_register_export(&eps_export_filter);
-#ifdef HAVE_FREETYPE
-  /* EPS with Pango rendering */
-  filter_register_export(&eps_ft2_export_filter);
-#endif
 
 #ifndef G_OS_WIN32
   /* on win32 this is too uncommon, can only print to postscript printers */
diff --git a/plug-ins/postscript/render_eps.c b/plug-ins/postscript/render_eps.c
index f5cfb087..01968004 100644
--- a/plug-ins/postscript/render_eps.c
+++ b/plug-ins/postscript/render_eps.c
@@ -19,7 +19,7 @@
 /* The eps_dump_truetype_body function and much inspiration for font dumping
  * came from ttfps, which bears the following license notice:
 
- Copyright (c) 1997 by Juliusz Chroboczek 
+ Copyright (c) 1997 by Juliusz Chroboczek
 
  Copying
  *******
@@ -63,42 +63,25 @@
 #include "font.h"
 #include "diapsrenderer.h"
 
-#ifdef HAVE_FREETYPE
-#include "diapsft2renderer.h"
-#endif
-
-static gboolean export_eps(DiagramData *data, DiaContext *ctx,
-                          const gchar *filename, const gchar *diafilename, 
-                          void* user_data);
-static gboolean export_render_eps(DiaPsRenderer *renderer, 
-                                 DiagramData *data, DiaContext *ctx,
-                                 const gchar *filename, const gchar *diafilename, 
-                                 void* user_data);
-
-#ifdef HAVE_FREETYPE
-static gboolean export_ft2_eps(DiagramData *data, DiaContext *ctx,
-                              const gchar *filename, const gchar *diafilename,
-                              void* user_data);
-static gboolean
-export_ft2_eps(DiagramData *data, DiaContext *ctx,
-              const gchar *filename, const gchar *diafilename,
-              void* user_data)
-{
-  gboolean ret;
-  DiaPsRenderer *renderer = g_object_new (DIA_TYPE_PS_FT2_RENDERER, NULL);
+static gboolean export_eps        (DiagramData *data,
+                                   DiaContext  *ctx,
+                                   const gchar *filename,
+                                   const gchar *diafilename,
+                                   void        *user_data);
 
-  renderer->ctx = ctx;
-  ret = export_render_eps(renderer, data, ctx, filename, diafilename, user_data);
-  g_object_unref (renderer);
-
-  return ret;
-}
-#endif
+static gboolean export_render_eps (DiaPsRenderer *renderer,
+                                   DiagramData   *data,
+                                   DiaContext    *ctx,
+                                   const gchar   *filename,
+                                   const gchar   *diafilename,
+                                   void          *user_data);
 
 static gboolean
-export_eps(DiagramData *data, DiaContext *ctx,
-          const gchar *filename, const gchar *diafilename,
-          void* user_data)
+export_eps (DiagramData *data,
+            DiaContext  *ctx,
+            const gchar *filename,
+            const gchar *diafilename,
+            void        *user_data)
 {
   gboolean ret;
   DiaPsRenderer *renderer = g_object_new (DIA_TYPE_PS_RENDERER, NULL);
@@ -111,17 +94,19 @@ export_eps(DiagramData *data, DiaContext *ctx,
 }
 
 static gboolean
-export_render_eps(DiaPsRenderer *renderer, 
-                 DiagramData *data, DiaContext *ctx,
-                 const gchar *filename, const gchar *diafilename,
-                 void* user_data)
+export_render_eps (DiaPsRenderer *renderer,
+                   DiagramData   *data,
+                   DiaContext    *ctx,
+                   const gchar   *filename,
+                   const gchar   *diafilename,
+                   void          *user_data)
 {
   FILE *outfile;
 
-  outfile = g_fopen(filename, "w");
+  outfile = g_fopen (filename, "w");
   if (outfile == NULL) {
-    dia_context_add_message_with_errno (ctx, errno, _("Can't open output file %s"), 
-                                       dia_context_get_filename(ctx));
+    dia_context_add_message_with_errno (ctx, errno, _("Can't open output file %s"),
+                                        dia_context_get_filename(ctx));
     return FALSE;
   }
   renderer->file = outfile;
@@ -148,11 +133,7 @@ new_psprint_renderer(DiagramData *dia, FILE *file)
 {
   DiaPsRenderer *renderer;
 
-#ifdef HAVE_FREETYPE
-  renderer = g_object_new (DIA_TYPE_PS_FT2_RENDERER, NULL);
-#else
   renderer = g_object_new (DIA_TYPE_PS_RENDERER, NULL);
-#endif
   renderer->file = file;
   renderer->pstype = PSTYPE_PS;
 
@@ -163,25 +144,6 @@ static const gchar *eps_extensions[] = { "eps", NULL };
 #if 0
 static const gchar *epsi_extensions[] = { "epsi", NULL };
 #endif
-#ifdef HAVE_FREETYPE
-DiaExportFilter eps_ft2_export_filter = {
-  N_("Encapsulated PostScript (using Pango fonts)"),
-  eps_extensions,
-  export_ft2_eps,
-  GINT_TO_POINTER(PSTYPE_EPS), /* user_data */
-  "eps-pango"
-};
-/* Disabled until we can actually make the preview. */
-#  if 0
-DiaExportFilter epsi_ft2_export_filter = {
-  N_("Encapsulated PostScript with preview (using Pango fonts)"),
-  epsi_extensions,
-  export_ft2_eps,
-  GINT_TO_POINTER(PSTYPE_EPSI), /* user_data */
-  "epsi-pango"
-};
-#  endif
-#endif
 
 DiaExportFilter eps_export_filter = {
   N_("Encapsulated PostScript (using PS Latin-1 fonts)"),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]