denemo-devel
[Top][All Lists]
Advanced

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

Re: [Denemo-devel] Denemo Breakthrough


From: Ralf Mattes
Subject: Re: [Denemo-devel] Denemo Breakthrough
Date: Sun, 24 Jul 2011 15:08:59 +0000 (UTC)
User-agent: Pan/0.132 (Waxed in Black)

On Sat, 23 Jul 2011 14:14:07 +0100, Richard Shann wrote:

> We have long suffered from a problem loading .svg graphics. One plan I
> proposed was to use what we know works, namely fonts - all our
> noteheads/rests/accidentals are drawn by writing single characters in
> feta26 font.
> I thought as it was creating a logjam, I would implement that, and when
> I did I realized we have something more powerful in our hands - we can
> use any glyph from any (installed) font. So what I have done is to
> augment the semantics of the procedure
> 
> (d-DirectivePut-xxx-graphic tag graphic) ;;; xxx is one of standalone,
> chord, note, staff ... and tag and graphic must be strings
> 
> where graphic can now have more than one line. The first line is a
> filename (interpreted, as before, as a filename - .png or .svg added as
> needed), but if empty then the other lines are read as a utf8 string, a
> font name, a font size, a font weight and a font slant. The lines can be
> cut short, so there is no need to specify all of the values.
> 
> (d-DirectivePut-standalone-graphic tag " \x20")
> 
> for example generates character 0x20 in the feta26 font at 35 point,
> normal weight and slant. An alternative way of writing this, is thus
> 
> (d-DirectivePut-standalone-graphic tag "\n\x20")
> 
> where the empty first line (meaning *not* a graphic file on disk) is
> indicated by the \n newline character.
> 
> With this syntax we can write, for example:
> 
> (d-DirectivePut-standalone-graphic tag " t
> Denemo")
> 
> to place the character 't' from the Denemo.ttf font in the display.
> (This is the 1/4 note rest).
> 
> (d-DirectivePut-standalone-graphic tag " Hello\nTimes\n24\n1\n1")
> 
> would display Hello in a Times Roman typeface at 24pt in bold and
> italic. (The values I have put here as 1 are actually
> CAIRO_FONT_WEIGHT_BOLD and CAIRO_FONT_SLANT_ITALIC which will need
> defining for scripters - I have allowed any value here, thinking of
> possible future cairo developments, but the downside is that bad values
> can be used to bad effect).
> 
> This new feature does not allow us to easily drop new .svg files into
> Denemo for use as graphics, but it opens up the possibility of using
> other symbols - for example an arrow to indicate where a problem lies in
> a score etc. Does anyone know what symbol fonts we can count on being
> present? Or should we install one?
> Another topic arises - can we make the Denemo.ttf font more useful -
> I'll cover that in a separate email

Hello,

sorry if I seem to just complain, but that's an extremely ugly interface.
You're introducing an ad-hoc markup language without need - have a look at
Gtk's (Pango's, to be more specific) markup language [1]. 
May I suggest a more "scheme-ish" way: 

 d-DirectivePut-standalone-graphic tag <spec>

 Where spec is either a string (backward-comaptible) or a list of the
 form (<type> &rest ...)  where type is a keyword and the rest args
 specify type specific information. A few examples:

  (d-DirectivePut-standalone-graphic tag (:graphic :file 
"/home/wallace/cheese.svg"))
 
  (d-DirectivePut-standalone-graphic tag (:glyph "MUSICAL SYMBOL DOUBLE FLAT" 
:font "Lucida Bright"))

  etc. etc. 

  (d-DirectivePut-standalone-graphic tag "honk.svg")

 would still do what it does now.

Cheers, RalfD

  
   

[1] http://www.pygtk.org/docs/pygtk/pango-markup-language.html

> Richard





reply via email to

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