lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Add sans-serif and monospace fonts (issue 224800043 by address@hidde


From: Masamichi HOSODA
Subject: Re: Add sans-serif and monospace fonts (issue 224800043 by address@hidden)
Date: Sat, 18 Apr 2015 18:54:13 +0900 (JST)

> Patch counted down - please push
> 
> https://codereview.appspot.com/224800043/

I don't have git account.
I've attached the patch file to this mail.
Would you push it?
>From d220ccbd436f050418eee28c9841309ab3925cfd Mon Sep 17 00:00:00 2001
From: Masamichi Hosoda <address@hidden>
Date: Wed, 8 Apr 2015 21:38:23 +0900
Subject: [PATCH v2] Add sans-serif and monospace fonts

Nimbus Sans L (Helvetica substitute) as sans-serif font.
Nimbus Mono L (Courier substitute) as monospace font.
---
 config.make.in                          |  2 +
 configure.ac                            | 70 +++++++++++++++++++++++++++++----
 mf/GNUmakefile                          | 36 ++++++++++++++++-
 scm/font.scm                            |  8 ++--
 scripts/auxiliar/pfx2ttf-mono.fontforge | 36 +++++++++++++++++
 5 files changed, 140 insertions(+), 12 deletions(-)
 create mode 100644 scripts/auxiliar/pfx2ttf-mono.fontforge

diff --git a/config.make.in b/config.make.in
index 9837fc3..ee7aaf8 100644
--- a/config.make.in
+++ b/config.make.in
@@ -91,6 +91,8 @@ vimdir = $(lilypond_datadir)/vim
 
 NCSB_SOURCE_FILES = @NCSB_SOURCE_FILES@
 NCSB_DIR = @NCSB_DIR@
+HELV_SOURCE_FILES = @HELV_SOURCE_FILES@
+COUR_SOURCE_FILES = @COUR_SOURCE_FILES@
 
 ################################################################
 ## PROGRAMS
diff --git a/configure.ac b/configure.ac
index f740237..a403e35 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,9 +32,9 @@ AC_ARG_ENABLE(guile2,
                    [highly experimental GUILE 2 support.  Default: off])],
     [GUILEv2=$enableval])
 
