2004-12-13 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * buildscripts/gen-bigcheese-scripts.py (i): load .subfonts table.
+
+ * lily/open-type-font.cc (LY_DEFINE): new function
+ ly:font-sub-fonts
+
+ * lily/include/font-metric.hh (struct Font_metric): new method
+ sub_fonts()
+
* lily/vaticana-ligature-engraver.cc (transform_heads): replace
. with - in add.stem.
import getopt
import re
import os
+import string
(options, files) = \
getopt.getopt (sys.argv[1:],
MergeFonts("feta-alphabet%(design_size)d.pfa");
MergeKern("feta-alphabet%(design_size)d.tfm");
+LoadTableFromFile("LILF", "%(name)s%(design_size)d.subfonts")
LoadTableFromFile("LILC", "feta%(design_size)d.otf-table")
LoadTableFromFile("LILY", "feta%(design_size)d.otf-gtable")
path = os.path.join (outdir, name + '%d' % design_size + '.pe')
open (path, 'w').write (script)
+
+ subfonts = ['feta%(design_size)d',
+ 'parmesan%(design_size)d',
+ 'feta-alphabet%(design_size)d']
+
+ ns = []
+ for s in subfonts:
+ ns.append (s % vars())
+
+ subfonts_str = string.join (ns)
+
+ open (os.path.join (outdir, '%(name)s%(design_size)d.subfonts' % vars()), 'w').write (subfonts_str)
+
path = os.path.join (outdir, name + '%d' % design_size + '.dep')
deps = r'''%(name)s%(design_size)d.otf: $(outdir)/feta%(design_size)d.pfa \
def write_tex_defs (file, global_info, charmetrics):
- nm = global_info['font
- ## nm = global_info['FontFamily']
nm = font_family
for m in charmetrics:
SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
SCM_ASSERT_TYPE (scm_is_integer (index), index, SCM_ARG2, __FUNCTION__, "index");
- return scm_from_unsigned_integer (fm->index_to_charcode (ly_scm2int (index)));
+ return scm_from_unsigned_integer (fm->index_to_charcode (scm_to_int (index)));
}
LY_DEFINE (ly_font_glyph_name_to_charcode, "ly:font-glyph-name-to-charcode",
{
return Offset (0, 0);
}
+
+SCM
+Font_metric::sub_fonts () const
+{
+ return SCM_EOL;
+}
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;
DECLARE_SMOBS (Font_metric,);
Modified_font_metric (Font_metric *fm, Real magnification,
String font_encoding, String input_encoding);
+ virtual SCM sub_fonts () const;
virtual Real design_size () const;
virtual void derived_mark () const;
virtual Box get_indexed_char (int) const;
{
FT_Face face_; /* handle to face object */
+ SCM lily_subfonts_;
SCM lily_character_table_;
SCM lily_global_table_;
Index_to_charcode_map index_to_charcode_map_;
//virtual unsigned glyph_name_to_charcode (String) const;
virtual unsigned index_to_charcode (int) const;
virtual void derived_mark () const;
+ virtual SCM sub_fonts () const;
#if 0
virtual int count () const;
virtual int index_to_ascii (int) const;
return ly_symbol2scm (fm->original_font ()->coding_scheme ().to_str0 ());
}
+SCM
+Modified_font_metric::sub_fonts () const
+{
+ return orig_->sub_fonts();
+}
+
String contents ((Byte const*)buffer, length);
contents = "(quote (" + contents + "))";
- SCM alist = scm_c_eval_string (contents.to_str0 ());
- tab = alist_to_hashq (alist);
+ SCM expr = scm_c_eval_string (contents.to_str0 ());
free (buffer);
}
- return tab;
+ return expr;
}
+
Index_to_charcode_map
make_index_to_charcode_map (FT_Face face)
{
}
#endif
-Open_type_font::Open_type_font (FT_Face face)
-{
- face_ = face;
- lily_character_table_ = SCM_EOL;
- lily_global_table_ = SCM_EOL;
-
- lily_character_table_ = load_scheme_table ("LILC", face_);
- lily_global_table_ = load_scheme_table ("LILY", face_);
- index_to_charcode_map_ = make_index_to_charcode_map (face_);
- //glyph_name_to_charcode_map_ = make_glyph_name_to_charcode_map (face_);
-}
-
Open_type_font::~Open_type_font()
{
FT_Done_Face (face_);
return otf->self_scm ();
}
-Open_type_font::Open_type_font(FT_Face face)
+
+Open_type_font::Open_type_font (FT_Face face)
{
face_ = face;
lily_character_table_ = SCM_EOL;
lily_global_table_ = SCM_EOL;
+
+ lily_character_table_ = alist_to_hashq (load_scheme_table ("LILC", face_));
+ lily_global_table_ = alist_to_hashq (load_scheme_table ("LILY", face_));
+ lily_subfonts_ = load_scheme_table ("LILF", face_);
+ index_to_charcode_map_ = make_index_to_charcode_map (face_);
- lily_character_table_ = load_scheme_table ("LILC", face_);
- lily_global_table_ = load_scheme_table ("LILY", face_);
- index_to_charcode_map_ = make_index_to_charcode_map (face_);
+ //glyph_name_to_charcode_map_ = make_glyph_name_to_charcode_map (face_);
}
void
{
scm_gc_mark (lily_character_table_);
scm_gc_mark (lily_global_table_);
+ scm_gc_mark (lily_subfonts_);
}
Offset
ly_symbol2scm ("staffsize"), SCM_BOOL_F);
return scm_to_double (entry);
}
+
+
+SCM
+Open_type_font::sub_fonts () const
+{
+ return lily_subfonts_;
+}
+
+LY_DEFINE (ly_font_magnification, "ly:font-sub-fonts", 1, 0, 0,
+ (SCM font),
+ "Given the font metric @var{font}, return the "
+ "magnification, relative to the current outputscale.")
+{
+ Font_metric *fm = unsmob_metrics (font);
+ SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
+ return scm_cdr (fm->description_);
+}
+
beam
bracket
dashed-slur
- char
+ named-glyph
dashed-line
zigzag-line
ez-ball
(define (dashed-slur thick dash l)
(embedded-ps (list 'dashed-slur thick dash `(quote ,l))))
-(define (char font i)
+(define (digits->letters str)
+ (regexp-substitute/global
+ #f "([0-9])" str
+ 'pre
+ (lambda (match)
+ (make-string
+ 1
+ (integer->char
+ (+ (char->integer #\A)
+ (- (char->integer #\0))
+ (char->integer (string-ref (match:substring match 1) 0)))
+ )))
+ 'post))
+
+(define (named-glyph font name)
(string-append "\\" (tex-font-command font)
- "\\char" (ly:inexact->string i 10) " "))
+ "\\"
+ (string-append
+; (digits->letters (ly:font-name font))
+ (regexp-substitute/global
+ #f "[\\._]"
+ (digits->letters name)
+ 'pre ""
+ 'post))))
(define (dashed-line thick on off dx dy)
(embedded-ps (list 'dashed-line thick on off dx dy)))