summaryrefslogtreecommitdiff
path: root/font-viewer
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2017-01-08 16:39:30 +0100
committerraveit65 <[email protected]>2017-02-17 12:28:22 +0100
commit77f1936f75f15ea80d72b4423dd471a37798cb22 (patch)
treefde5e90edd6a74a2799fd30e02bd87ea8990620b /font-viewer
parent4e1412dc8d5c1862aef63d6ce95165edeaf5a618 (diff)
downloadmate-control-center-77f1936f75f15ea80d72b4423dd471a37798cb22.tar.bz2
mate-control-center-77f1936f75f15ea80d72b4423dd471a37798cb22.tar.xz
Font-viewer: remove ftstream-vfs
taken from: https://git.gnome.org/browse/gnome-font-viewer/commit/?id=0522313
Diffstat (limited to 'font-viewer')
-rw-r--r--font-viewer/Makefile.am4
-rw-r--r--font-viewer/ftstream-vfs.c154
-rw-r--r--font-viewer/ftstream-vfs.h35
3 files changed, 2 insertions, 191 deletions
diff --git a/font-viewer/Makefile.am b/font-viewer/Makefile.am
index 53bd887b..5991d0e6 100644
--- a/font-viewer/Makefile.am
+++ b/font-viewer/Makefile.am
@@ -9,10 +9,10 @@ font_loader_SOURCES = \
sushi-font-loader.c
mate_thumbnail_font_LDADD = $(MATECC_CAPPLETS_LIBS) $(FONT_VIEWER_LIBS)
-mate_thumbnail_font_SOURCES = ftstream-vfs.c ftstream-vfs.h $(font_loader_SOURCES) font-thumbnailer.c totem-resources.c totem-resources.h
+mate_thumbnail_font_SOURCES = $(font_loader_SOURCES) font-thumbnailer.c totem-resources.c totem-resources.h
mate_font_viewer_LDADD = $(MATECC_CAPPLETS_LIBS) $(FONT_VIEWER_LIBS)
-mate_font_viewer_SOURCES = ftstream-vfs.c ftstream-vfs.h $(font_loader_SOURCES) sushi-font-widget.h sushi-font-widget.c font-view.c
+mate_font_viewer_SOURCES = $(font_loader_SOURCES) sushi-font-widget.h sushi-font-widget.c font-view.c
thumbnailerdir = $(datadir)/thumbnailers
thumbnailer_DATA = mate-font-viewer.thumbnailer
diff --git a/font-viewer/ftstream-vfs.c b/font-viewer/ftstream-vfs.c
deleted file mode 100644
index cf666f2e..00000000
--- a/font-viewer/ftstream-vfs.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/* -*- mode: C; c-basic-offset: 4 -*- */
-
-/*
- * ftstream-vfs: a FreeType/GIO stream bridge
- *
- * Copyright (C) 2002-2003 James Henstridge <[email protected]>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#include <gio/gio.h>
-
-#include "ftstream-vfs.h"
-
-static unsigned long
-vfs_stream_read (FT_Stream stream,
- unsigned long offset,
- unsigned char *buffer,
- unsigned long count)
-{
- GFileInputStream *handle = stream->descriptor.pointer;
- gssize bytes_read = 0;
-
- if (!g_seekable_seek (G_SEEKABLE (handle), offset, G_SEEK_SET, NULL, NULL))
- return 0;
-
- if (count > 0) {
- bytes_read = g_input_stream_read (G_INPUT_STREAM (handle), buffer,
- count, NULL, NULL);
-
- if (bytes_read == -1)
- return 0;
- }
-
- return bytes_read;
-}
-
-static void
-vfs_stream_close (FT_Stream stream)
-{
- GFileInputStream *handle = stream->descriptor.pointer;
-
- if (handle == NULL)
- return;
-
- /* this also closes the stream */
- g_object_unref (handle);
-
- stream->descriptor.pointer = NULL;
- stream->size = 0;
- stream->base = NULL;
-}
-
-static FT_Error
-vfs_stream_open (FT_Stream stream,
- const char *uri)
-{
- GFile *file;
- GFileInfo *info;
- GFileInputStream *handle;
-
- file = g_file_new_for_uri (uri);
- handle = g_file_read (file, NULL, NULL);
-
- if (handle == NULL) {
- g_object_unref (file);
- return FT_Err_Cannot_Open_Resource;
- }
-
- info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_SIZE,
- G_FILE_QUERY_INFO_NONE, NULL,
- NULL);
- g_object_unref (file);
-
- if (info == NULL) {
- return FT_Err_Cannot_Open_Resource;
- }
-
- stream->size = g_file_info_get_size (info);
-
- g_object_unref (info);
-
- stream->descriptor.pointer = handle;
- stream->pathname.pointer = NULL;
- stream->pos = 0;
-
- stream->read = vfs_stream_read;
- stream->close = vfs_stream_close;
-
- return FT_Err_Ok;
-}
-
-/* load a typeface from a URI */
-FT_Error
-FT_New_Face_From_URI (FT_Library library,
- const gchar* uri,
- FT_Long face_index,
- FT_Face *aface)
-{
- FT_Open_Args args;
- FT_Stream stream;
- FT_Error error;
-
- stream = calloc (1, sizeof (*stream));
-
- if (stream == NULL)
- return FT_Err_Out_Of_Memory;
-
- error = vfs_stream_open (stream, uri);
-
- if (error != FT_Err_Ok) {
- free (stream);
- return error;
- }
-
- args.flags = FT_OPEN_STREAM;
- args.stream = stream;
-
- error = FT_Open_Face (library, &args, face_index, aface);
-
- if (error != FT_Err_Ok) {
- if (stream->close != NULL)
- stream->close(stream);
-
- free (stream);
- return error;
- }
-
- /* so that freetype will free the stream */
- (*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;
-
- return error;
-}
diff --git a/font-viewer/ftstream-vfs.h b/font-viewer/ftstream-vfs.h
deleted file mode 100644
index c550cafd..00000000
--- a/font-viewer/ftstream-vfs.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- mode: C; c-basic-offset: 4 -*- */
-
-/*
- * ftstream-vfs: a FreeType/GIO stream bridge
- *
- * Copyright (C) 2002-2003 James Henstridge <[email protected]>
- *
- * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef __FTSTREAM_VFS_H__
-#define __FTSTREAM_VFS_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include <glib.h>
-
-FT_Error FT_New_Face_From_URI (FT_Library library,
- const gchar* uri,
- FT_Long face_index,
- FT_Face *aface);
-
-#endif /* __FTSTREAM_VFS_H__ */