From 765d8e8dfee2fcc86493d8e01463947762079dbf Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Fri, 17 Dec 2004 14:45:28 +0000 Subject: [PATCH] *** empty log message *** --- ChangeLog | 6 + lily/custos.cc | 2 +- lily/include/pangofc-afm-decoder.hh | 88 --------- lily/key-signature-interface.cc | 2 +- lily/main.cc | 2 +- lily/pangofc-afm-decoder.cc | 279 ---------------------------- mf/GNUmakefile | 13 +- scm/output-tex.scm | 22 ++- 8 files changed, 32 insertions(+), 382 deletions(-) delete mode 100644 lily/include/pangofc-afm-decoder.hh delete mode 100644 lily/pangofc-afm-decoder.cc diff --git a/ChangeLog b/ChangeLog index a5ed9deaaa..3351f0ba0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,12 @@ 2004-12-17 Han-Wen Nienhuys + * lily/main.cc (setup_paths): replace afm by otf for path. + + * lily/pangofc-afm-decoder.cc: remove. + + * lily/include/pangofc-afm-decoder.hh: remove. + * scm/framework-scm.scm (output-framework): new file. * mf/GNUmakefile: remove SAUTER_FONTS. diff --git a/lily/custos.cc b/lily/custos.cc index bdc155fb89..38dd09a6fc 100644 --- a/lily/custos.cc +++ b/lily/custos.cc @@ -56,7 +56,7 @@ Custos::print (SCM smob) int pos = Staff_symbol_referencer::get_rounded_position (me); int sz = Staff_symbol_referencer::line_count (me)-1; - String font_char = "custodes-" + style + "-"; + String font_char = "custodes." + style + "."; if (pos < neutral_pos) font_char += "u"; else if (pos > neutral_pos) diff --git a/lily/include/pangofc-afm-decoder.hh b/lily/include/pangofc-afm-decoder.hh deleted file mode 100644 index 45a4e48fa9..0000000000 --- a/lily/include/pangofc-afm-decoder.hh +++ /dev/null @@ -1,88 +0,0 @@ -/* - pangofc-afm-decoder.h -- - - source file of the GNU LilyPond music typesetter - - Copyright (C) 2004 Jan Nieuwenhuizen - - Note: in C and with explicit LPGL header for easier use with PANGO - outside of LilyPond. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser 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 -*/ - -#ifndef __PANGOFC_AFM_DECODER_H__ -#define __PANGOFC_AFM_DECODER_H__ - -#include "config.hh" -#if HAVE_PANGO_FC_FONT_MAP_ADD_DECODER_FIND_FUNC - -/* Note: in C and with explicit header for use outside of LilyPond. */ - -#include - -G_BEGIN_DECLS - -#define PANGO_TYPE_FC_AFM_DECODER (pango_fc_afm_decoder_get_type ()) -#define PANGO_FC_AFM_DECODER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FC_AFM_DECODER, PangoFcAfmDecoder)) -#define PANGO_IS_FC_AFM_DECODER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FC_AFM_DECODER)) - -#define PANGO_FC_AFM_DECODER_CLASS(clss) (G_TYPE_CHECK_CLASS_CAST ((clss), PANGO_TYPE_FC_AFM_DECODER, PangoFcAfmDecoderClass)) -#define PANGO_IS_FC_AFM_DECODER_CLASS(clss) (G_TYPE_CHECK_CLASS_TYPE ((clss), PANGO_TYPE_FC_AFM_DECODER)) -#define PANGO_FC_AFM_DECODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FC_AFM_DECODER, PangoFcAfmDecoderClass)) - -typedef struct _PangoFcAfmDecoder PangoFcAfmDecoder; -typedef struct _PangoFcAfmDecoderClass PangoFcAfmDecoderClass; -typedef struct _PangoFcAfmDecoderPrivate PangoFcAfmDecoderPrivate; - - -/** - * PangoFcAfmDecoder: - * - * #PangoFcAfmDecoder implements an PangoFcDecoder for fonts - * with an afm mapping. - **/ -struct _PangoFcAfmDecoder -{ - PangoFcDecoder parent_instance; - - /*< private >*/ - PangoFcAfmDecoderPrivate *priv; -}; - -PangoFcAfmDecoder *pango_fc_afm_decoder_new (void); -PangoFcDecoder *pango_fc_afm_find_decoder (FcPattern *pattern, gpointer user_data); -void pango_fc_afm_add_decoder (char const *family_name); - -/** - * PangoFcAfmDecoderClass: - * @read_afm: Read afm mapping for #fcfont. - * - * Class structure for #PangoFcAfmDecoder. - **/ -struct _PangoFcAfmDecoderClass -{ - /*< private >*/ - PangoFcDecoderClass parent_class; - - /*< public >*/ - void (*read_afm) (PangoFcAfmDecoder *self, PangoFcFont *fcfont); -}; - -G_END_DECLS - -#endif /* HAVE_PANGO_FC_FONT_MAP_ADD_DECODER_FIND_FUNC */ - -#endif /* __PANGOFC_AFM_DECODER_H__ */ diff --git a/lily/key-signature-interface.cc b/lily/key-signature-interface.cc index 652eff7d16..e0a21b85d7 100644 --- a/lily/key-signature-interface.cc +++ b/lily/key-signature-interface.cc @@ -149,7 +149,7 @@ Key_signature_interface::print (SCM smob) Stencil natural; if (scm_is_pair (old)) natural = Font_interface::get_default_font (me)-> - find_by_name (String ("accidentals-") + style + String ("0")); + find_by_name (String ("accidentals.") + style + String ("0")); int last_pos = -100; diff --git a/lily/main.cc b/lily/main.cc index 4b2df95954..ba2ba61a6e 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -226,7 +226,7 @@ setup_paths () /* Adding mf/out make lilypond unchanged source directory, when setting LILYPONDPREFIX to lilypond-x.y.z */ - char *suffixes[] = {"ly", "afm", "mf/out", "scm", "tfm", "ps", 0}; + char *suffixes[] = {"ly", "otf", "mf/out", "scm", "tfm", "ps", 0}; for (unsigned i = 0; prefix_directory[i]; i++) for (char **s = suffixes; *s; s++) diff --git a/lily/pangofc-afm-decoder.cc b/lily/pangofc-afm-decoder.cc deleted file mode 100644 index 0695000af5..0000000000 --- a/lily/pangofc-afm-decoder.cc +++ /dev/null @@ -1,279 +0,0 @@ -/* - pango-afm-decoder.c -- AFM fontencoding for Pango fontconfig - - source file of the GNU LilyPond music typesetter - - Copyright (C) 2004 Jan Nieuwenhuizen - - Note: in C and with explicit LPGL header for easier use with PANGO - outside of LilyPond. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser 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 "config.hh" -#if HAVE_PANGO_FC_FONT_MAP_ADD_DECODER_FIND_FUNC - -/* Need to access to PangoFcFont.full_pattern. */ -#define PANGO_ENABLE_BACKEND - -#include -#include -#include -#include -#include - -#include "pangofc-afm-decoder.hh" - -#ifdef DEBUG_PANGO_AFM -#include -#define dprintf(args...) fprintf (stderr, args) -#else -#define dprintf(args...) -#endif - -#ifndef PANGO_FC_AFM_DECODER_TEST -#define PUA_OFFSET 0xe00 -#else -#define PUA_OFFSET 0 -#endif - -struct _PangoFcAfmDecoderPrivate -{ - GString encoding[256]; - char const *file_name; - PangoFcFont *fc_font; -}; - -static void pango_fc_afm_decoder_init (PangoFcAfmDecoder *fontmap); -static void pango_fc_afm_decoder_class_init (PangoFcAfmDecoderClass *clss); -static void pango_fc_afm_decoder_finalize (GObject *object); - -static FcCharSet *pango_fc_afm_get_charset (PangoFcDecoder *decoder, - PangoFcFont *fcfont); -static PangoGlyph pango_fc_afm_get_glyph (PangoFcDecoder *decoder, - PangoFcFont *fcfont, guint32 wc); -static void pango_fc_afm_decoder_set_file_name (PangoFcAfmDecoder *self, - char const *file_name); - -static PangoFcDecoderClass *parent_class; - -G_DEFINE_TYPE (PangoFcAfmDecoder, pango_fc_afm_decoder, PANGO_TYPE_FC_DECODER); - -static void -pango_fc_afm_decoder_init (PangoFcAfmDecoder *fcafmdecoder) -{ - PangoFcAfmDecoderPrivate *priv = fcafmdecoder->priv; - priv = fcafmdecoder->priv - = G_TYPE_INSTANCE_GET_PRIVATE (fcafmdecoder, - PANGO_TYPE_FC_AFM_DECODER, - PangoFcAfmDecoderPrivate); -} - -static void -pango_fc_afm_decoder_class_init (PangoFcAfmDecoderClass *clss) -{ - GObjectClass *object_class = G_OBJECT_CLASS (clss); - object_class->finalize = pango_fc_afm_decoder_finalize; - g_type_class_add_private (object_class, sizeof (PangoFcAfmDecoderPrivate)); - - PangoFcDecoderClass *parent_class = PANGO_FC_DECODER_CLASS (clss); - parent_class->get_charset = pango_fc_afm_get_charset; - parent_class->get_glyph = pango_fc_afm_get_glyph; -} - -static void -pango_fc_afm_decoder_finalize (GObject *object) -{ - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static FcCharSet * -pango_fc_afm_get_charset (PangoFcDecoder *decoder, PangoFcFont *fcfont) -{ - (void) decoder; - dprintf ("get charset: \n"); -#if 0 - FcCharSet *charset = 0; - FcPatternGetCharSet (fcfont->font_pattern, FC_CHARSET, 0, &charset); -#else - /* Return plain, undecoded charset. - FIXME: - - actually read AFM - - caching */ - (void) fcfont; - int i; - FcChar32 chr = 0; - FcCharSet *charset = FcCharSetCreate (); - for (i = 0; i < 256; i++) - if (!FcCharSetAddChar (charset, chr++)) - return 0; -#endif - return charset; -} - -static PangoGlyph -pango_fc_afm_get_glyph (PangoFcDecoder *decoder, PangoFcFont *fcfont, - guint32 wc) -{ - (void) decoder; -#if 0 - XftFont *xft_font; - xft_font = XftFontOpenPattern (GDK_DISPLAY (), - FcPatternDuplicate (fcfont->font_pattern)); - PangoGlyph g = XftCharIndex (0, xft_font, wc); - dprintf ("get glyph! 0x%x --> 0x%x\n", wc, (unsigned)g); -#else - (void) fcfont; - /* FIXME - Use direct privat usage area (PUA) mapping as shortcut for - actual AFM reading. The Feta charsets are encoded without any - gaps, and mappend onto PUA. */ - return wc - PUA_OFFSET; -#endif -} - -static void -pango_fc_afm_decoder_set_file_name (PangoFcAfmDecoder *self, - char const *file_name) -{ - self->priv->file_name = file_name; -} - -PangoFcAfmDecoder * -pango_fc_afm_decoder_new (void) -{ - return PANGO_FC_AFM_DECODER (g_object_new (PANGO_TYPE_FC_AFM_DECODER, 0)); -} - -PangoFcDecoder * -pango_fc_afm_find_decoder (FcPattern *pattern, gpointer user_data) -{ - FcChar8 *family_name; - - if (FcPatternGetString (pattern, FC_FAMILY, 0, &family_name) - == FcResultMatch) - { - dprintf ("Family name: %s\n", family_name); - dprintf ("user_data: %s\n", (char const*) user_data); - - if (!strcasecmp ((char const*) family_name, (char const*) user_data)) - { - PangoFcAfmDecoder *afm = pango_fc_afm_decoder_new (); - char const *file_name = "feta20.afm"; - pango_fc_afm_decoder_set_file_name (afm, file_name); - dprintf ("Adding decoder: %s\n", file_name); - return PANGO_FC_DECODER (afm); - } - } - return 0; -} - -void -pango_fc_afm_add_decoder (char const *family_name) -{ - PangoFcFontMap *fc_map - = PANGO_FC_FONT_MAP (pango_xft_get_font_map (GDK_DISPLAY (), 0)); - - pango_fc_font_map_add_decoder_find_func (fc_map, pango_fc_afm_find_decoder, - (gpointer)family_name, 0); -} - -#ifdef PANGO_FC_AFM_DECODER_TEST - -#include -#include -#include -#include -#include - -#include "pangofc-afm-decoder.hh" - -#define CANVAS_WIDTH 600 -#define CANVAS_HEIGHT 300 - -static void -exit_clicked (GtkWidget *widget, gpointer data) -{ - gtk_widget_destroy (GTK_WIDGET (data)); - gtk_main_quit (); -} - -static gint -delete_event (GtkWidget *widget, GdkEvent *event, gpointer data) -{ - gtk_widget_destroy (widget); - gtk_main_quit (); - return TRUE; -} - -GnomeCanvas * -make_canvas (int width, int height) -{ - GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - GtkWidget *vbox = gtk_vbox_new (FALSE, 0); - GtkWidget *canvas = gnome_canvas_new (); - GtkWidget *hbox = gtk_hbox_new (TRUE, 0); - GtkWidget *button = gtk_button_new_with_label ("Exit"); - - gtk_container_add (GTK_CONTAINER (window), vbox); - gtk_widget_set_size_request (canvas, width, height); - gtk_box_pack_start (GTK_BOX (vbox), canvas, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); - - gtk_signal_connect (GTK_OBJECT (button), "clicked", - (GtkSignalFunc) exit_clicked, window); - - gtk_signal_connect (GTK_OBJECT (window), "delete_event", - (GtkSignalFunc) delete_event, 0); - - gtk_widget_show_all (window); - return GNOME_CANVAS (canvas); -} - -#define gnome_canvas_text(x, y, font, text) \ - gnome_canvas_item_new (root, text_item, "x", x, "y", y, "font", font, \ - "text", text, "anchor", GTK_ANCHOR_SOUTH_WEST, \ - "fill_color", "black", 0) - -int -main (int argc, char **argv) -{ - gtk_init (&argc, &argv); - GnomeCanvas *canvas = make_canvas (CANVAS_WIDTH, CANVAS_HEIGHT); - - /* Register GNU LilyPond FETA AFM decoders. */ - pango_fc_afm_add_decoder ("lilypond-feta"); - pango_fc_afm_add_decoder ("lilypond-feta-braces-f"); - pango_fc_afm_add_decoder ("lilypond-din"); - pango_fc_afm_add_decoder ("lilypond-parmesan"); - - int text_item = gnome_canvas_text_get_type (); - GnomeCanvasGroup *root = gnome_canvas_root (canvas); - char const *g_clef_utf8 = "p"; - - gnome_canvas_text (45.0, 122.5, "LilyPond-feta-nummer 16", "3"); - gnome_canvas_text (45.0, 142.5, "LilyPond-feta-nummer, r 16", "4"); - gnome_canvas_text (10.0, 142.0, "LilyPond-feta, 32", g_clef_utf8); - gnome_canvas_text (10.0, 162.0, "LilyPond-feta-din, 32", "fmsrpz"); - gnome_canvas_text (5.0, 142.0, "LilyPond-feta-braces-f, 32", "AZ"); - - gtk_main (); - return 0; -} -#endif /* PANGO_FC_AFM_DECODER_TEST */ - -#endif /* HAVE_PANGO_FC_FONT_MAP_ADD_DECODER_FIND_FUNC */ diff --git a/mf/GNUmakefile b/mf/GNUmakefile index 79ade05fc4..1347c415d1 100644 --- a/mf/GNUmakefile +++ b/mf/GNUmakefile @@ -17,7 +17,7 @@ FETA_MF_FILES = $(wildcard feta[0-9]*.mf)\ STAFF_SIZES = 11 13 14 16 18 20 23 26 BRACES = a b c d e f g h i -CHEESES = $(addsuffix .otf, $(addprefix $(outdir)/bigcheese, $(STAFF_SIZES)))\ +OTF_FILES = $(addsuffix .otf, $(addprefix $(outdir)/bigcheese, $(STAFF_SIZES)))\ $(outdir)/aybabtu.otf PE_SCRIPTS = $(addsuffix .pe, $(addprefix $(outdir)/bigcheese, $(STAFF_SIZES))) \ $(addsuffix .dep, $(addprefix $(outdir)/bigcheese, $(STAFF_SIZES))) @@ -71,18 +71,13 @@ $(PE_SCRIPTS): include $(outdir)/bigcheese20.dep -foo: - echo $(CHEESES) -## use separate package sauter-fonts-mftraced. -SAUTER_FONTS = - ALL_FONTS = $(FETA_FONTS) $(SAUTER_FONTS) PFA_FILES = $(ALL_FONTS:%=$(outdir)/%.pfa) PFB_FILES = $(PFA_FILES:%.pfa=%.pfb) # Make tfm files first, log files last, # so that normally log files aren't made twice -ALL_GEN_FILES= $(TFM_FILES) $(TEXTABLES) $(TFM_FILES) $(LOG_FILES) $(ENC_FILES) $(LISP_FILES) $(FETA_LIST_FILES) $(OTF_TABLES) $(PFA_FILES) $(outdir)/lilypond.map $(outdir)/fonts.scale $(outdir)/Fontmap.lily $(CHEESES) +ALL_GEN_FILES= $(TFM_FILES) $(TEXTABLES) $(TFM_FILES) $(LOG_FILES) $(ENC_FILES) $(LISP_FILES) $(FETA_LIST_FILES) $(OTF_TABLES) $(PFA_FILES) $(outdir)/lilypond.map $(outdir)/fonts.scale $(outdir)/Fontmap.lily $(OTF_FILES) #PRE_INSTALL=$(MAKE) "$(ALL_GEN_FILES)" INSTALLATION_DIR=$(local_lilypond_datadir)/fonts/source @@ -93,6 +88,9 @@ INSTALLATION_OUT_SUFFIXES=1 2 3 4 5 6 7 INSTALLATION_OUT_DIR1=$(local_lilypond_datadir)/tex INSTALLATION_OUT_FILES1=$(TEXTABLES) +INSTALLATION_OUT_DIR2=$(local_lilypond_datadir)/otf +INSTALLATION_OUT_FILES2=$(OTF_FILES) + INSTALLATION_OUT_DIR3=$(local_lilypond_datadir)/fonts/tfm INSTALLATION_OUT_FILES3=$(TFM_FILES) @@ -108,6 +106,7 @@ INSTALLATION_OUT_FILES6=$(outdir)/lilypond.map INSTALLATION_OUT_DIR7=$(local_lilypond_datadir)/ps/ INSTALLATION_OUT_FILES7=$(ENC_FILES) + export MFINPUTS:=.:$(MFINPUTS) default: pfa_warning $(ALL_GEN_FILES) $(outdir)/bigcheese20.otf diff --git a/scm/output-tex.scm b/scm/output-tex.scm index c1fd784b86..f2d8da9456 100644 --- a/scm/output-tex.scm +++ b/scm/output-tex.scm @@ -63,6 +63,9 @@ ;;;;;;;; +(define (char font i) + (string-append "\\" (tex-font-command font) + "\\char" (ly:inexact->string i 10) " ")) (define (unknown) "%\n\\unknown\n") @@ -92,13 +95,22 @@ (embedded-ps (list 'dashed-slur thick dash `(quote ,l)))) (define (named-glyph font name) - (let* ((info (ly:otf-font-glyph-info font name))) + (let* ((info (ly:otf-font-glyph-info font name)) + (subfont (assoc-get 'subfont info)) + (subidx (assoc-get 'subfont-index info))) + ;;(stderr "INFO: ~S\n" info) ;;(stderr "FONT: ~S\n" font) - (string-append "\\" (tex-font-command-raw - (assoc-get 'subfont info) - (ly:font-magnification font)) - "\\char" (number->string (assoc-get 'subfont-index info))))) + (if (and subfont subidx) + (string-append "\\" (tex-font-command-raw + subfont + (ly:font-magnification font)) + "\\char" (number->string subidx)) + + (begin + (ly:warn "Can't find ~a in ~a" name font) + "")) + )) (define (dashed-line thick on off dx dy) (embedded-ps (list 'dashed-line thick on off dx dy))) -- 2.39.5