(d >? height_)*point_constant));
}
-#define APPEND_CHAR_METRIC_ELT(k) \
- outstr += ::to_string (#k) + " " + ::to_string (k ## _) + "; "
-
-String
-Tex_font_char_metric::to_string () const
+Tex_font_metric::Tex_font_metric ()
{
- String outstr;
-
- APPEND_CHAR_METRIC_ELT (exists);
- APPEND_CHAR_METRIC_ELT (code);
- APPEND_CHAR_METRIC_ELT (width);
- APPEND_CHAR_METRIC_ELT (height);
- APPEND_CHAR_METRIC_ELT (depth);
- APPEND_CHAR_METRIC_ELT (italic_correction);
-
- return outstr + "\n";
+ encoding_table_ = SCM_EOL;
}
-Tex_font_metric::Tex_font_metric ()
+
+
+void
+Tex_font_metric::derived_mark () const
{
+ scm_gc_mark (encoding_table_);
}
Tex_font_char_metric const *
return b;
}
-String
-Tex_font_metric::to_string () const
-{
- String outstr;
- for (int i=0; i < char_metrics_.size (); i++)
- outstr += char_metrics_[i].to_string ();
- return outstr;
-}
-
SCM
Tex_font_metric::make_tfm (String filename)
{
tfm->char_metrics_ = reader.char_metrics_;
tfm->ascii_to_metric_idx_ = reader.ascii_to_metric_idx_;
+
+ tfm->encoding_table_ =
+ scm_call_1 (ly_scheme_function ("get-coding-table"),
+ scm_makfrom0str (tfm->coding_scheme ().to_str0 ()));
+
return tfm->self_scm ();
}
String
Tex_font_metric::coding_scheme () const
{
- return info_.coding_scheme;
+ 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;
}