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/fontexport.pe 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/sfd2ttf.pe scripts/ttf2sfd.pe scripts/fontexport.pe +EXPORTSCRIPT = scripts/fontexport.pe +SCRIPTS = $(EXPORTSCRIPT) scripts/sfd2ttf.pe scripts/ttf2sfd.pe MISCFILES = AUTHORS ChangeLog COPYING License.txt README TODO 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 -ttf: $(EXPORTDIR) $(TTFFILES) +FORMATS = ttf ttf-dir:: $(SFDFILES) - $(FONTFORGE) -script ./scripts/fontexport.pe -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/fontexport.pe -$(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) +endef +$(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 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 fonts@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/fonts http://fonts.fedoraproject.org/