lilypond-devel
[Top][All Lists]
Advanced

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

character by name on the gnome canvas, custom fontencoding


From: Jan Nieuwenhuizen
Subject: character by name on the gnome canvas, custom fontencoding
Date: Sat, 08 May 2004 18:30:13 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

I'm having trouble to get gnomecanvas/pango to draw a character from
LilyPond's custom-encoded music font: lilypond-feta.  The problem also
applies for LilyPond's sodipodi/svg output that is currently broken.

lilypond-feta.afm snippet:
  FontEncoding fetaMusic
  C 60 ;  N noteheads-0 ; B 0 -2749 9900 2749 ; W 9900 0 ;
  Comment faked ascii `a' with whole note head
  C 97 ;  N a           ; B 0 -2749 9900 2749 ; W 9900 0 ;
  Comment faked ascii `b' with G/treble clef
  C 98 ;  N b           ; B 0 -13000 12825 25000 ; W 12825 0 ;
  C 175 ; N clefs-G     ; B 0 -13000 12825 25000 ; W 12825 0 ;

C snippet:
  /* create canvas */
  canvas = GNOME_CANVAS (canvas_widget);
  root = gnome_canvas_root (canvas);
  int text_item = gnome_canvas_text_get_type ();
  gnome_canvas_item_new (root, text_item, "x", 45.0, "y", 122.5,
                         "font", "lilypond-feta-nummer 16", "text", "3",
                         "anchor", GTK_ANCHOR_WEST, "fill_color", "black", 0);
  gnome_canvas_item_new (root, text_item, "x", 45.0, "y", 142.5,
                         "font", "lilypond-feta-nummer, r 16", "text", "4",
                         "anchor", GTK_ANCHOR_WEST, "fill_color", "black", 0);
  gnome_canvas_item_new (root, text_item, "x", 80.0, "y", 142.0,
                         "font", "lilypond-feta, r 32", "text", "ab<¯",
                         "anchor", GTK_ANCHOR_WEST, "fill_color", "black", 0);

The numbers (feta-nummer font) show alright, but they use standard
names and encoding.  The "ab" (faked whole note and treble clef) look
alright but the "<" (whole note head at index: 60, < less than) gets
displayed as "<" using another font and the "¯" (clef at index 175, ¯
macron) is not displayed at all.

I remembered that custom encoded-fonts may get mapped (or mapped
partly, the `a' and `b' are still/also at latin1 positions) onto the
private unicode area (0xe0000 and up); so I've tried several shots at
that, remapping per character and converting to a utf8 sequence, but
to no avail.

What I'm actually/probably looking for is to select characters by name
to add them to a canvas writable text, something like

    pango_addchar (&string, "font", "lilypond-feta, r16",
                   "char-name", "noteheads-0", 0);

but it might be better to also remap the font, using better names than
`noteheads-0'.
                  
Can you help me with this, how does this work, where should I look/ask?

Jan.

-- 
Jan Nieuwenhuizen <address@hidden> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org





reply via email to

[Prev in Thread] Current Thread [Next in Thread]