Skip to content

Commit

Permalink
Add TTC version
Browse files Browse the repository at this point in the history
  • Loading branch information
MihailJP committed Feb 10, 2024
1 parent f496d57 commit c6fa778
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
ChangeLog
*.otf
*.ttf
*.ttc
*-Polish*.sfd
*-Bulgarian*.sfd
*-Yugoslav*.sfd
Inconsolata-LGC-*.mk
InconsolataLGC/
InconsolataLGC-OT/
InconsolataLGC-TTC/
*.tar.xz
*.tar.gz
*.tar.bz2
Expand Down
10 changes: 10 additions & 0 deletions Inconsolata-LGC.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.INTERMEDIATE: Inconsolata-LGC-Polish.sfd Inconsolata-LGC-Bulgarian.sfd Inconsolata-LGC-Yugoslav.sfd
Inconsolata-LGC-Polish.sfd: Inconsolata-LGC.sfd regional.rb
./regional.rb pl < $< > $@
Inconsolata-LGC-Bulgarian.sfd: Inconsolata-LGC.sfd regional.rb
./regional.rb bg < $< > $@
Inconsolata-LGC-Yugoslav.sfd: Inconsolata-LGC.sfd regional.rb
./regional.rb mkd < $< > $@

Inconsolata-LGC.ttc: Inconsolata-LGC.sfd Inconsolata-LGC-Polish.sfd Inconsolata-LGC-Bulgarian.sfd Inconsolata-LGC-Yugoslav.sfd makettc.py
./makettc.py $@ Inconsolata-LGC.sfd Inconsolata-LGC-Polish.sfd Inconsolata-LGC-Bulgarian.sfd Inconsolata-LGC-Yugoslav.sfd
34 changes: 30 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,40 @@ FONTS=Inconsolata-LGC.ttf \
Inconsolata-LGC-Italic.ttf \
Inconsolata-LGC-BoldItalic.ttf
OTFONTS=${FONTS:.ttf=.otf}
TTCFONTS=${FONTS:.ttf=.ttc}
DOCUMENTS=README ChangeLog LICENSE
PKGS=InconsolataLGC.tar.xz InconsolataLGC-OT.tar.xz
PKGS=InconsolataLGC.tar.xz InconsolataLGC-OT.tar.xz InconsolataLGC-TTC.tar.xz
FFCMD=for i in $?;do fontforge -lang=ff -c "Open(\"$$i\");Generate(\"$@\");Close()";done
TTFPKGCMD=rm -rf $*; mkdir $*; cp ${FONTS} ${DOCUMENTS} $*
OTFPKGCMD=rm -rf $*; mkdir $*; cp ${OTFONTS} ${DOCUMENTS} $*
TTCPKGCMD=rm -rf $*; mkdir $*; cp ${TTCFONTS} ${DOCUMENTS} $*

.PHONY: all
all: ttf otf
all: ttf otf ttc

.SUFFIXES: .sfd .ttf .otf

include Inconsolata-LGC.mk
include Inconsolata-LGC-Bold.mk
include Inconsolata-LGC-Italic.mk
include Inconsolata-LGC-BoldItalic.mk

Inconsolata-LGC-Bold.mk: Inconsolata-LGC.mk
sed -E -e 's/\.(sfd|ttc)/-Bold.\1/g' $< > $@
Inconsolata-LGC-Italic.mk: Inconsolata-LGC.mk
sed -E -e 's/\.(sfd|ttc)/-Italic.\1/g' $< > $@
Inconsolata-LGC-BoldItalic.mk: Inconsolata-LGC.mk
sed -E -e 's/\.(sfd|ttc)/-BoldItalic.\1/g' $< > $@

.sfd.ttf:
${FFCMD}
.sfd.otf:
${FFCMD}

.PHONY: ttf otf
.PHONY: ttf otf ttc
ttf: ${FONTS}
otf: ${OTFONTS}
ttc: ${TTCFONTS}

