variables.
* lily/font-select.cc (get_font_by_design_size): retrieve
PangoFont for (designsize . "pango-descr") entries.
* lily/lily-parser-scheme.cc: new file.
* scm/font.scm (add-cmr-fonts): use real dimens in font selection.
2005-01-07 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * lily/include/main.hh: lose _b hungarian suffixes for global
+ variables.
+
* lily/include/lily-guile-macros.hh: new file.
* lily/pango-select-scheme.cc (LY_DEFINE): new file.
SCM val;
if (!pango_dict_->try_retrieve (key, &val))
{
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication ("[" + String (fn));
Pango_font *pf = new Pango_font (pango_ft2_fontmap_,
RIGHT,
pango_dict_->set (key, val);
scm_gc_unprotect_object (val);
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication ("]");
pf->description_ = scm_cons (SCM_BOOL_F,
if (file_name.is_empty ())
return 0;
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication ("[" + file_name);
val = read_afm_file (file_name);
unsmob_metrics (val)->file_name_ = file_name;
unsmob_metrics (val)->description_ = scm_cons (name_string,
scm_make_real (1.0));
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication ("]");
afm_dict_->set (sname, val);
if (file_name.is_empty ())
return 0;
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication ("[" + file_name);
val = Open_type_font::make_otf (file_name);
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication ("]");
unsmob_metrics (val)->file_name_ = file_name;
if (file_name.is_empty ())
return 0;
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication ("[" + file_name);
val = Tex_font_metric::make_tfm (file_name);
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication ("]");
unsmob_metrics (val)->file_name_ = file_name;
else
{
warning ("Need symbol arguments for \\override and \\revert");
- if (internal_type_checking_global_b)
+ if (do_internal_type_checking_global)
assert (false);
}
}
Context::internal_set_property (SCM sym, SCM val)
{
#ifndef NDEBUG
- if (internal_type_checking_global_b)
+ if (do_internal_type_checking_global)
assert (type_check_assignment (sym, val, ly_symbol2scm ("translation-type?")));
#endif
#include "font-interface.hh"
#include "warn.hh"
#include "pango-font.hh"
+#include "main.hh"
bool
else
name = scm_cdr (name);
- if (scm_is_string (name))
+ if (scm_is_string (name)
+ && is_pango_format_global)
{
SCM mag = ly_chain_assoc (ly_symbol2scm ("font-magnification"), chain);
Real rmag = (scm_is_pair (mag)
scm_remember_upto_here_1 (protected_iter);
trans->finish ();
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication (_f ("elapsed time: %.2f seconds", timer.read ()));
return scm_gc_unprotect_object (trans->self_scm ());
i = prev;
}
- if (verbose_global_b)
+ if (be_verbose_global)
{
progress_indication (_f ("Optimal demerits: %f",
optimal_paths.top ().demerits_) + "\n");
if (!is_live ())
return;
- if (internal_type_checking_global_b)
+ if (do_internal_type_checking_global)
{
if (!type_check_assignment (s, v, ly_symbol2scm ("backend-type?")))
abort ();
s = scm_sloppy_assq (sym, immutable_property_alist_);
- if (internal_type_checking_global_b && scm_is_pair (s))
+ if (do_internal_type_checking_global && scm_is_pair (s))
{
if (!type_check_assignment (sym, scm_cdr (s),
ly_symbol2scm ("backend-type?")))
SCM ifs = scm_assoc (ly_symbol2scm ("interfaces"), meta);
/* Switch off interface checks for the moment. */
- bool itc = internal_type_checking_global_b;
- internal_type_checking_global_b = false;
+ bool itc = do_internal_type_checking_global;
+ do_internal_type_checking_global = false;
internal_set_property (ly_symbol2scm ("interfaces"), scm_cdr (ifs));
- internal_type_checking_global_b = itc;
+ do_internal_type_checking_global = itc;
}
/* TODO:
if (yy_current_buffer)
state_stack_.push (yy_current_buffer);
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication (String ("[") + name);
include_stack_.push (file);
if (yy_current_buffer)
state_stack_.push (yy_current_buffer);
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication (String ("[") + name);
include_stack_.push (file);
{
include_stack_.pop ();
char_count_stack_.pop ();
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication ("]");
yy_delete_buffer (yy_current_buffer);
#if HAVE_FLEXLEXER_YY_CURRENT_BUFFER
/* options */
extern Array<String> dump_header_fieldnames_global;
-extern bool no_layout_global_b;
+extern bool skip_layout_global;
extern String output_backend_global;
extern String output_name_global;
-extern bool safe_global_b;
-extern bool verbose_global_b;
-extern bool store_locations_global_b;
-extern bool internal_type_checking_global_b;
+extern bool be_safe_global;
+extern bool be_verbose_global;
+extern bool store_locations_global;
+extern bool do_internal_type_checking_global;
+extern bool is_pango_format_global;
/*
todo: collect in Output_option struct?
if (file_name.is_empty ())
error (_f ("can't find file: `%s'", name));
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication ("[" + file_name);
int filesize;
String string (str);
delete[] str;
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication ("]");
return string;
char const* s = here_str0 ();
int n = 0;
SCM sval = ly_parse_scm (s, &n, here_input (),
- safe_global_b && main_input_b_);
+ be_safe_global && main_input_b_);
if (sval == SCM_UNDEFINED)
{
return s;
}
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication ("[" + s);
int n;
String result ((Byte*) str, n);
delete[] str;
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication ("]");
return result;
for (int i = scm_init_funcs_->size () ; i--;)
(scm_init_funcs_->elem (i)) ();
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication ("\n");
scm_primitive_load_path (scm_makfrom0str ("lily.scm"));
+ " " + _ ("Perhaps you made a typing error?"));
/* Be strict when being anal :) */
- if (internal_type_checking_global_b)
+ if (do_internal_type_checking_global)
abort ();
warning (_ ("Doing assignment anyway."));
new_input (main_input_name_, sources_);
/* Do not allow \include in --safe-mode */
- allow_includes_b_ = allow_includes_b_ && !safe_global_b;
+ allow_includes_b_ = allow_includes_b_ && !be_safe_global;
scm_module_define (scm_car (scopes_),
ly_symbol2scm ("input-file-name"),
/*
junkme?
*/
-bool store_locations_global_b;
+bool store_locations_global;
/* Do not append `!' suffix, since 1st argument is not modified. */
LY_DEFINE (ly_set_point_and_click, "ly:set-point-and-click",
scm_module_define (global_lily_module, ly_symbol2scm ("point-and-click"),
val);
- store_locations_global_b = ly_c_procedure_p (val);
+ store_locations_global = ly_c_procedure_p (val);
return SCM_UNSPECIFIED;
}
String init_name_global;
/* Do not calculate and write layout output? */
-bool no_layout_global_b = false;
+bool skip_layout_global = false;
/* Selected output format.
One of tex, ps, scm, as.
*/
String output_backend_global = "ps";
String output_format_global = "pdf";
+bool is_pango_format_global;
/* Current output name. */
String output_name_global;
/* Run in safe mode? */
-bool safe_global_b = false;
+bool be_safe_global = false;
/* Verbose progress indication? */
-bool verbose_global_b = false;
+bool be_verbose_global = false;
/* Scheme code to execute before parsing, after .scm init
This is where -e arguments are appended to.
prepend_load_path (String (prefix_directory[i]) + "/scm");
}
- if (verbose_global_b)
+ if (be_verbose_global)
dir_info (stderr);
ly_c_init_guile ();
break;
case 'b':
output_backend_global = option_parser->optional_argument_str0_;
+ is_pango_format_global = (output_backend_global != "tex"
+ &&output_backend_global != "texstr");
break;
case 'f':
help_b = true;
break;
case 'V':
- verbose_global_b = true;
+ be_verbose_global = true;
break;
case 's':
- safe_global_b = true;
+ be_safe_global = true;
break;
case 'm':
- no_layout_global_b = true;
+ skip_layout_global = true;
break;
case 'p':
make_preview = true;
{
identify (stdout);
usage ();
- if (verbose_global_b)
+ if (be_verbose_global)
dir_info (stdout);
exit (0);
}
void
Music::internal_set_property (SCM s, SCM v)
{
- if (internal_type_checking_global_b)
+ if (do_internal_type_checking_global)
if (!type_check_assignment (s, v, ly_symbol2scm ("music-type?")))
abort ();
}
Real step = robust_scm2double (ly_symbol2scm ("font-size"), 0.0);
- Real size = text_size
- * pow (2.0, step / 6.0) * point_constant;
+ Real size = text_size * pow (2.0, step / 6.0);
pango_font_description_set_size (description,
gint (size * PANGO_SCALE));
select_pango_font (Output_def *layout, SCM chain)
{
PangoFontDescription *pfd =properties_to_pango_description (chain,
- layout->get_dimension (ly_symbol2scm ("text-font-size")));
-
+ point_constant * layout->get_dimension (ly_symbol2scm ("text-font-size")));
+
Font_metric * fm = all_fonts_global->find_pango_font (pfd);
return find_scaled_font (layout, fm, 1.0);
{
PangoFontDescription * description = pango_font_description_new ();
- String family_str = scm_is_symbol (family)
- ? ly_symbol2string (family)
- : String("roman");
+ String family_str = "roman";
+ if (scm_is_symbol (family))
+ family_str = ly_symbol2string (family);
+ else if (scm_is_string (family))
+ family_str = ly_scm2string (family);
+
pango_font_description_set_family (description,
family_str.to_str0 ());
pango_font_description_set_style (description,
SCM
Paper_score::process (String)
{
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication (_f ("Element count %d (spanners %d) ",
system_->element_count (),
system_->spanner_count ()));
lilypond_header_body:
{
- $$ = ly_make_anonymous_module (safe_global_b);
+ $$ = ly_make_anonymous_module (be_safe_global);
THIS->lexer_->add_scope ($$);
}
| lilypond_header_body assignment {
if (grob_sym != SCM_UNDEFINED)
{
- bool itc = internal_type_checking_global_b;
+ bool itc = do_internal_type_checking_global;
/* UGH.
*/
bool autobeam = ly_c_equal_p (symbol, ly_symbol2scm ("autoBeamSettings"));
if (autobeam)
- internal_type_checking_global_b = false;
+ do_internal_type_checking_global = false;
m->set_property ("grob-property", grob_sym);
if (autobeam)
- internal_type_checking_global_b = itc;
+ do_internal_type_checking_global = itc;
}
if (tag == ly_symbol2scm ("poppush"))
for (int i = 0; i < audio_staffs_.size (); i++)
{
Audio_staff *s = audio_staffs_[i];
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication ("[" + to_string (i)) ;
/*
}
s->output (midi_stream, channel++);
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication ("]");
}
}
/*
crash if internally the wrong type is used for a grob property.
*/
-bool internal_type_checking_global_b;
+bool do_internal_type_checking_global;
/*
else if (var == ly_symbol2scm ("parse-protect" ))
parse_protect_global = to_boolean (val);
else if (var == ly_symbol2scm ("internal-type-checking"))
- internal_type_checking_global_b = to_boolean (val);
+ do_internal_type_checking_global = to_boolean (val);
else if (var == ly_symbol2scm ("old-relative"))
{
lily_1_8_relative = true;
SCM o = SCM_UNSPECIFIED;
if (var == ly_symbol2scm ("safe")) // heavily used; put in front.
- o = ly_bool2scm (safe_global_b);
+ o = ly_bool2scm (be_safe_global);
else if (var == ly_symbol2scm ("old-relative-used"))
o = ly_bool2scm (lily_1_8_compatibility_used);
else if (var == ly_symbol2scm ("old-relative"))
o = ly_bool2scm (lily_1_8_relative);
else if (var == ly_symbol2scm ("verbose"))
- o = ly_bool2scm (verbose_global_b);
+ o = ly_bool2scm (be_verbose_global);
else if ( var == ly_symbol2scm ("resolution"))
o = scm_from_int (preview_resolution_global);
else
else
{
global_shortest = find_shortest (me, all);
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication (_f ("Global shortest duration is %s", global_shortest.to_string ()) + "\n");
}
prune_loose_columns (me, &all, global_shortest);
}
#endif
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication (_f ("Element count %d.", count + element_count ()));
int line_count = broken_intos_.size ();
for (int i = 0; i < line_count; i++)
{
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication ("[");
System *system = dynamic_cast<System*> (broken_intos_[i]);
system->post_processing ();
scm_vector_set_x (lines, scm_int2num (i), system->get_line ());
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication (to_string (i) + "]");
}
return lines;
for (SCM s = get_property ("all-elements"); scm_is_pair (s); s = scm_cdr (s))
unsmob_grob (scm_car (s))->discretionary_processing ();
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication (_f ("Grob count %d", element_count ()));
for (SCM s = get_property ("all-elements"); scm_is_pair (s); s = scm_cdr (s))
String str = ly_scm2string (markup);
-#if HAVE_PANGO_FT2
- if (output_backend_global != "tex"
- && output_backend_global != "texstr")
- {
- Font_metric *fm = select_pango_font (layout, props);
- return fm->text_stencil (str).smobbed_copy ();
- }
-#endif
-
Font_metric *fm = select_encoded_font (layout, props);
return fm->text_stencil (str).smobbed_copy();
}
%% use lmodern in latin1 (cork) flavour if EC is not available.
#(define text-font-defaults
`((font-encoding .
-; cork-lm
- Extended-TeX-Font-Encoding---Latin
-; ,(if (and (not (ly:kpathsea-find-file "ecrm10.pfa"))
-; (ly:kpathsea-find-file "cork-lm.enc")) 'cork-lm 'Extended-TeX-Font-Encoding---Latin)
- )
+ ,(cond
+ (tex-backend? 'Extended-TeX-Font-Encoding---Latin)
+ (else 'latin1)))
+ ;; add to taste here.
+
(baseline-skip . 2)
(word-space . 0.6)))
,(delay (ly:font-load "ectt10"))
,(delay (ly:font-load "ectt12"))))))))
-;; (display (make-font-tree 1.0))
-
-;; Century Schoolbook fonts file names on Debian/Sid
-(define-public (add-century-schoolbook-fonts node factor)
- (add-font node
- '((font-family . roman)
- (font-shape . upright)
- (font-series . medium)
- (font-encoding . latin1))
- `(,(ly:pt 10.0) . #(,(delay (ly:font-load "uncr8a")))))
- (add-font node
- '((font-family . roman)
- (font-shape . italic)
- (font-series . medium)
- (font-encoding . latin1))
- `(,(ly:pt 10.0) . #(,(delay (ly:font-load "uncri8a")))))
- (add-font node
- '((font-family . roman)
- (font-shape . upright)
- (font-series . bold)
- (font-encoding . latin1))
- `(,(ly:pt 10.0) . #(,(delay (ly:font-load "uncb8a")))))
- (add-font node
- '((font-family . roman)
- (font-shape . italic)
- (font-series . bold)
- (font-encoding . latin1))
- `(,(ly:pt 10.0) . #(,(delay (ly:font-load "uncbi8a"))))))
+(define-public (add-pango-fonts node family factor)
+ (define (add-node shape series)
+ (add-font node
+ `((font-family . ,family)
+ (font-shape . ,shape)
+ (font-series . ,series)
+ (font-encoding . latin1) ;; ugh.
+ )
+
+ `(,(ly:pt (* factor 12.0))
+ . #(,(cons
+ (ly:pt 12)
+ (ly:make-pango-description-string
+ `(((font-family . ,family)
+ (font-series . ,series)
+ (font-shape . ,shape)))
+ (ly:pt 12)))))))
+
+ (add-node 'upright 'medium)
+ (add-node 'upright 'bold)
+ (add-node 'italic 'bold)
+ (add-node 'italic 'medium))
(define-public (make-cmr-tree factor)
(let ((n (make-font-tree-node 'font-encoding 'fetaMusic)))
(define-public (make-century-schoolbook-tree factor)
(let ((n (make-font-tree-node 'font-encoding 'fetaMusic)))
(add-music-fonts n factor)
- (add-century-schoolbook-fonts n factor)
+ (add-pango-fonts n "Century Schoolbook L" factor)
n))
(define-public (magstep x)
(define-public point-and-click #f)
+(define-public tex-backend?
+ (memq (ly:output-backend) '("texstr" "tex")))
+
(define-public parser #f)
(define-public (lilypond-version)
(module-define! m 'text-font-size (* 12 (/ sz (* 20 pt))))
(module-define! m 'outputscale ss)
- (module-define! m 'fonts (make-cmr-tree (/ sz (* 20 pt))))
+ (module-define! m 'fonts
+ (if tex-backend?
+ (make-cmr-tree (/ sz (* 20 pt)))
+ (make-century-schoolbook-tree
+ (/ sz (* 20 pt)))))
(module-define! m 'staffheight sz)
(module-define! m 'staff-space ss)
(module-define! m 'staffspace ss)