+2004-04-07 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * scm/output-tex.scm (text): remove debugging code.
+
+ * lily/scaled-font-metric.cc (ly_font_encoding): return vector
+
+ * buildscripts/mf-to-table.py (parse_logfile): read EncodingScheme
+ from infile.
+
+ * mf/feta-generic.mf: move fet_beginfont into generic code.
+ use fetaMusic (without space) as encoding
+
+ * mf/feta-autometric.mf: take encoding argument
+
+ * lily/afm.cc (read_afm_file): bugfix, read global info too.
+
+ * lily/my-lily-lexer.cc (set_identifier): remove gh_scm2newstr
+ use.
+
+ * scm/encoding.scm (read-encoding-file): use symbol for glyph
+ name.
+
2004-04-07 Jan Nieuwenhuizen <janneke@gnu.org>
* input/test/title-markup.ly: Set inputencoding.
tags.append ('Regular')
name = tags[1:]
global_info['DesignSize'] = string.atof (tags[4])
-
global_info['FontName'] = string.join (name,'-')
global_info['FullName'] = string.join (name,' ')
global_info['FamilyName'] = string.join (name[1:-1],
global_info['FontBBox'] = '0 0 1000 1000'
global_info['Ascender'] = '0'
global_info['Descender'] = '0'
- global_info['EncodingScheme'] = 'FontSpecific'
+ global_info['EncodingScheme'] = tags[5]
return (global_info, charmetrics, deps)
rewind (f);
AFM_Font_info *fi;
- int ok = AFM_parseFile (f, &fi, ~1);
+ int ok = AFM_parseFile (f, &fi, ~0);
if (ok)
{
virtual int name_to_index (String) const;
virtual String coding_scheme () const;
- /*should be protected?
- */
+
+protected:
+
SCM coding_vector_;
SCM coding_table_;
SCM coding_permutation_;
-
-protected:
+ SCM coding_description_;
+ friend SCM ly_font_encoding(SCM);
+
virtual Real design_size () const;
virtual void derived_mark ();
virtual Box get_indexed_char (int) const;
if (lookup_keyword (ly_scm2string (name)) >= 0)
{
- size_t sz;
- char * str = gh_scm2newstr (name, &sz) ;
- warning (_f ("Identifier name is a keyword: `%s'", str));
- free (str);
+ warning (_f ("Identifier name is a keyword: `%s'", SCM_STRING_CHARS (name)));
}
SCM sym = scm_string_to_symbol (name);
coding_vector_ = SCM_EOL;
coding_permutation_ = SCM_EOL;
coding_table_ = SCM_EOL;
-
+ coding_permutation_ = SCM_EOL;
coding_scheme_ = coding;
magnification_ = magn;
SCM desc = m->description_;
description_ = gh_cons (ly_car (desc), gh_double2scm (total_mag));
orig_ = m;
+
+ if (coding_scheme_ != "TeX"
+ && coding_scheme_ != "ASCII"
+ && coding_scheme_ != orig_->coding_scheme ())
+ {
+ coding_vector_ = scm_call_1 (ly_scheme_function ("get-coding-vector"),
+ scm_makfrom0str (coding_scheme_.to_str0 ()));
+
+ if (!gh_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_scheme_function ("get-coding-table"),
+ scm_makfrom0str (orig_->coding_scheme ().to_str0 ()));
+
+ coding_permutation_ = scm_call_2 (ly_scheme_function ("make-encoding-permutation"),
+ coding_vector_,
+ coding_table_);
+
+ coding_description_= scm_list_5 (scm_makfrom0str (coding_scheme_.to_str0 ()),
+ coding_vector_,
+ scm_makfrom0str (orig_->coding_scheme ().to_str0 ()),
+ coding_table_,
+ coding_permutation_);
+
+ /*
+ TODO: use alist
+ */
+ coding_permutation_ = scm_vector (coding_description_);
+ }
+
}
SCM
Modified_font_metric::derived_mark ()
{
scm_gc_mark (coding_vector_);
+ scm_gc_mark (coding_description_);
scm_gc_mark (coding_table_);
scm_gc_mark (coding_permutation_);
}
}
else
{
- if (!gh_vector_p (coding_vector_))
- {
- coding_vector_
- = scm_call_1 (ly_scheme_function ("get-coding-vector"),
- scm_makfrom0str (coding_scheme_.to_str0 ()));
-
- if (!gh_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_scheme_function ("get-coding-table"),
- scm_makfrom0str (orig_->coding_scheme ().to_str0 ()));
-
- coding_permutation_
- = scm_call_2 (ly_scheme_function ("make-encoding-permutation"),
- coding_vector_, coding_table_);
- }
-
Interval ydims;
Real w = 0.0;
Box char_box;
- if (!gh_symbol_p (sym) && !gh_string_p (sym))
+ if (!gh_symbol_p (sym))
continue;
- char const * chars = gh_symbol_p (sym)
- ? SCM_SYMBOL_CHARS(sym) : SCM_STRING_CHARS(sym);
-
+ char const * chars = SCM_SYMBOL_CHARS(sym);
int idx = orig_->name_to_index (chars);
if (idx >= 0)
1, 0, 0,
(SCM font),
"Given the Modified_font_metric @var{font}, return a "
- "list containing (input-coding, output-coding, permutation).")
+ "vector containing (input-coding-name, input-coding, "
+ "output-coding-name, output-coding, permutation).")
{
Modified_font_metric *fm
= dynamic_cast<Modified_font_metric*> (unsmob_metrics (font));
SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "Modified_font_metric");
- return scm_list_3 (fm->coding_vector_,
- fm->coding_table_,
- fm->coding_permutation_);
+ return fm->coding_description_;
}
LY_DEFINE (ly_font_coding_name, "ly:font-coding-name",
int
Tex_font_metric::name_to_index (String s) const
{
- SCM sym = scm_makfrom0str (s.to_str0 ());
+ SCM sym = ly_symbol2scm (s.to_str0 ());
SCM idx = scm_hash_ref (encoding_table_, sym, SCM_BOOL_F);
if (gh_char_p (idx))
message "******************************************************";
% font or database?
-def fet_beginfont(expr name,size) =
+def fet_beginfont(expr name,size,encod) =
font_identifier:=name&decimal size;
font_size size;
- message "@{font@:GNU@:LilyPond@:"&name&"@:"&decimal size&"@}";
+ font_coding_scheme encod;
+ message "@{font@:GNU@:LilyPond@:"&name&"@:"&decimal size&"@:"&encod&"@}";
message "";
enddef;
-def fet_endfont(expr name) =
- message "@{tnof@:"&name&"@}";
- message "";
+def fet_endfont =
+ message "@{tnof@}";
enddef;
% group or table?
input feta-params;
-font_coding_scheme "feta braces";
-
def abc_encode_int (expr i) =
if i > 0:
% we must let the design increase for each
% font to make sure that mftrace doesn't jack up the resolution too highly
% for the longer braces.
-fet_beginfont("feta-braces-" &char(97 + font_count), (font_count + 1)* 15);
+fet_beginfont("feta-braces-" &char(97 + font_count), (font_count + 1)* 15,
+ "fetaBraces");
mode_setup;
define_pixels (staffspace, linethickness, stafflinethickness, ex, descender, ascender);
-fet_beginfont("feta-din", design_size);
+fet_beginfont("feta-din", design_size, "TeX text");
input feta-din-code;
mode := smoke;
fi
+staffsize# := design_size * pt#;
+
mode_setup;
-%
input feta-macros;
input feta-params;
font_x_height staff_space#;
-font_coding_scheme "feta music";
+fet_beginfont("feta", design_size, "fetaMusic");
if test = 0:
input feta-eindelijk;
input feta-toevallig;
input feta-test-generic.mf;
fi
+
+fet_endfont;
+
%blot_diameter# = .4pt#;
-fet_beginfont("feta-nummer", design_size);
+fet_beginfont("feta-nummer", design_size, "fetaNumber");
mode_setup;
height#:=designsize;
font_x_height height#;
font_normal_space space#;
-font_coding_scheme "feta number";
%
% part of LilyPond's pretty-but-neat music font
input feta-autometric;
-fet_beginfont("feta-test", 11);
-staffsize#:=11pt#;
+design_size := 11;
test:=1;
% smoked cheese
input feta-generic;
-fet_endfont("feta");
-
end.
% part of LilyPond's pretty-but-neat music font
input feta-autometric;
-fet_beginfont("feta-test", 13);
-staffsize#:=13pt#;
+design_size := 13;
test:=1;
% smoked cheese
input feta-generic;
-fet_endfont("feta");
end.
% part of LilyPond's pretty-but-neat music font
input feta-autometric;
-fet_beginfont("feta-test", 16);
-staffsize#:=16pt#;
+design_size := 16;
test:=1;
% smoked cheese
input feta-generic;
-fet_endfont("feta");
end.
input feta-autometric;
-fet_beginfont("feta-test", 20);
-staffsize#:=20pt#;
+design_size := 20;
test:=1;
% smoked cheese
input feta-generic;
-fet_endfont("feta");
end.
input feta-autometric;
-fet_beginfont("feta-test", 23);
-staffsize#:=23pt#;
+design_size := 23;
test:=1;
% smoked cheese
input feta-generic;
-fet_endfont("feta");
end.
% part of LilyPond's pretty-but-neat music font
input feta-autometric;
-fet_beginfont("feta-test", 26);
-staffsize#:=26pt#;
+design_size := 26;
test:=1;
% smoked cheese
input feta-generic;
-fet_endfont("feta");
end.
input feta-autometric;
-fet_beginfont("feta", 11);
-staffsize#:=11.22pt#;
+
+design_size:= 11.22;
test:=0;
input feta-generic;
-fet_endfont("feta");
-
end.
% part of LilyPond's pretty-but-neat music font
input feta-autometric;
-fet_beginfont("feta", 13);
-staffsize#:=12.60pt#;
+
+design_size := 12.60;
+
test:=0;
input feta-generic;
-fet_endfont("feta");
-
end.
% part of LilyPond's pretty-but-neat music font
input feta-autometric;
-fet_beginfont("feta", 14);
-staffsize#:=14.14pt#;
+design_size := 14.14;
test:=0;
input feta-generic;
-fet_endfont("feta");
end.
% part of LilyPond's pretty-but-neat music font
input feta-autometric;
-fet_beginfont("feta", 16);
-staffsize#:=15.87pt#;
+design_size := 15.87;
test:=0;
input feta-generic;
-fet_endfont("feta");
-
end.
input feta-autometric;
% todo change file name
-fet_beginfont("feta", 18);
-staffsize#:=17.82pt#;
+design_size := 17.82;
test:=0;
input feta-generic;
-fet_endfont("feta");
end.
% feta20.mf
% part of LilyPond's pretty-but-neat music font
-staffsize#:=20pt#;
+design_size := 20;
input feta-autometric;
-fet_beginfont("feta", 20);
% use feta-test for debugging.
test := 0;
input feta-generic;
-fet_endfont("feta");
end.
input feta-autometric;
% todo change file name
-fet_beginfont("feta", 22.5);
-staffsize#:=22.45pt#;
+design_size := 22.45;
test:=0;
input feta-generic;
-fet_endfont("feta");
end.
% part of LilyPond's pretty-but-neat music font
input feta-autometric;
-fet_beginfont("feta", 26);
-staffsize#:=25.20pt#;
+design_size := 25.20;
test:=0;
input feta-generic;
-fet_endfont("feta");
end.
mode_setup;
%
+staffsize# := design_size * pt#;
input feta-macros;
input feta-params;
+
font_x_height staff_space#;
-font_coding_scheme "parmesan music";
+fet_beginfont("parmesan", design_size, "parmesanMusic")
if test = 0:
input parmesan-rests;
input parmesan-heads;
input parmesan-flags;
input parmesan-timesig;
input parmesan-scripts;
-
else:
fi
+fet_endfont;
+
% parmesan11.mf
% part of LilyPond's pretty-but-neat music font
-staffsize#:=11.22pt#;
+design_size := 11.22;
input feta-autometric;
-fet_beginfont("parmesan", 11);
test := 0;
input parmesan-generic;
-fet_endfont("parmesan");
-
end.
% parmesan13.mf
% part of LilyPond's pretty-but-neat music font
-staffsize#:=12.60pt#;
+design_size := 12.60;
input feta-autometric;
-fet_beginfont("parmesan", 13);
test := 0;
input parmesan-generic;
-fet_endfont("parmesan");
end.
% parmesan13.mf
% part of LilyPond's pretty-but-neat music font
-staffsize#:=14.14pt#;
+design_size := 14.14;
input feta-autometric;
-fet_beginfont("parmesan", 14);
test := 0;
input parmesan-generic;
-fet_endfont("parmesan");
end.
% parmesan16.mf
% part of LilyPond's pretty-but-neat music font
-staffsize#:=15.87pt#;
+design_size := 15.87;
input feta-autometric;
-fet_beginfont("parmesan", 16);
test := 0;
input parmesan-generic;
-fet_endfont("parmesan");
end.
% parmesan13.mf
% part of LilyPond's pretty-but-neat music font
-staffsize#:=17.82pt#;
+design_size := 17.82;
input feta-autometric;
-fet_beginfont("parmesan", 18);
test := 0;
input parmesan-generic;
-fet_endfont("parmesan");
end.
% parmesan20.mf
% part of LilyPond's pretty-but-neat music font
-staffsize#:=20pt#;
+design_size := 20;
input feta-autometric;
-fet_beginfont("parmesan", 20);
test := 0;
input parmesan-generic;
-fet_endfont("parmesan");
end.
% parmesan23.mf
% part of LilyPond's pretty-but-neat music font
-staffsize#:=22.45pt#;
+design_size := 22.45;
input feta-autometric;
-fet_beginfont("parmesan", 23);
test := 0;
input parmesan-generic;
-fet_endfont("parmesan");
end.
% parmesan26.mf
% part of LilyPond's pretty-but-neat music font
-staffsize#:=25.20pt#;
+design_size := 25.20;
input feta-autometric;
-fet_beginfont("parmesan", 26);
test := 0;
input parmesan-generic;
-fet_endfont("parmesan");
end.
("latin1" . "cork.enc")
;; LilyPond.
- ("feta braces" . "feta-braces-a.enc")
- ("feta number" . "feta-nummer10.enc")
- ("feta music" . "feta20.enc")
- ("parmesan music" . "parmesan20.enc"))
+ ("fetaBraces" . "feta-braces-a.enc")
+ ("fetaNumber" . "feta-nummer10.enc")
+ ("fetaMusic" . "feta20.enc")
+ ("parmesanMusic" . "parmesan20.enc"))
))
(define (get-coding coding-name)
(embedded-ps (list 'round-filled-box x y width height blotdiam)))
(define (text font s)
- (let* ((encoding (ly:font-encoding font))
- (names (car encoding))
- (table (cadr encoding))
- (permutation (caddr encoding)))
- (if (ly:get-option 'verbose)
- (begin
- (format (current-error-port) "TEXT: ~S\n" s)
- ;;(format (current-error-port) "encoding: ~S\n" encoding)
- ;;(format (current-error-port) "table: ~S\n" table)
- ;;(format (current-error-port) "permutation: ~S\n" permutation)
- (map (lambda (x)
- (let ((name (vector-ref names x)))
- (format
- (current-error-port)
- "number:~S\nname:~S\ntable:~S\npermutation:~S\npnum:~S\n\n"
- x name
- (hash-ref table x)
- (vector-ref permutation x)
- (char->integer (vector-ref permutation x)))))
- (map char->integer (plain-string->list s)))))
+ (let*
+ ((perm (vector-ref (ly:font-encoding font) 4)))
- (string-append
- "\\hbox{\\" (font-command font) "{}"
- (output-tex-string (if (vector? permutation)
- (reencode-string permutation s) s))
- "}")))
+ (string-append "\\hbox{\\" (font-command font) "{}"
+ (output-tex-string
+ (if (vector? perm)
+ (reencode-string perm s)
+ s))
+ "}")))
+
(define (tuplet ht gapx dx dy thick dir)
(embedded-ps (list 'tuplet ht gapx dx dy thick dir)))