set gnome-font-viewer as default app for type1, ttf and pcf fonts.

2002-12-05  James Henstridge  <james@daa.com.au>

    * src/fontilus.keys: set gnome-font-viewer as default app for
    type1, ttf and pcf fonts.

    * src/fontilus.applications: add application registry file for
    gnome-font-viewer.  Set it to accept URIs in file:/// and
    fonts:///.  It supports others though ...

    * src/Makefile.am: change executable names, and install them.

    * src/font-view.c (main): add an "in" shadow round the rendered text.
This commit is contained in:
James Henstridge 2002-12-05 15:47:45 +00:00 committed by James Henstridge
parent 88128b9d38
commit 1174a5b0a9
5 changed files with 67 additions and 12 deletions

View file

@ -1,10 +1,20 @@
2002-12-05 James Henstridge <james@daa.com.au>
* src/fontilus.keys: set gnome-font-viewer as default app for
type1, ttf and pcf fonts.
* src/fontilus.applications: add application registry file for
gnome-font-viewer. Set it to accept URIs in file:/// and
fonts:///. It supports others though ...
* src/Makefile.am: change executable names, and install them.
* src/font-view.c (draw_text): move text drawing into separate
function.
(create_text_pixmap): handle bitmap fonts by drawing the test
string at the correct size(s).
(add_face_info): display some information about the font.
(main): add an "in" shadow round the rendered text.
* src/font-view.c (main): change so that it renders the text at a
number of different sizes, like fontcarton did. Need to show some

View file

@ -5,24 +5,32 @@ INCLUDES = $(FONT_METHOD_CFLAGS) $(THUMBNAILER_CFLAGS) $(FONT_VIEW_CFLAGS) \
vfsmoduledir = $(libdir)/gnome-vfs-2.0/modules
vfsmodule_LTLIBRARIES = libfont-method.la
noinst_PROGRAMS = thumbnailer font-view
bin_PROGRAMS = gnome-thumbnail-font gnome-font-viewer
libfont_method_la_LDFLAGS = -module -avoid-version
libfont_method_la_LIBADD = $(FONT_METHOD_LIBS)
libfont_method_la_SOURCES = font-method.c
gnome_thumbnail_font_LDADD = $(THUMBNAILER_LIBS)
gnome_thumbnail_font_SOURCES = ftstream-vfs.c thumbnailer.c
gnome_font_viewer_LDADD = $(FONT_VIEW_LIBS)
gnome_font_viewer_SOURCES = ftstream-vfs.c font-view.c
vfsmoduleconfdir = $(sysconfdir)/gnome-vfs-2.0/modules
vfsmoduleconf_DATA = font-method.conf
vfsdirectorydir = $(datadir)/gnome/vfolders
vfsdirectory_DATA = font-method.directory
thumbnailer_LDADD = $(THUMBNAILER_LIBS)
thumbnailer_SOURCES = ftstream-vfs.c thumbnailer.c
mimeinfodir = $(datadir)/mime-info
mimeinfo_DATA = fontilus.keys
font_view_LDADD = $(FONT_VIEW_LIBS)
font_view_SOURCES = ftstream-vfs.c font-view.c
appregdir = $(datadir)/application-registry
appreg_DATA = fontilus.applications
EXTRA_DIST = \
font-method.conf \
font-method.directory
font-method.directory \
fontilus.keys \
fontilus.applications

View file

@ -134,15 +134,20 @@ add_face_info(GtkWidget *table, gint *row_p, const gchar *uri, FT_Face face)
add_row(table, row_p, _("Style:"), face->style_name);
filename = gnome_vfs_get_local_path_from_uri(uri);
add_row(table, row_p, _("Location:"), filename ? filename : uri);
add_row(table, row_p, _("File name:"), filename ? filename : uri);
g_free(filename);
file_info = gnome_vfs_file_info_new();
if (gnome_vfs_get_file_info
(uri, file_info, GNOME_VFS_FILE_INFO_GET_MIME_TYPE) == GNOME_VFS_OK) {
if ((file_info->valid_fields&GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE) !=0)
add_row(table, row_p, _("Type:"), file_info->mime_type);
if ((file_info->valid_fields&GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE)!=0){
gchar *type = gnome_vfs_mime_get_description(file_info->mime_type);
add_row(table, row_p, _("Type:"),
type ? type : file_info->mime_type);
g_free(type);
}
if ((file_info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) != 0) {
gchar *size;
@ -174,7 +179,7 @@ main(int argc, char **argv)
FT_Face face;
gchar *title;
gint row;
GtkWidget *window, *vbox, *table, *drawing_area;
GtkWidget *window, *vbox, *table, *frame, *drawing_area;
GdkPixmap *pixmap;
GdkColor white = { 0, 0xffff, 0xffff, 0xffff };
@ -225,12 +230,16 @@ main(int argc, char **argv)
row = 0;
add_face_info(table, &row, argv[1], face);
gtk_table_set_col_spacings(GTK_TABLE(table), 4);
gtk_table_set_col_spacings(GTK_TABLE(table), 8);
gtk_table_set_row_spacings(GTK_TABLE(table), 2);
frame = gtk_frame_new(NULL);
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
drawing_area = gtk_drawing_area_new();
gtk_widget_modify_bg(drawing_area, GTK_STATE_NORMAL, &white);
gtk_box_pack_start(GTK_BOX(vbox), drawing_area, FALSE, FALSE, 0);
gtk_container_add(GTK_CONTAINER(frame), drawing_area);
pixmap = create_text_pixmap(drawing_area, face);

View file

@ -0,0 +1,8 @@
gnome-font-viewer
command=gnome-font-viewer
name=GNOME Font Viewer
can_open_multiple_files=false
expects_uris=true
requires_terminal=false
supported_uri_schemes=file,fonts
mime_types=application/x-font-pcf,application/x-font-ttf,application/x-font-type1

View file

@ -0,0 +1,20 @@
application/x-font-type1
default_action_type=application
default_application_id=gnome-font-viewer
short_list_application_ids_for_novice_user_level=gnome-font-viewer
short_list_application_ids_for_intermediate_user_level=gnome-font-viewer
short_list_application_ids_for_advanced_user_level=gnome-font-viewer
application/x-font-ttf
default_action_type=application
default_application_id=gnome-font-viewer
short_list_application_ids_for_novice_user_level=gnome-font-viewer
short_list_application_ids_for_intermediate_user_level=gnome-font-viewer
short_list_application_ids_for_advanced_user_level=gnome-font-viewer
application/x-font-pcf
default_action_type=application
default_application_id=gnome-font-viewer
short_list_application_ids_for_novice_user_level=gnome-font-viewer
short_list_application_ids_for_intermediate_user_level=gnome-font-viewer
short_list_application_ids_for_advanced_user_level=gnome-font-viewer