character by name on the gnome canvas, custom fontencoding
- From: Jan Nieuwenhuizen <janneke gnu org>
- To: gtk-app-devel-list gnome org
- Cc: lilypond-devel gnu org
- Subject: character by name on the gnome canvas, custom fontencoding
- Date: Sat, 08 May 2004 18:30:13 +0200
[sorry for repost]
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 <janneke gnu org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien | http://www.lilypond.org
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]