[PATCH 6/6] Makefile: now support other common export formats

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

Based on the previous patch, we create a generalization of how was
"ttf" target handled to support exporting also to other common
formats.  We add "4web" target covering common formats used on
the web (HTML/CSS:font-face): TTF, WOFF, SVG, EOT.
It is easy to add other formats if needed and provided that
such format is supported by FontForge.

To be honest, I am not sure about two things:
- Is the existing TTF export OK for web usage?  Have been exploring
  this field shortly, but cannot defuse my confusion (TTF/OTF, ...).
- Is hardcoded "fmflags" parameter in scripts/
  OK also for formats other than TTF?

Signed-off-by: Jan Pokorný <jpokorny@xxxxxxxxxx>
 source/Makefile |   37 +++++++++++++++++++++++++++++--------
 1 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/source/Makefile b/source/Makefile
index 995443b..c2bf920 100644
--- a/source/Makefile
+++ b/source/Makefile
@@ -1,7 +1,13 @@
+# common targets:
+# <no target>, build, ttf-dir: create dedicated dir with TTF files
+# ttf:                         create export dir with TTF files, track changes
+# 4web:                        dtto for TTF, WOFF, SVG, and EOT
 FONTFORGE    = fontforge
 FONTLINT     = fontlint
-SCRIPTS      = scripts/ scripts/ scripts/
+EXPORTSCRIPT = scripts/
+SCRIPTS      = $(EXPORTSCRIPT) scripts/ scripts/
 SRCDIR       = src
 EXPORTDIR    = export
@@ -30,16 +36,31 @@ $(EXPORTDIR):
 # TrueType/OpenType Font, general usage
 # - ttf cares about source file changes, using shared EXPORTDIR
 # - ttf-dir should be a bit more efficient, creating dedicated dir for TTF
+FORMATS = ttf
 ttf-dir:: $(SFDFILES)
-       $(FONTFORGE) -script ./scripts/ -ttf $^
+       $(FONTFORGE) -script $(EXPORTSCRIPT) -ttf $^
        mkdir -p $(DISTPREFIX_TTF)
        mv $(addsuffix .ttf,$(basename $^)) $(DISTPREFIX_TTF)
-# single file export (primarily used by other targets)
-$(EXPORTDIR)/%.ttf:: $(SRCDIR)/%.sfd
-       $(FONTFORGE) -script ./scripts/ -$(lastword $(subst ., ,$@)) $<
-       mv $(SRCDIR)/$(notdir $@) $(EXPORTDIR)
+# web sites usage
+# Web Open Font Format (WOFF); for all modern browsers (W3C recommendation)
+FORMATS += woff
+# SVG Font; only for WebKit and Presto based browsers (Firefox "avoids" it)
+FORMATS += svg
+# Embedded OpenType (EOT); only for MSIE
+FORMATS += eot
+4web: $(FORMATS)
+# XXX: declare other formats here if needed (TeX, etc.)
+# summary per-format target + single file export for these declared formats
+define FORMAT_template =
+$(1):: $$(EXPORTDIR) $$(addprefix $$(EXPORTDIR)/$$(NAME), $$(VARIANTS:=.$(1)))
+$$(EXPORTDIR)/%.$(1):: $$(SRCDIR)/%.sfd
+       $$(FONTFORGE) -script $$(EXPORTSCRIPT) -$$(lastword $$(subst ., ,$$@)) $$< 2>/dev/null
+       mv $$(SRCDIR)/$$(notdir $$@) $$(EXPORTDIR)
+$(foreach format,$(FORMATS),$(eval $(call FORMAT_template,$(format))))
 dist: clean-dist dist-sfd dist-ttf
 dist-src: dist-sfd
@@ -74,4 +95,4 @@ clean: clean-dist
        rm -f -- *.tar.gz *.zip
-.PHONY: all build ttf-dir ttf dist dist-src dist-sfd dist-ttf check clean clean-dist
+.PHONY: all build ttf-dir ttf dist dist-src dist-sfd dist-ttf 4web check clean clean-dist $(FORMATS)
fonts mailing list

[Home]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Red Hat 9 Bible]     [Fedora Bible]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

Powered by Linux