-AC_ARG_WITH(ncsb-dir,
-    [AS_HELP_STRING([--with-ncsb-dir=DIR],
-                   [location of Century Schoolbook fonts.])],
+AC_ARG_WITH(fonts-dir,
+    [AS_HELP_STRING([--with-fonts-dir=DIR],
+                   [location of URW++ fonts.])],
     [NCSB_DIR=$withval],
     [NCSB_DIR=""])
 
@@ -61,7 +61,7 @@ AC_SUBST(LINK_GXX_STATICALLY)
 STEPMAKE_COMPILE
 
 AC_CHECK_PROG(FCLIST, fc-list, fc-list)
-AC_MSG_CHECKING([for New Century Schoolbook PFB files])
+AC_MSG_CHECKING([for Century Schoolbook L PFB files])
 AC_SUBST(NCSB_SOURCE_FILES)
 AC_SUBST(NCSB_DIR)
 if test "$NCSB_DIR" = ""; then
@@ -90,12 +90,12 @@ if test "$NCSB_DIR" != "" ;  then
 fi
 if test "$NCSB_DIR" = "" -o "$MISSING_NCSB_SOURCE_FILES" != 
"$INCOMPLETE_NCSB_SOURCE_FILES"; then
   AC_MSG_RESULT(no)
-  STEPMAKE_ADD_ENTRY(REQUIRED,International New Century Schoolbook fonts)
+  STEPMAKE_ADD_ENTRY(REQUIRED,International Century Schoolbook L fonts)
   if test "$NCSB_DIR" = ""; then
     if test "$FCLIST" = ""; then
-      STEPMAKE_ADD_ENTRY(REQUIRED,'(install the fc-list utility from 
FontConfig, or use --with-ncsb-dir)')
+      STEPMAKE_ADD_ENTRY(REQUIRED,'(install the fc-list utility from 
FontConfig, or use --with-fonts-dir)')
     else
-      STEPMAKE_ADD_ENTRY(REQUIRED,'(make sure the fc-list utility can see 
them, or use --with-ncsb-dir)')
+      STEPMAKE_ADD_ENTRY(REQUIRED,'(make sure the fc-list utility can see 
them, or use --with-fonts-dir)')
     fi
   fi
   if test "$MISSING_NCSB_SOURCE_FILES" != ""; then
@@ -108,6 +108,62 @@ else
   AC_MSG_RESULT(yes)
 fi
 
+AC_MSG_CHECKING([for Nimbus Sans L (Helvetica) PFB files])
+AC_SUBST(HELV_SOURCE_FILES)
+if test "$NCSB_DIR" != "" ;  then
+  for f in n019003l.pfb n019004l.pfb n019023l.pfb n019024l.pfb; do
+    if test ! -f "$NCSB_DIR/$f"; then
+      MISSING_HELV_SOURCE_FILES="$f $MISSING_HELV_SOURCE_FILES"
+    else
+      if test "`grep Cyrillic "$NCSB_DIR/$f"`" = ""; then
+        INCOMPLETE_HELV_SOURCE_FILES="$f $INCOMPLETE_HELV_SOURCE_FILES"
+      else
+        HELV_SOURCE_FILES="$NCSB_DIR/$f $HELV_SOURCE_FILES"
+      fi
+    fi
+  done
+fi
+if test "$NCSB_DIR" = "" -o "$MISSING_HELV_SOURCE_FILES" != 
"$INCOMPLETE_HELV_SOURCE_FILES"; then
+  AC_MSG_RESULT(no)
+  STEPMAKE_ADD_ENTRY(REQUIRED,International Nimbus Sans L fonts)
+  if test "$MISSING_HELV_SOURCE_FILES" != ""; then
+    STEPMAKE_ADD_ENTRY(REQUIRED,'(these files are missing: 
$MISSING_HELV_SOURCE_FILES)')
+  fi
+  if test "$INCOMPLETE_HELV_SOURCE_FILES" != ""; then
+    STEPMAKE_ADD_ENTRY(REQUIRED,'(these files do not contain Cyrillic 
characters: $INCOMPLETE_HELV_SOURCE_FILES)')
+  fi
+else
+  AC_MSG_RESULT(yes)
+fi
+
+AC_MSG_CHECKING([for Nimbus Mono L (Courier) PFB files])
+AC_SUBST(COUR_SOURCE_FILES)
+if test "$NCSB_DIR" != "" ;  then
+  for f in n022003l.pfb n022004l.pfb n022023l.pfb n022024l.pfb; do
+    if test ! -f "$NCSB_DIR/$f"; then
+      MISSING_COUR_SOURCE_FILES="$f $MISSING_COUR_SOURCE_FILES"
+    else
+      if test "`grep Cyrillic "$NCSB_DIR/$f"`" = ""; then
+        INCOMPLETE_COUR_SOURCE_FILES="$f $INCOMPLETE_COUR_SOURCE_FILES"
+      else
+        COUR_SOURCE_FILES="$NCSB_DIR/$f $COUR_SOURCE_FILES"
+      fi
+    fi
+  done
+fi
+if test "$NCSB_DIR" = "" -o "$MISSING_COUR_SOURCE_FILES" != 
"$INCOMPLETE_COUR_SOURCE_FILES"; then
+  AC_MSG_RESULT(no)
+  STEPMAKE_ADD_ENTRY(REQUIRED,International Nimbus Mono L fonts)
+  if test "$MISSING_COUR_SOURCE_FILES" != ""; then
+    STEPMAKE_ADD_ENTRY(REQUIRED,'(these files are missing: 
$MISSING_COUR_SOURCE_FILES)')
+  fi
+  if test "$INCOMPLETE_COUR_SOURCE_FILES" != ""; then
+    STEPMAKE_ADD_ENTRY(REQUIRED,'(these files do not contain Cyrillic 
characters: $INCOMPLETE_COUR_SOURCE_FILES)')
+  fi
+else
+  AC_MSG_RESULT(yes)
+fi
+
 AC_LANG([C++])
 
 STEPMAKE_PYTHON(REQUIRED, 2.4, 3.0)
diff --git a/mf/GNUmakefile b/mf/GNUmakefile
index 141ba63..646234c 100644
--- a/mf/GNUmakefile
+++ b/mf/GNUmakefile
@@ -40,6 +40,16 @@ NCSB_OTFS = $(addprefix $(outdir)/,CenturySchL-Ital.otf \
                                   CenturySchL-Roma.otf \
                                   CenturySchL-Bold.otf)
 
+HELV_OTFS = $(addprefix $(outdir)/,NimbusSanL-ReguItal.otf \
+                                  NimbusSanL-BoldItal.otf \
+                                  NimbusSanL-Regu.otf \
+                                  NimbusSanL-Bold.otf)
+
+COUR_OTFS = $(addprefix $(outdir)/,NimbusMonL-ReguObli.otf \
+                                  NimbusMonL-BoldObli.otf \
+                                  NimbusMonL-Regu.otf \
+                                  NimbusMonL-Bold.otf)
+
 LOG_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.log)
 LISP_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.lisp)
 ENC_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.enc)
@@ -74,6 +84,8 @@ $(outdir)/emmentaler-%.genpe: 
$(buildscript-dir)/gen-emmentaler-scripts
 
 ALL_GEN_FILES = $(ENC_FILES) \
                $(NCSB_OTFS) \
+               $(HELV_OTFS) \
+               $(COUR_OTFS) \
                $(OTF_FILES) \
                $(SVG_FILES) \
                $(WOFF_FILES)
