From: Han-Wen Nienhuys Date: Sat, 11 Dec 2004 17:58:14 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: release/2.5.14~449 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c3d6497157576dc0d4ae77c44978d54e7a212074;p=lilypond.git *** empty log message *** --- diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc index bf2d363471..1935cc5972 100644 --- a/lily/all-font-metrics.cc +++ b/lily/all-font-metrics.cc @@ -8,7 +8,7 @@ #include "all-font-metrics.hh" -//#include "open-type-font.hh" +#include "open-type-font.hh" #include "config.hh" #include "main.hh" #include "warn.hh" @@ -120,8 +120,6 @@ All_font_metrics::find_afm (String name) return dynamic_cast (unsmob_metrics (val)); } -#if 0 - Open_type_font* All_font_metrics::find_otf (String name) { @@ -154,7 +152,6 @@ All_font_metrics::find_otf (String name) return dynamic_cast (unsmob_metrics (val)); } -#endif Tex_font_metric* All_font_metrics::find_tfm (String name) @@ -201,9 +198,8 @@ All_font_metrics::find_tfm (String name) Font_metric* All_font_metrics::find_font (String name) { - //Font_metric *f = find_otf (name); - Font_metric *f = 0; - + Font_metric *f = find_otf (name); + if (!f && (name.left_string (4) == "feta" || name.left_string (8) == "parmesan" diff --git a/lily/font-metric.cc b/lily/font-metric.cc index 2e25dfac9c..0bf62ae2a0 100644 --- a/lily/font-metric.cc +++ b/lily/font-metric.cc @@ -42,9 +42,10 @@ Font_metric::find_by_name (String s) const SCM expr = SCM_EOL; if (idx >= 0) { - expr = scm_list_3 (ly_symbol2scm ("char"), + expr = scm_list_3 (ly_symbol2scm ("named-glyph"), self_scm (), - scm_int2num (index_to_ascii (idx))); + scm_makfrom0str (s.to_str0 ()) + ); b = get_indexed_char (idx); } diff --git a/lily/include/open-type-font.hh b/lily/include/open-type-font.hh index 7fab468a1f..e50166ad73 100644 --- a/lily/include/open-type-font.hh +++ b/lily/include/open-type-font.hh @@ -21,13 +21,14 @@ public: virtual ~Open_type_font(); virtual Box get_indexed_char (int) const; virtual int name_to_index (String) const; + #if 0 virtual int count () const; virtual int index_to_ascii (int) const; virtual Box get_ascii_char (int) const; virtual Offset get_indexed_wxwy (int) const; - virtual Real design_size () const; #endif + virtual Real design_size () const; }; diff --git a/lily/kpath.cc b/lily/kpath.cc index 22910f95fc..592d70d09a 100644 --- a/lily/kpath.cc +++ b/lily/kpath.cc @@ -141,6 +141,22 @@ kpathsea_gulp_file_to_string (String name) return string; } + +LY_DEFINE (ly_find_file, "ly:find-file", + 1, 0, 0, (SCM name), + "Return the absolute file name of @var{name}," + "or @code{#f} if not found.") +{ + SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG1, __FUNCTION__, "string"); + + String nm = ly_scm2string (name); + String file_name = global_path.find (nm); + if (file_name.is_empty ()) + return SCM_BOOL_F; + + return scm_makfrom0str (file_name.to_str0 ()); +} + LY_DEFINE (ly_kpathsea_find_file, "ly:kpathsea-find-file", 1, 0, 0, (SCM name), "Return the absolute file name of @var{name}," diff --git a/lily/main.cc b/lily/main.cc index f0a209bbde..4b2df95954 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -28,6 +28,7 @@ #include "misc.hh" #include "output-def.hh" #include "warn.hh" +#include "freetype.hh" /* * Global options that can be overridden through command line. @@ -313,7 +314,7 @@ main_with_guile (void *, int, char **) ly_c_init_guile (); call_constructors (); init_global_tweak_registry (); - + init_freetype (); determine_output_options (); all_fonts_global = new All_font_metrics (global_path.to_string ()); diff --git a/lily/open-type-font.cc b/lily/open-type-font.cc index 6c2d34aa4e..b870342cba 100644 --- a/lily/open-type-font.cc +++ b/lily/open-type-font.cc @@ -12,32 +12,12 @@ #include -#if 0 - -void -enumerate_glyphs (FT_Face face) -{ - FT_UInt glyph_index; - FT_ULong char_code = FT_Get_First_Char (face, &glyph_index); - while (gindex != 0) - { - // ... do something with (charcode,gindex) pair ... - FT_Get - charcode = FT_Get_Next_Char( face, charcode, &gindex ); - } -} - -#endif - SCM Open_type_font::make_otf (String str) { Open_type_font * otf = new Open_type_font; int error_code = FT_New_Face(freetype2_library, str.to_str0(), 0, &(otf->face_)); - - // int code = FT_Set_Charmap (otf->face_, ); - if (error_code == FT_Err_Unknown_File_Format) { @@ -58,25 +38,26 @@ Open_type_font::~Open_type_font() Box -Open_type_font::get_indexed_char (int signed_idx) +Open_type_font::get_indexed_char (int signed_idx) const { FT_UInt idx = signed_idx; - int code = - FT_Load_Glyph (face_, + FT_Load_Glyph (face_, idx, FT_LOAD_NO_SCALE); - FT_Glyph_Metrics m = face->glyph->metrics; - Box b (Interval (0, m->width) - m->horiBearingX, - Interval (0, m->height) - m->horiBearingY); + FT_Glyph_Metrics m = face_->glyph->metrics; + int hb = m.horiBearingX; + int vb = m.horiBearingY; + Box b (Interval (-hb, m.width - hb), + Interval (-vb, m.height - vb)); return b; } int -Open_type_font::name_to_index (String nm) +Open_type_font::name_to_index (String nm) const { - FT_String * nm_str = nm.to_str0 (); + char * nm_str = (char * )nm.to_str0 (); int idx = FT_Get_Name_Index (face_, nm_str); if (idx == 0) @@ -87,7 +68,7 @@ Open_type_font::name_to_index (String nm) Real -Open_type_font::get_design_size () const +Open_type_font::design_size () const { return 20.0; } diff --git a/mf/merge.pe b/mf/merge.pe index e0fe623406..46020ff504 100644 --- a/mf/merge.pe +++ b/mf/merge.pe @@ -3,7 +3,7 @@ New(); // TODO: set version // TODO: GPL? -SetFontNames("Feta", "LilyPond", "", "", "This font is in the public domain.", ""); +SetFontNames("bigcheese20", "", "", "", "This font is in the public domain.", ""); MergeFonts("feta20.pfa"); MergeFonts("parmesan20.pfa"); @@ -11,6 +11,6 @@ MergeFonts("feta-nummer10.pfa"); MergeFonts("feta-din14.pfa"); MergeKern("feta-din14.tfm"); LoadTableFromFile("LILC", "feta20.otf-table") -Generate("feta20.otf"); -Generate("feta20.t42"); +Generate("bigcheese20.otf"); +Generate("bigcheese20.t42"); diff --git a/scm/font.scm b/scm/font.scm index 76690df798..c804c7a77b 100644 --- a/scm/font.scm +++ b/scm/font.scm @@ -182,6 +182,7 @@ ,(delay (ly:make-virtual-font (ly:font-load "feta20") (ly:font-load "parmesan20"))) +; ,(delay (ly:make-virtual-font (ly:font-load "bigcheese20"))) ,(delay (ly:make-virtual-font (ly:font-load "feta23") (ly:font-load "parmesan23"))) diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index 626ecfca65..fa0ba97114 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -50,19 +50,19 @@ (font-names (uniq-list (sort (map ly:font-file-name fonts) stringpfa bpath)) (else - (ly:warn "cannot find PFA font ~S" x) + (ly:warn "cannot find T42/PFA/PFB font ~S" x) "")))) (filter string? font-names)))) diff --git a/scm/output-ps.scm b/scm/output-ps.scm index 60ba674721..75251dcbfa 100644 --- a/scm/output-ps.scm +++ b/scm/output-ps.scm @@ -27,6 +27,7 @@ bracket dashed-slur char + named-glyph dashed-line zigzag-line ez-ball @@ -115,6 +116,11 @@ (ps-font-command font) " setfont " "(\\" (ly:inexact->string i 8) ") show" )) +(define (named-glyph font glyph) + (string-append + (ps-font-command font) " setfont " + "/" glyph " glyphshow ")) + (define (dashed-line thick on off dx dy) (string-append (ly:number->string dx) " "