-> font-encoding fetaMusic.
* lily/main.cc: put default to PS.
* lily/tfm.cc: idem.
* lily/afm.cc: idem.
* lily/include/modified-font-metric.hh (struct
Modified_font_metric): remove coding_scheme() method.
* input/mutopia/F.Schubert/morgenlied.ly: convert to utf8
* scripts/convert-ly.py (conv): crash on encountering \encoding.
* input/les-nereides.ly: convert to utf8
* lily/modified-font-metric.cc (text_dimension): idem.
* lily/parser.yy (TODO): idem.
* lily/include/lily-lexer.hh (class Lily_lexer): idem.
* lily/lexer.ll: remove encoding
* lily/font-metric.cc (design_size): design_size returns a
dimension now as well.
2005-01-01 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * input/regression/new-markup-scheme.ly: oops. font-family=music
+ -> font-encoding fetaMusic.
+
+ * lily/main.cc: put default to PS.
+
+ * lily/tfm.cc: idem.
+
+ * lily/afm.cc: idem.
+
+ * lily/include/modified-font-metric.hh (struct
+ Modified_font_metric): remove coding_scheme() method.
+
+ * input/mutopia/F.Schubert/morgenlied.ly: convert to utf8
+
+ * scripts/convert-ly.py (conv): crash on encountering \encoding.
+
+ * input/les-nereides.ly: convert to utf8
+
+ * lily/modified-font-metric.cc (text_dimension): idem.
+
+ * lily/parser.yy (TODO): idem.
+
+ * lily/include/lily-lexer.hh (class Lily_lexer): idem.
+
+ * lily/lexer.ll: remove encoding
+
* scm/framework-ps.scm (output-variables): separately scale the
page to mm
@node Text encoding
@subsection Text encoding
+[FIXME: OBSOLETE, use UTF8 for input files.]
+
+
Texts can be entered in different encodings. The encoding of the
file can be set with @code{\encoding}.
%\override Score.LyricText #'font-style = #'large
%\override Score.TextScript #'font-style = #'large
\oldaddlyrics
-\encoding "TeX"
\context Voice \relative c'' {
<g e c >1 < a f d > < b g e >
<c a f > < d b g > < e c a > < f d b > }
\version "2.4.0"
-\encoding "latin1"
\header {
composer = "ARTHUR GRAY"
- title = "LES NÉRÉIDES"
+ title = "LES NÉRÉIDES"
subtitle = "THE NEREIDS"
enteredby = "JCN"
piece = "Allegretto scherzando"
\header {
- title = "Sängers Morgenlied"
+ title = "Sängers Morgenlied"
composer = "Franz Schubert (1797-1828)"
date = "27. Februar 1815"
source = "Edition Peters"
firstVerse = \lyricmode {
\set stanza = "1."
- Sü -- ßes Licht! Aus
+ Sü -- ßes Licht! Aus
\ignoreMelisma
gol --
\ignoreMelismaOff
de -- nen Pfor -- ten brichst du __ \manuscriptBreak |
- sie -- gend durch __ die Nacht. Schö -- ner Tag, du __ bist er -- wacht. __ Mit ge -- |
+ sie -- gend durch __ die Nacht. Schö -- ner Tag, du __ bist er -- wacht. __ Mit ge -- |
\manuscriptBreak
- heim -- nis -- vol -- len Wor -- ten, in me -- lo -- di -- schen Ak -- kor -- den, grüß __ ich __ \manuscriptBreak |
- dei -- ne Ro -- sen -- pracht, grüß __ ich __ dei -- ne Ro -- sen -- pracht.
+ heim -- nis -- vol -- len Wor -- ten, in me -- lo -- di -- schen Ak -- kor -- den, grüß __ ich __ \manuscriptBreak |
+ dei -- ne Ro -- sen -- pracht, grüß __ ich __ dei -- ne Ro -- sen -- pracht.
}
secondVerse = \lyricmode {
\set stanza = "2."
Ach, der Lie -- be sanf
-- tes We -- hen schwellt mir |
- das be -- weg -- te __ Herz, sanft, wie ein ge -- lieb -- ter Schmerz. __ Dürft ich |
- nur auf gold -- nen Hö -- hen mich im Mor -- gen -- duft er -- ge -- hen! Sehn -- sucht |
- zieht mich him -- mel -- wärts, Sehn -- sucht zieht mich him -- mel -- wärts.
+ das be -- weg -- te __ Herz, sanft, wie ein ge -- lieb -- ter Schmerz. __ Dürft ich |
+ nur auf gold -- nen Hö -- hen mich im Mor -- gen -- duft er -- ge -- hen! Sehn -- sucht |
+ zieht mich him -- mel -- wärts, Sehn -- sucht zieht mich him -- mel -- wärts.
}
pianoRH = \relative c''' \repeat volta 2 {
the appropriate object. This may include Postscript fonts that are
available through (La)TeX.
+
+BROKEN by pango/fontconfig
"
\score {
{
- \override Staff.TimeSignature #'font-name = #"cmr17"
+
+ %% FIXME.
+% \override Staff.TimeSignature #'font-name = #"cmr17"
\set Score.skipBars = ##t
% use font-name putri8r for Utopia Italic :
\header {
texidoc = "There is a Scheme macro @code{markup} to produce markup
- texts using a similar syntax as @code{\\markup}."
+ texts using a similar syntax as @code{\\markup}.
+
+"
}
\version "2.5.2"
\bracket \column { baz bazr bla }
\hspace #2.0
- \override #'(font-family . music) {
+ \override #'(font-encoding . fetaMusic) {
\lookup #"noteheads-0"
- \char #53
}
\musicglyph #"accidentals.-1"
\combine "X" "+"
#:override '(baseline-skip . 4)
#:bracket #:column ( "baz" "bazr" "bla" )
#:hspace 2.0
- #:override '(font-family . music) #:line (#:lookup "noteheads-0"
- #:char 53)
+ #:override '(font-encoding . fetaMusic) #:line (#:lookup "noteheads-0"
+ )
#:musicglyph "accidentals.-1"
#:combine "X" "+"
#:combine "o" "/"
\bracket \column { baz bazr bla }
\hspace #2.0
- \override #'(font-family . music) {
+ \override #'(font-encoding . fetaMusic) {
\lookup #"noteheads-0"
- \char #53
}
\semiflat
% \break % 7 (8*1)
ges! fes!
- \clef "hufnagel.do.fa"
+ \clef "hufnagel-do-fa"
\override NoteHead #'style = #'hufnagel.punctum
es! des! ces! des! es! fes!
\bar "||"
}
}
-\encoding "latin1"
spaceTest = \markup { "two space chars" }
\header {
% ugh: encoding char-size
%dedication = "For my öòóôõø so dear Lily"
dedication = \markup { "For my "
- "öòóôõø"
+% "öòóôõø"
" so dear Lily" }
title = "Title"
subtitle = "(and (the) subtitle)"
return design_size_;
}
-String
-Adobe_font_metric::coding_scheme () const
-{
- return font_info_->gfi->encodingScheme;
-}
+
String
Adobe_font_metric::font_name () const
return 1.0 * point_constant;
}
-String
-Font_metric::coding_scheme () const
-{
- return "FontSpecific";
-}
Stencil
Font_metric::find_by_name (String s) const
return Stencil (b, at);
}
-int
-/*Font_metric::*/
-get_encoded_index (Font_metric *m, String input_coding, int code)
-{
- String font_coding = m->coding_scheme ();
- if (font_coding == input_coding)
- return code;
- SCM s = scm_call_3 (ly_lily_module_constant ("encoded-index"),
- scm_makfrom0str (input_coding.to_str0 ()),
- scm_makfrom0str (font_coding.to_str0 ()),
- scm_int2num (code));
- return scm_to_int (s);
-}
Offset
Font_metric::attachment_point (String) const
Font_metric *
get_font_by_design_size (Output_def *layout, Real requested,
- SCM font_vector,
- SCM font_encoding, SCM input_encoding)
+ SCM font_vector)
{
int n = SCM_VECTOR_LENGTH (font_vector);
Real size = 1e6;
Font_metric *fm = unsmob_metrics (scm_force (SCM_VECTOR_REF (font_vector,
i)));
- return find_scaled_font (layout, fm, requested / size,
- font_encoding, input_encoding);
+ return find_scaled_font (layout, fm, requested / size);
}
Font_metric *
get_font_by_mag_step (Output_def *layout, Real requested_step,
- SCM font_vector, Real default_size,
- SCM font_encoding, SCM input_encoding)
+ SCM font_vector, Real default_size)
{
return get_font_by_design_size (layout, default_size
* pow (2.0, requested_step / 6.0),
- font_vector, font_encoding, input_encoding);
+ font_vector);
}
SCM
}
Font_metric *
-select_encoded_font (Output_def *layout, SCM chain, SCM input_encoding)
+select_encoded_font (Output_def *layout, SCM chain)
{
SCM name = ly_chain_assoc (ly_symbol2scm ("font-name"), chain);
: 1);
Font_metric *fm = all_fonts_global->find_font (ly_scm2string (name));
- SCM font_encoding
- = scm_cdr (ly_chain_assoc (ly_symbol2scm ("font-encoding"), chain));
- return find_scaled_font (layout, fm, rmag, font_encoding, input_encoding);
+ return find_scaled_font (layout, fm, rmag);
}
else if (scm_instance_p (name))
{
if (scm_is_pair (font_size))
req = scm_to_double (scm_cdr (font_size));
- SCM font_encoding
- = scm_cdr (ly_chain_assoc (ly_symbol2scm ("font-encoding"), chain));
-
return get_font_by_mag_step (layout, req, vec,
- scm_to_double (base_size) * point_constant,
- font_encoding, input_encoding);
+ scm_to_double (base_size) * point_constant);
}
assert (0);
Font_metric *
select_font (Output_def *layout, SCM chain)
{
- return select_encoded_font (layout, chain, SCM_EOL);
+ return select_encoded_font (layout, chain);
}
virtual Box get_ascii_char (int) const;
virtual Box get_indexed_char (int) const;
virtual Offset get_indexed_wxwy (int) const;
- virtual String coding_scheme () const;
static SCM make_afm (AFM_Font_info*, unsigned, Real);
virtual Real design_size () const;
virtual String font_name () const;
virtual Stencil find_by_name (String) const;
virtual Stencil get_indexed_char_stencil (int k) const;
virtual Stencil get_ascii_char_stencil (int k) const;
- virtual String coding_scheme () const;
virtual SCM sub_fonts () const;
virtual SCM font_file_name () const;
DECLARE_SMOBS (Font_metric,);
DECLARE_SMOBS(Lily_lexer,);
public:
SCM scopes_;
- SCM encoding_;
private:
int lookup_keyword (String);
void push_note_state (SCM tab);
void pop_state ();
void LexerError (char const *);
- void set_encoding (String);
- SCM encoding () const;
void set_identifier (SCM name_string, SCM);
bool is_note_state () const;
bool is_chord_state () const;
Interval line_dimensions_int (Output_def*def, int);
-Font_metric *select_encoded_font (Output_def *layout, SCM input_encoding, SCM chain);
+Font_metric *select_encoded_font (Output_def *layout, SCM chain);
Font_metric *select_font (Output_def *layout, SCM chain);
DECLARE_UNSMOB (Output_def, output_def);
Font_metric *find_scaled_font (Output_def *od,
- Font_metric *f, Real magnification,
- SCM font_encoding, SCM input_encoding);
+ Font_metric *f, Real magnification);
Output_def *scale_output_def (Output_def *def, Real scale);
Real output_scale (Output_def*);
public:
DECLARE_SCHEME_CALLBACK (print, (SCM));
DECLARE_SCHEME_CALLBACK (interpret_markup, (SCM, SCM, SCM));
- DECLARE_SCHEME_CALLBACK (interpret_string, (SCM, SCM, SCM, SCM));
+ DECLARE_SCHEME_CALLBACK (interpret_string, (SCM, SCM, SCM));
static bool has_interface (Grob*);
static bool markup_p (SCM) ;
};
virtual int count () const;
virtual Box get_ascii_char (int) const;
virtual Real design_size () const;
- virtual String coding_scheme () const;
virtual void derived_mark () const;
virtual int name_to_index (String) const;
%option warn
%x chords
-%x encoding
%x figures
%x incl
%x lyrics
}
}
-<INITIAL,lyrics,figures,notes>\\encoding{WHITE}* {
- yy_push_state (encoding);
-}
<INITIAL,chords,lyrics,notes,figures>\\version{WHITE}* {
yy_push_state (version);
}
<INITIAL,chords,lyrics,notes,figures>\\renameinput{WHITE}* {
yy_push_state (renameinput);
}
-<encoding>\"[^"]*\" {
- String s (YYText () + 1);
- s = s.left_string (s.index_last ('\"'));
- set_encoding (s);
- yy_pop_state ();
-}
<version>\"[^"]*\" { /* got the version number */
String s (YYText () + 1);
s = s.left_string (s.index_last ('\"'));
scm_makfrom0str (s.to_str0 ()));
}
-<encoding>. {
- LexerError (_ ("No quoted string found after \\encoding").to_str0 ());
- yy_pop_state ();
-}
<version>. {
LexerError (_ ("No quoted string found after \\version").to_str0 ());
yy_pop_state ();
Lily_lexer::Lily_lexer (Sources *sources)
{
keytable_ = new Keyword_table (the_key_tab);
- encoding_ = SCM_EOL;
chordmodifier_tab_ = SCM_EOL;
pitchname_tab_stack_ = SCM_EOL;
sources_ = sources;
: Includable_lexer ()
{
keytable_ = (src.keytable_) ? new Keyword_table (*src.keytable_) : 0;
- encoding_ = src.encoding_;
chordmodifier_tab_ = src.chordmodifier_tab_;
pitchname_tab_stack_ = src.pitchname_tab_stack_;
sources_ = src.sources_;
delete keytable_;
}
-SCM
-Lily_lexer::encoding () const
-{
- return encoding_ ;
-}
void
last_input_ = here_input ();
}
-void
-Lily_lexer::set_encoding (String s)
-{
- if (s.length ())
- encoding_ = ly_symbol2scm (s.to_str0 ());
- else
- encoding_ = SCM_EOL;
-}
-
#include "ly-smobs.icc"
IMPLEMENT_SMOBS (Lily_lexer);
scm_gc_mark (lexer->chordmodifier_tab_);
scm_gc_mark (lexer->pitchname_tab_stack_);
- scm_gc_mark (lexer->scopes_);
- return lexer->encoding_;
+ return lexer->scopes_;
}
int
/* Selected output format.
One of tex, ps, scm, as.
*/
-String output_format_global = "tex";
+String output_format_global = "ps";
/* Current output name. */
String output_name_global;
#include "warn.hh"
#include "stencil.hh"
#include "lookup.hh"
+#include "main.hh"
Modified_font_metric::Modified_font_metric (Font_metric *fm,
- Real magnification,
- String font_encoding,
- String input_encoding)
+ Real magnification)
{
- input_encoding_ = input_encoding;
- coding_vector_ = SCM_EOL;
- coding_mapping_ = SCM_EOL;
- coding_table_ = SCM_EOL;
- coding_description_ = SCM_EOL;
magnification_ = magnification;
SCM desc = fm->description_;
description_ = scm_cons (scm_car (desc), scm_make_real (total_mag));
orig_ = fm;
-
- String metric_coding = orig_->coding_scheme ();
- if (metric_coding != "FontSpecific"
- && metric_coding != font_encoding)
- warning (_f ("conflicting metric coding (%s) and font_encoding (%s)",
- metric_coding, font_encoding));
-
- if (input_encoding_ != ""
- && input_encoding_ != "TeX"
- && input_encoding_ != "ASCII"
- && input_encoding_ != font_encoding)
- {
- coding_vector_ = scm_call_1 (ly_lily_module_constant ("get-coding-vector"),
- scm_makfrom0str (font_encoding.to_str0 ()));
-
- if (!ly_c_vector_p (coding_vector_))
- {
- programming_error ("get-coding-vector should return vector");
- coding_vector_ = scm_c_make_vector (256, ly_symbol2scm (".notdef"));
- }
-
- coding_table_ = scm_call_1 (ly_lily_module_constant ("get-coding-table"),
- scm_makfrom0str (font_encoding.to_str0 ()));
-
- coding_mapping_
- = scm_call_2 (ly_lily_module_constant ("make-encoding-mapping"),
- coding_vector_,
- coding_table_);
-
- coding_description_ = SCM_EOL;
- coding_description_
- = scm_acons (ly_symbol2scm ("input-name"),
- scm_makfrom0str (input_encoding_.to_str0 ()),
- coding_description_);
- coding_description_
- = scm_acons (ly_symbol2scm ("input-vector"),
- coding_vector_, coding_description_);
- coding_description_
- = scm_acons (ly_symbol2scm ("output-name"),
- scm_makfrom0str (orig_->coding_scheme ().to_str0 ()),
- coding_description_);
- coding_description_
- = scm_acons (ly_symbol2scm ("output-table"),
- coding_table_,
- coding_description_);
- coding_description_
- = scm_acons (ly_symbol2scm ("char-mapping"),
- coding_mapping_,
- coding_description_);
- }
}
SCM
-Modified_font_metric::make_scaled_font_metric (Font_metric *fm, Real scaling,
- SCM font_encoding,
- SCM input_encoding)
+Modified_font_metric::make_scaled_font_metric (Font_metric *fm, Real scaling)
{
- /*
- UGH.
- */
- if (scm_is_symbol (input_encoding))
- input_encoding = scm_symbol_to_string (input_encoding);
-
- String font_encoding_str = ly_symbol2string (font_encoding);
- String input_encoding_str
- = scm_is_string (input_encoding) ? ly_scm2string (input_encoding) : "";
-
- Modified_font_metric *sfm = new Modified_font_metric (fm, scaling,
- font_encoding_str,
- input_encoding_str);
+ Modified_font_metric *sfm = new Modified_font_metric (fm, scaling);
return sfm->self_scm ();
}
return orig_->index_to_ascii (k);
}
-String
-Modified_font_metric::coding_scheme () const
-{
- return input_encoding_;
-}
-
void
Modified_font_metric::derived_mark () const
{
- scm_gc_mark (coding_vector_);
- scm_gc_mark (coding_description_);
- scm_gc_mark (coding_table_);
- scm_gc_mark (coding_mapping_);
}
/* TODO: put this klutchness behind ly:option switch. */
b.scale (magnification_);
return b;
}
-
- if (input_encoding_ == "TeX")
- b = tex_kludge (text);
- else if (input_encoding_ == "ASCII"
- || input_encoding_ == ""
- || input_encoding_ == orig_->coding_scheme ())
- {
- Interval ydims;
- Real w = 0.0;
-
- for (int i = 0; i < text.length (); i++)
- {
- Box b = get_ascii_char ((unsigned char)text[i]);
-
- w += b[X_AXIS].length ();
- ydims.unite (b[Y_AXIS]);
- }
- if (ydims.is_empty ())
- ydims = Interval (0, 0);
-
- b = Box(Interval(0,w), ydims);
- }
- else
+ if (output_format_global == "tex")
{
- Interval ydims;
- Real w = 0.0;
-
- for (int i = 0; i < text.length (); i++)
- {
- SCM sym = scm_vector_ref (coding_vector_,
- scm_from_int((unsigned char) text[i]));
-
- Box char_box;
-
- if (!scm_is_symbol (sym))
- continue;
-
- char const *chars = scm_i_string_chars (scm_symbol_to_string (sym));
-
- int idx = orig_->name_to_index (chars);
- if (idx >= 0)
- char_box = orig_->get_indexed_char (idx);
-
- if (!char_box[X_AXIS].is_empty ())
- /* length ? */
- w += char_box[X_AXIS][RIGHT];
+ b = tex_kludge (text);
+ return b;
+ }
- ydims.unite (char_box[Y_AXIS]);
- }
+ Interval ydims;
- if (ydims.is_empty ())
- ydims = Interval (0, 0);
+ Real w = 0.0;
- b = Box (Interval (0, w), ydims);
- b.scale (magnification_);
+ for (int i = 0; i < text.length (); i++)
+ {
+ Box b = get_ascii_char ((unsigned char)text[i]);
+
+ w += b[X_AXIS].length ();
+ ydims.unite (b[Y_AXIS]);
}
-
+ if (ydims.is_empty ())
+ ydims = Interval (0, 0);
+
+ b = Box(Interval(0,w), ydims);
return b;
}
return orig_;
}
-
-LY_DEFINE (ly_font_encoding_alist, "ly:font-encoding-alist",
- 1, 0, 0,
- (SCM font),
- "Given the Modified_font_metric @var{font}, return an "
- "alist. Keys are input-name, input-vector, "
- "output-name, output-table, mapping.")
-{
- Modified_font_metric *fm
- = dynamic_cast<Modified_font_metric*> (unsmob_metrics (font));
-
- SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "Modified_font_metric");
- return fm->coding_description_;
-}
-
-LY_DEFINE (ly_font_encoding, "ly:font-encoding",
- 1, 0, 0,
- (SCM font),
- "Return encoding of @var{font}.")
-{
- Modified_font_metric *fm
- = dynamic_cast<Modified_font_metric*> (unsmob_metrics (font));
- SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "Modified_font_metric");
- return ly_symbol2scm (fm->original_font ()->coding_scheme ().to_str0 ());
-}
-
SCM
Modified_font_metric::sub_fonts () const
{
Font_metric * fm = all_fonts_global->find_pango_font (description);
- return find_scaled_font (layout, fm, 1.0,
- ly_symbol2scm ("latin1"),
- ly_symbol2scm ("latin1"));
+ return find_scaled_font (layout, fm, 1.0);
}
/* TODO: should add nesting for Output_def here too. */
Font_metric *
-find_scaled_font (Output_def *mod, Font_metric *f, Real m,
- SCM font_encoding, SCM input_encoding)
+find_scaled_font (Output_def *mod, Font_metric *f, Real m)
{
if (mod->parent_)
- return find_scaled_font (mod->parent_, f, m, font_encoding, input_encoding);
+ return find_scaled_font (mod->parent_, f, m);
Real lookup_mag = m / output_scale (mod);
else
sizes = SCM_EOL;
- SCM val = Modified_font_metric::make_scaled_font_metric (f, lookup_mag,
- font_encoding,
- input_encoding);
-
+ SCM val = Modified_font_metric::make_scaled_font_metric (f, lookup_mag);
+
sizes = scm_acons (scm_make_real (lookup_mag), val, sizes);
scm_gc_unprotect_object (val);
scm_hashq_set_x (font_table, f->self_scm (), sizes);
LY_DEFINE (ly_paper_fonts, "ly:paper-fonts",
1, 0, 0,
(SCM bp),
- "Return fonts scaled up BP")
+ "Return fonts from the @code{\\paper} block @var{bp}.")
{
Output_def *b = unsmob_output_def (bp);
}
SCM
-make_simple_markup (SCM encoding, SCM a)
+make_simple_markup (SCM a)
{
SCM simple = ly_lily_module_constant ("simple-markup");
- if (scm_is_symbol (encoding))
- return scm_list_3 (ly_lily_module_constant ("encoded-simple-markup"),
- encoding, a);
return scm_list_2 (simple, a);
}
| string {
Music *t = MY_MAKE_MUSIC ("TextScriptEvent");
t->set_property ("text",
- make_simple_markup (THIS->lexer_->encoding (), $1));
+ make_simple_markup ($1));
t->set_spot (THIS->here_input ());
$$ = t;
$$ = $1;
}
| LYRICS_STRING {
- $$ = make_simple_markup (THIS->lexer_->encoding (), $1);
+ $$ = make_simple_markup ($1);
}
;
simple_markup:
STRING {
- $$ = make_simple_markup (THIS->lexer_->encoding (), $1);
+ $$ = make_simple_markup ($1);
}
| MARKUP_IDENTIFIER {
$$ = $1;
#include "ly-module.hh"
-MAKE_SCHEME_CALLBACK (Text_interface, interpret_string, 4)
+MAKE_SCHEME_CALLBACK (Text_interface, interpret_string, 3)
SCM
Text_interface::interpret_string (SCM layout_smob,
- SCM props, SCM input_encoding, SCM markup)
+ SCM props,
+ SCM markup)
{
Output_def *layout = unsmob_output_def (layout_smob);
}
#endif
- SCM_ASSERT_TYPE (input_encoding == SCM_EOL || scm_is_symbol (input_encoding),
- input_encoding, SCM_ARG2, __FUNCTION__, "symbol");
-
- if (!scm_is_symbol (input_encoding))
- {
- SCM enc = layout->lookup_variable (ly_symbol2scm ("inputencoding"));
- if (scm_is_string (enc))
- input_encoding = scm_string_to_symbol (enc);
- else if (scm_is_symbol (enc))
- input_encoding = enc;
- }
-
- Font_metric *fm = select_encoded_font (layout, props, input_encoding);
-
+ Font_metric *fm = select_encoded_font (layout, props);
return fm->text_stencil (str).smobbed_copy();
}
Text_interface::interpret_markup (SCM layout_smob, SCM props, SCM markup)
{
if (scm_is_string (markup))
- return interpret_string (layout_smob, props, SCM_EOL, markup);
+ return interpret_string (layout_smob, props, markup);
else if (scm_is_pair (markup))
{
SCM func = scm_car (markup);
*/
#include "tfm.hh"
-
#include "tfm-reader.hh"
#include "string-convert.hh"
#include "warn.hh"
static Tex_font_char_metric dummy_static_char_metric;
-
-
Tex_font_char_metric::Tex_font_char_metric ()
{
exists_ = false;
}
Real d = -depth_;
-
Real point_constant = 1 PT;
return Box (Interval (0, width_* point_constant ),
tfm->header_ = reader.header_;
tfm->char_metrics_ = reader.char_metrics_;
tfm->ascii_to_metric_idx_ = reader.ascii_to_metric_idx_;
- tfm->encoding_table_
- = scm_call_1 (ly_lily_module_constant ("get-coding-table"),
- scm_makfrom0str (tfm->coding_scheme ().to_str0 ()));
return tfm->self_scm ();
}
return info_.design_size * point_constant;
}
-String
-Tex_font_metric::coding_scheme () const
-{
- String scm = info_.coding_scheme;
-
- for(int i = 0; i < scm.length (); i++)
- if (scm[i] == ' ')
- scm[i] = '-';
-
- return scm;
-}
-
int
Tex_font_metric::name_to_index (String s) const
{
- SCM sym = ly_symbol2scm (s.to_str0 ());
-
- SCM idx = scm_hash_ref (encoding_table_, sym, SCM_BOOL_F);
- if (ly_c_char_p (idx))
- {
- return (unsigned char) ly_scm2char (idx);
- }
- else
- return -1;
+ assert (false);
}
$(outdir)/%.otf $(outdir)/%.svg: $(outdir)/%.pe
(cd $(outdir) && fontforge -script $(notdir $<))
-$(outdir)/%.otf-table: $(outdir)/%.lisp
+$(outdir)/%.otf-table: $(outdir)/%.lisp $(if $(findstring brace,$<),,$(subst feta,parmesan,$<))
cat $< \
$(if $(findstring brace,$<),,$(subst feta,parmesan,$<)) \
$(if $(findstring brace,$<),,$(subst feta,feta-alphabet,$<)) > $@
left_stem, right_stem, linea, cavum,
straight, auctum, direction_up, excentric, up_shift, down_shift, mag) =
- fet_beginchar(verbose_name, internal_name)
+ fet_beginchar(verbose_name, "s" & internal_name)
save b_h, a_w;
a_b := 1.54; % b_h*a_b/a_w = wd/ht
b_h := 0.85;
def inclinatum_char(expr verbose_name, internal_name,
small, stropha, auctum) =
- fet_beginchar(verbose_name, internal_name)
+ fet_beginchar(verbose_name, "s"&internal_name)
save ht, alpha;
alpha# = 35;
if small:
false, false, true, false, false, 1.0);
% quilisma
-fet_beginchar("Ed. Vat. quilisma", "vaticana.quilisma")
+fet_beginchar("Ed. Vat. quilisma", "svaticana.quilisma")
save b_h,a_w;
a_b:=1.54; % b_h*a_b/a_w = wd/ht
b_h:=0.85;
false, true, true);
% solesmes oriscus
-fet_beginchar("Solesmes oriscus", "solesmes.oriscus")
+fet_beginchar("Solesmes oriscus", "ssolesmes.oriscus")
save b_h, a_w;
a_b := 1.54; % b_h*a_b/a_w = wd/ht
b_h := 0.85;
%
% inclinatum
-fet_beginchar("Ed. Med. inclinatum", "medicaea.inclinatum")
+fet_beginchar("Ed. Med. inclinatum", "smedicaea.inclinatum")
draw_diamond_head (1.2staff_space#, 0, 0, 35, false);
fet_endchar;
def punctum_char (expr verbose_name, internal_name,
left_up_stem, left_down_stem) =
- fet_beginchar(verbose_name, internal_name)
+ fet_beginchar(verbose_name, "s"&internal_name)
save a, beta, ht, wd;
ht# = 2 staff_space#;
% parametrized punctum
def punctum_char (expr verbose_name, internal_name,
down_stem) =
- fet_beginchar(verbose_name, internal_name)
+ fet_beginchar(verbose_name, "s" & internal_name)
save alpha;
alpha# = 55;
draw_diamond_head (staff_space#, 0, 0, alpha#, false);
punctum_char("Hufnagel virga", "hufnagel.virga", true)
% pes lower punctum
-fet_beginchar("Hufnagel pes lower punctum", "hufnagel.lpes")
+fet_beginchar("Hufnagel pes lower punctum", "shufnagel.lpes")
save width, height, alpha;
width# = 2*staff_space#;
height# = 0.7*staff_space#;
sub-fonts)))))
(define (simple-font-load-command paper font)
- (let* ((coding-alist (ly:font-encoding-alist font))
- (font-encoding (assoc-get 'output-name coding-alist)))
- (string-append
- "\\font\\lilypond" (tex-font-command font) "="
- (if (or (equal? (ly:font-encoding font) "cork-lm")
- ;; FIXME: encoding: FontSpecific for cork-lm
- (string-prefix? "lm" (ly:font-file-name font)))
- "cork-" "")
- (ly:font-file-name font)
- " scaled "
- (ly:number->string (inexact->exact
- (round (* 1000
- (ly:font-magnification font)
- (ly:paper-outputscale paper)))))
- "\n"
- "\\def\\" (tex-font-command font) "{%\n"
- ;; UGH. Should be handled via alist.
- (if (or (equal? "Extended-TeX-Font-Encoding---Latin" font-encoding)
- (not font-encoding))
- " \\lilypondfontencoding{T1}"
- " ")
- "\\lilypond" (tex-font-command font)
- "}%\n")))
+ (format
+ "\\font\\~a=~a scaled ~a%\n"
+ (tex-font-command font)
+ (ly:font-file-name font)
+ (inexact->exact
+ (round (* 1000
+ (ly:font-magnification font)
+ (ly:paper-outputscale paper))))))
(define (font-load-command paper font)
(if (pair? (ly:font-sub-fonts font))
(embedded-ps (list 'round-filled-box x y width height blotdiam)))
(define (text font s)
- ;; (assoc-get 'char-mapping (ly:font-encoding-alist font))))
- (let* ((mapping #f)
-
- ;; TODO: we'd better do this for PS only
- ;; LaTeX gets in the way, and we need to remap
- ;; nonprintable chars.
-
- ;; (assoc-get 'input-name (ly:font-encoding-alist font)))
-
- (input-enc-name #f))
-
- (string-append "\\hbox{\\" (tex-font-command font)
- (if (string? input-enc-name)
- (string-append "\\inputencoding{" input-enc-name "}")
- "{}")
- (sanitize-tex-string
- (if (vector? mapping)
- (reencode-string mapping s)
- s))
- "}")))
+ (format
+ "\\hbox{\\~a{}~a}" (tex-font-command font)
+ (sanitize-tex-string s)))
(define (white-text scale s)
(embedded-ps (list 'white-text scale s)))
(string-append "\\special{src:"
(apply point-and-click location) "}")
""))
- ""))
\ No newline at end of file
+ ""))
ly:export
ly:font-get-glyph
ly:font-design-size
- ly:font-encoding-alist
ly:font-file-name
ly:font-magnification
ly:font-metric?
str = re.sub ("'(vaticana|hufnagel|medicaea|petrucci|neomensural|mensural)-", r"'\1.", str)
return str
+conversions.append (((2, 5, 3),
+ conv,
+ 'ly:find-glyph-by-name -> ly:font-get-glyph, remove - from glyphnames.'))
+
+
+
+def conv (str):
+ if re.search (r"\\encoding", str):
+ sys.stderr.write ("Sorry, input files should be UTF8.\n"
+ + "Please convert by hand.")
+ raise FatalConversionError()
+
+ return str
+
conversions.append (((2, 5, 2),
conv,
'ly:find-glyph-by-name -> ly:font-get-glyph, remove - from glyphnames.'))