@@ -87,7 +99,7 @@ INSTALLATION_OUT_SUFFIXES = 1 2
 
 INSTALLATION_OUT_DIR1 = $(local_lilypond_datadir)/fonts/otf
 INSTALLATION_OUT_FILES1 = $(OTF_FILES) \
-                         $(NCSB_OTFS)
+                         $(NCSB_OTFS) $(HELV_OTFS) $(COUR_OTFS)
 
 INSTALLATION_OUT_DIR2 = $(local_lilypond_datadir)/fonts/svg
 INSTALLATION_OUT_FILES2 = $(SVG_FILES) $(WOFF_FILES)
@@ -172,3 +184,25 @@ $(addprefix $(outdir)/,CenturySchL-Ital.otf \
        CenturySchL-Bold.otf \
        CenturySchL-BoldItal.otf): $(outdir)/CenturySchL-Roma.otf
        $(UPDATE_TARGET)
+
+$(outdir)/NimbusSanL-Regu.otf: $(HELV_SOURCE_FILES) \
+             $(auxscript-dir)/pfx2ttf.fontforge
+       $(foreach i, $(basename $(HELV_SOURCE_FILES)), \
+               $(FONTFORGE) -script $(auxscript-dir)/pfx2ttf.fontforge \
+                       $(i).pfb $(i).afm $(outdir)/ && ) true
+
+$(addprefix $(outdir)/,NimbusSanL-ReguItal.otf \
+       NimbusSanL-Bold.otf \
+       NimbusSanL-BoldItal.otf): $(outdir)/NimbusSanL-Regu.otf
+       $(UPDATE_TARGET)
+
+$(outdir)/NimbusMonL-Regu.otf: $(COUR_SOURCE_FILES) \
+             $(auxscript-dir)/pfx2ttf-mono.fontforge
+       $(foreach i, $(basename $(COUR_SOURCE_FILES)), \
+               $(FONTFORGE) -script $(auxscript-dir)/pfx2ttf-mono.fontforge \
+                       $(i).pfb $(i).afm $(outdir)/ && ) true
+
+$(addprefix $(outdir)/,NimbusMonL-ReguObli.otf \
+       NimbusMonL-Bold.otf \
+       NimbusMonL-BoldObli.otf): $(outdir)/NimbusMonL-Regu.otf
+       $(UPDATE_TARGET)
diff --git a/scm/font.scm b/scm/font.scm
index 11c9719..0582a49 100644
--- a/scm/font.scm
+++ b/scm/font.scm
@@ -253,8 +253,8 @@ used.  This is used to select the proper design size for 
the text fonts.
   (music "emmentaler")
   (brace "emmentaler")
   (roman "Century Schoolbook L")
-  (sans "sans-serif")
-  (typewriter "monospace")
+  (sans "Nimbus Sans L")
+  (typewriter "Nimbus Mono L")
   (factor 1))
   (let ((n (make-font-tree-node 'font-encoding 'fetaMusic)))
     (add-music-fonts n 'feta music brace feta-design-size-mapping factor)
@@ -274,8 +274,8 @@ used.  This is used to select the proper design size for 
the text fonts.
 (define-public (make-century-schoolbook-tree factor)
   (make-pango-font-tree
    "Century Schoolbook L"
-   "sans-serif"
-   "monospace"
+   "Nimbus Sans L"
+   "Nimbus Mono L"
    factor))
 
 (define-public all-text-font-encodings
diff --git a/scripts/auxiliar/pfx2ttf-mono.fontforge 
b/scripts/auxiliar/pfx2ttf-mono.fontforge
new file mode 100644
index 0000000..7b80494
--- /dev/null
+++ b/scripts/auxiliar/pfx2ttf-mono.fontforge
@@ -0,0 +1,36 @@
+Open($1);
+MergeKern($2)
+
+
+# The AFM files of `New Century Schoolbook' family as distributed within the
+# urw-fonts-1.0.7pre41.tar.bz2 archive contain a bunch of ligatures which
+# shouldn't be active by default:
+#
+#   T + M -> trademark
+#   N + o -> afii61352
+#   i + j -> ij
+#   I + J -> IJ
+#
+# This font bundle is shipped by Fedora Core 6 and other GNU/Linux
+# distributions; we simply remove those ligatures.
+
+# Monospace font shouldn't have these ligature.
+#
+#   f + i -> fi
+#   f + l -> fl
+
+SelectIf("trademark", "trademark", \
+         "afii61352", "afii61352", \
+         "ij", "ij", \
+         "IJ", "IJ", \
+        "fi", "fi", \
+        "fl", "fl");
+if (Strtol($version) < 20070501)
+  RemoveATT("Ligature", "*", "*");
+else
+  RemovePosSub("*");
+endif
+
+Generate($3 + $fontname + ".otf");
+
+# EOF
-- 
2.1.4


reply via email to

[Prev in Thread] Current Thread [Next in Thread]