denemo-devel
[Top][All Lists]
Advanced

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

[Denemo-devel] Denemo Breakthrough


From: Richard Shann
Subject: [Denemo-devel] Denemo Breakthrough
Date: Sat, 23 Jul 2011 14:14:07 +0100

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

Richard











reply via email to

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