.SUFFIXES: .tar.xz .tar.gz .tar.bz2 .zip
.PHONY: dist
Expand All @@ -47,11 +62,22 @@ InconsolataLGC-OT.tar.bz2: ${OTFONTS} ${DOCUMENTS}
InconsolataLGC-OT.zip: ${OTFONTS} ${DOCUMENTS}
${OTFPKGCMD}; zip -9r $@ $*

InconsolataLGC-TTC.tar.xz: ${OTFONTS} ${DOCUMENTS}
${TTCPKGCMD}; tar cfvJ $@ $*
InconsolataLGC-TTC.tar.gz: ${OTFONTS} ${DOCUMENTS}
${TTCPKGCMD}; tar cfvz $@ $*
InconsolataLGC-TTC.tar.bz2: ${OTFONTS} ${DOCUMENTS}
${TTCPKGCMD}; tar cfvj $@ $*
InconsolataLGC-TTC.zip: ${OTFONTS} ${DOCUMENTS}
${TTCPKGCMD}; zip -9r $@ $*

ChangeLog: .git # GIT
./mkchglog.rb > $@ # GIT

.PHONY: clean
clean:
-rm -f ${FONTS} ${OTFONTS} ChangeLog
-rm -f ${FONTS} ${OTFONTS} ${TTCFONTS} ChangeLog
-rm -f ${FONTS:.ttf=-Polish.sfd} ${FONTS:.ttf=-Bulgarian.sfd} ${FONTS:.ttf=-Yugoslav.sfd}
-rm -f Inconsolata-LGC-Bold.mk Inconsolata-LGC-Italic.mk Inconsolata-LGC-BoldItalic.mk
-rm -rf ${PKGS} ${PKGS:.tar.xz=} ${PKGS:.tar.xz=.tar.bz2} \
${PKGS:.tar.xz=.tar.gz} ${PKGS:.tar.xz=.zip}
5 changes: 5 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ Inconsolata LGC is a modified version of Inconsolata with added the Cyrillic
alphabet which directly descends from Inconsolata Hellenic supporting modern
Greek.

Inconsolata LGC supports OpenType 'locl' feature to display Polish,
Romanian, Bulgarian, Macedonian, and Serbian specific variant (for the
latter two, affects to italic only). TTC version is intended for use in
apps which do not support 'locl' feature.

Inconsolata LGC is licensed under SIL OFL.


Expand Down
5 changes: 5 additions & 0 deletions makettc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env fontforge -script
from sys import argv
font = fontforge.open(argv[2])
fonts = [fontforge.open(filename) for filename in argv[3:len(argv)]]
font.generateTtc(argv[1], fonts)
43 changes: 43 additions & 0 deletions regional.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env ruby

c = {}
g = ""
f = $stdin.readlines

t = {
"bg" => {tag: /\.bg$/, namesuffix: "Bulgarian"},
"mkd" => {tag: /\.mkd$/, namesuffix: "Yugoslav"},
"pl" => {tag: /\.pl$/, namesuffix: "Polish"}
}

f.each {|l|
l.chomp!
if l =~ /^StartChar:/ then
g = l.sub(/^StartChar:\s*(.*)$/, '\1')
elsif l =~ /^Encoding:/ and g != "" then
c.merge!({g => l.sub(/^Encoding:\s*(\d+)\s+(-?\d+).*$/, '\2')})
end
}

c.each {|k, v|
if k =~ t[$*[0]][:tag] then
w = c[k.sub(t[$*[0]][:tag], "")]
c[k.sub(t[$*[0]][:tag], "")] = v
c[k] = w
end
}

g = ""
f.each {|l|
if l =~ /^(Font|Full|Family)Name:/ then
l.sub!(/Inconsolata( ?)LGC/, '\&\1' + t[$*[0]][:namesuffix])
elsif l =~ /^StartChar:/ then
g = l.sub(/^StartChar:\s*(.*)$/, '\1')
elsif l =~ /^Encoding:/ and g != "" then
l.sub!(/^Encoding:\s*(\d+)\s*(-?\d+)/, 'Encoding: \1 ' + c[g])
end
begin
puts l
rescue Errno::EPIPE
end
}

0 comments on commit c6fa778

Please sign in to comment.