MAJOR_VERSION=1
MINOR_VERSION=3
PATCH_LEVEL=96
-MY_PATCH_LEVEL=jcn5
+MY_PATCH_LEVEL=jcn6
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
c-\textscript #'(bold "textb")
d-\textscript #'(lines "een" "twee" "drie")
e-\textscript #'(lines (bold "een")
- (rows "en" "dat" "is" ((family . "orator") "2"))
+ (rows "en" "dat" "is" ((family . "number") "2"))
(italic "drie"))
f-\textscript #'(finger "3")
+ g-\textscript #'(music (named "noteheads-2"))
}
\paper{
linewidth = -1.\mm;
TextScript \push #'style-sheet = #'paper16
TextScript \push #'font-family = #'roman
TextScript \pop #'no-spacing-rods
+ TextScript \push #'direction = #1
}
}
}
static Molecule text2molecule (Score_element *me, SCM text, SCM properties);
static Molecule string2molecule (Score_element *me, SCM text, SCM properties);
static Molecule markup_sentence2molecule (Score_element *me, SCM markup_sentence, SCM properties);
+ static Molecule lookup_character (Score_element *me, SCM font_name, SCM text);
+ static Molecule lookup_text (Score_element *me, SCM font_name, SCM char_name);
};
#endif /* TEXT_ITEM */
return text;
}
-/**
- JUNKME
- */
-String
-sanitise_PS_string (String t)
-{
- return t;
-}
-
/**
JUNKME
*/
String str (lines[i]);
if (output_global_ch == "tex")
str = sanitise_TeX_string (str);
- else if (output_global_ch == "ps")
- str = sanitise_PS_string (str);
lines[i] = str;
}
Jan Nieuwenhuizen <janneke@gnu.org>
*/
+#include "debug.hh"
#include "text-item.hh"
#include "paper-def.hh"
#include "lookup.hh"
SCM f = me->get_elt_property ("properties-to-font-name");
font_name = gh_call2 (f, paper, properties);
}
- String font_str = "roman";
- if (gh_string_p (font_name))
- font_str = ly_scm2string (font_name);
+
+ // should move fallback to scm
+ if (!gh_string_p (font_name))
+ font_name = ly_str02scm ("cmr10");
- SCM magnification = me->get_elt_property ("font-magnification");
+ SCM lookup = scm_assoc (ly_symbol2scm ("lookup"), properties);
- Font_metric* metric_l = 0;
- if (gh_number_p (magnification))
- metric_l = all_fonts_global_p->find_scaled (font_str,
- gh_scm2int (magnification));
+ Molecule mol;
+ if (gh_pair_p (lookup) && ly_symbol2string (gh_cdr (lookup)) == "name")
+ mol = lookup_character (me, font_name, text);
else
- metric_l = all_fonts_global_p->find_font (font_str);
+ mol = lookup_text (me, font_name, text);
+
+ return mol;
+}
- SCM list = gh_list (ly_symbol2scm ("text"), text, SCM_UNDEFINED);
- list = fontify_atom (metric_l, list);
+/*
+ caching / use some form of Lookup without 'paper'?
+*/
+Molecule
+Text_item::lookup_character (Score_element *me, SCM font_name, SCM char_name)
+{
+ Adobe_font_metric *afm = all_fonts_global_p->find_afm (ly_scm2string (font_name));
+
+ if (!afm)
+ {
+ warning (_f ("can't find font: `%s'", ly_scm2string (font_name)));
+ warning (_f ("(search path: `%s')", global_path.str ().ch_C()));
+ error (_ ("Aborting"));
+ }
+
+ AFM_CharMetricInfo const *metric =
+ afm->find_char_metric (ly_scm2string (char_name), true);
+
+ if (!metric)
+ {
+ Molecule m;
+ m.set_empty (false);
+ return m;
+ }
- return Molecule (metric_l->text_dimension (ly_scm2string (text)), list);
+ SCM list = gh_list (ly_symbol2scm ("char"),
+ gh_int2scm (metric->code),
+ SCM_UNDEFINED);
+
+ list = fontify_atom (afm, list);
+ return Molecule (afm_bbox_to_box (metric->charBBox), list);
+}
+
+Molecule
+Text_item::lookup_text (Score_element *me, SCM font_name, SCM text)
+{
+ SCM magnification = me->get_elt_property ("font-magnification");
+ Font_metric* metric = 0;
+ if (gh_number_p (magnification))
+ metric = all_fonts_global_p->find_scaled (ly_scm2string (font_name),
+ gh_scm2int (magnification));
+ else
+ metric = all_fonts_global_p->find_font (ly_scm2string (font_name));
+
+ SCM list = gh_list (ly_symbol2scm ("text"), text, SCM_UNDEFINED);
+ list = fontify_atom (metric, list);
+
+ return Molecule (metric->text_dimension (ly_scm2string (text)), list);
}
Molecule
(define style-to-font-alist
'(
- (finger . "* * orator * * -4")
- (volta . "* * orator * * -3")
- (timesig . "* * orator * * 0")
- (mark . "* * orator * * 2")
+ (finger . "* * number * * -4")
+ (volta . "* * number * * -3")
+ (timesig . "* * number * * 0")
+ (mark . "* * number * * 2")
(script . "* * roman * * -1")
(large . "* * roman * * 1")
(Large . "bold * roman * * 2")
(("medium upright braces feta-braces 20" . 0) . "feta-braces20")
(("bold italic dynamic feta 10" . 0) . "feta-din10")
;; Hmm
- (("medium upright orator feta-nummer 13" . 3) . "feta-nummer13")
- (("medium upright orator feta-nummer 13" . 2) . "feta-nummer13")
- (("medium upright orator feta-nummer 12" . 1) . "feta-nummer12")
- (("medium upright orator feta-nummer 10" . 0) . "feta-nummer10")
- (("medium upright orator feta-nummer 8" . -1) . "feta-nummer8")
- (("medium upright orator feta-nummer 6" . -2) . "feta-nummer6")
- (("medium upright orator feta-nummer 5" . -3) . "feta-nummer5")
- (("medium upright orator feta-nummer 4" . -4) . "feta-nummer4")
- (("medium upright orator feta-nummer 3" . -5) . "feta-nummer3")
+ (("medium upright number feta-nummer 13" . 3) . "feta-nummer13")
+ (("medium upright number feta-nummer 13" . 2) . "feta-nummer13")
+ (("medium upright number feta-nummer 12" . 1) . "feta-nummer12")
+ (("medium upright number feta-nummer 10" . 0) . "feta-nummer10")
+ (("medium upright number feta-nummer 8" . -1) . "feta-nummer8")
+ (("medium upright number feta-nummer 6" . -2) . "feta-nummer6")
+ (("medium upright number feta-nummer 5" . -3) . "feta-nummer5")
+ (("medium upright number feta-nummer 4" . -4) . "feta-nummer4")
+ (("medium upright number feta-nummer 3" . -5) . "feta-nummer3")
(("medium upright roman cmr 8" . -1) . "cmr8" )
(("medium upright roman cmr 10" . 0) . "cmr10")
(("medium upright roman cmr 12" . 1) . "cmr12")
(roman . (font-family . "roman"))
(music . (font-family . "music"))
(bold . (font-series . "bold"))
- (italic . (font-shape . "italic")))
+ (italic . (font-shape . "italic"))
+ (named . (lookup . name))
+ (text . (lookup . value)))
(map (lambda (x) (cons (car x) (cons 'font-style (car x))))
style-to-font-alist)))