/* GNU LilyPond * pango-afm-decoder.c -- AFM fontencoding for Pango fontconfig * * Copyright (C) 2004 Jan Nieuwenhuizen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "pangofc-afm-decoder.h" struct _PangoFcAfmDecoderPrivate { GString encoding[256]; //GString file_name; char const *file_name; PangoFcFont *fc_font; }; static void pango_fc_afm_decoder_init (PangoFcAfmDecoder *fontmap); static void pango_fc_afm_decoder_class_init (PangoFcDecoderClass *class); static void pango_fc_afm_decoder_finalize (GObject *object); static FcCharSet *pango_fc_afm_get_charset (PangoFcFont *fcfont); static PangoGlyph pango_fc_afm_get_glyph (PangoFcFont *fcfont, guint32 wc); static void pango_fc_afm_decoder_set_file_name (PangoFcAfmDecoder *self, char const* file_name); static PangoFcDecoderClass *parent_class; GType pango_fc_afm_decoder_get_type (void) { static GType object_type = 0; if (!object_type) { static const GTypeInfo object_info = { sizeof (PangoFcAfmDecoderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pango_fc_afm_decoder_class_init, NULL, /* class_finalize */ NULL, /* class_data */ sizeof (PangoFcAfmDecoder), 0, /* n_preallocs */ (GInstanceInitFunc) pango_fc_afm_decoder_init, }; object_type = g_type_register_static (PANGO_TYPE_FONT_MAP, "PangoFcAfmDecoder", &object_info, 0); } return object_type; } static void pango_fc_afm_decoder_init (PangoFcAfmDecoder *fcafmdecoder) { static gboolean registered_modules = FALSE; PangoFcAfmDecoderPrivate *priv = fcafmdecoder->priv; priv = fcafmdecoder->priv = G_TYPE_INSTANCE_GET_PRIVATE (fcafmdecoder, PANGO_TYPE_FC_AFM_DECODER, PangoFcAfmDecoderPrivate); //self->private = g_new0 (MamanBarPrivate, 1); /* init members */ } static void pango_fc_afm_decoder_class_init (PangoFcDecoderClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); parent_class = g_type_class_peek_parent (class); object_class->finalize = pango_fc_afm_decoder_finalize; class->get_charset = pango_fc_afm_get_charset; class->get_glyph = pango_fc_afm_get_glyph; g_type_class_add_private (object_class, sizeof (PangoFcAfmDecoderPrivate)); } static void pango_fc_afm_decoder_finalize (GObject *object) { PangoFcAfmDecoder *fcafmdecoder = PANGO_FC_AFM_DECODER (object); PangoFcAfmDecoderPrivate *priv = fcafmdecoder->priv; /* destroy members */ G_OBJECT_CLASS (parent_class)->finalize (object); } static FcCharSet * pango_fc_afm_get_charset (PangoFcFont *fcfont) { // read afm // convert afm mapping into FcCharset return 0; } static PangoGlyph pango_fc_afm_get_glyph (PangoFcFont *fcfont, guint32 wc) { // map wc -> character name // `get' character by name from font // turn character into PangoGlyph return 0; } static void pango_fc_afm_decoder_set_file_name (PangoFcAfmDecoder *self, char const* file_name) { self->priv->file_name = file_name; } #include PangoFcDecoder * pango_fc_afm_find_decoder (FcPattern *pattern, gpointer user_data) { /* TODO: - figure out what pattern, use_data are ant what they contain, - if we're a customly encoded afm file, create an afm decoder, - initialize decoder with name of font, or afm file name. */ //PangoFcAfmDecoder *afm = g_object_new (PANGO_FC_AFM_DECODER, null); PangoFcAfmDecoder *afm = g_object_new (PANGO_TYPE_FC_AFM_DECODER, 0); pango_fc_afm_decoder_set_file_name (afm, "feta20.afm"); fprintf (stderr, "Hello world\n"); // Hmmm, is this the right way to return an instance of a derived class? return afm; }