Skip to content

Commit afe03db

Browse files
committed
More sane specimen generation thanks to sile-typesetter/sile#1662.
1 parent d7d8bef commit afe03db

File tree

2 files changed

+13
-38
lines changed

2 files changed

+13
-38
lines changed

scripts/each_font_specimen.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
#!/bin/bash
2-
rm -f /tmp/eachfont${FONTFAMILY}-*.pdf specimens/${FONTFAMILY}-specimen.pdf
2+
rm -f /tmp/silespecimens/eachfont${FONTFAMILY}-*.pdf specimens/${FONTFAMILY}-specimen.pdf
3+
mkdir -p /tmp/silespecimens || true
34

45
echo ${FONTFAMILY_H}
56

67
find dist -type f -iname "${FONTFAMILY}*_NOVF.otf" | sort -V | parallel --jobs 300% --bar "
78
export OS2WEIGHT=\`./scripts/os2weight_of_font.py {}\`
89
export WEIGHT=\`./scripts/os2weight_to_namedweight.py \$OS2WEIGHT\`
910
export STYLE=\`ftdump -n {}|rg '(family:|style:)'|awk 'BEGIN {FS=\" \"} {print \$2}'|awk 'BEGIN {FS=\"\\n\"; RS=\"\"} {print \$1\$2}'\`
10-
(sed \"s/&&FONT&&/{/}/g; s/&&FONTFAMILY&&/${FONTFAMILY}/g; s/&&FONTFAMILY_H&&/${FONTFAMILY_H}/g; s/&&OS2WEIGHT&&/\$OS2WEIGHT/g; s/&&WEIGHT&&/\$WEIGHT/g; s/&&PAGE&&/{#}/g; s/&&STYLE&&/\$STYLE/\" < specimens/eachfont.sil) > /tmp/eachfont{/}.sil &&
11-
sile /tmp/eachfont{/}.sil
11+
(sed \"s/&&FONT&&/{/}/g; s/&&FONTFAMILY&&/${FONTFAMILY}/g; s/&&FONTFAMILY_H&&/${FONTFAMILY_H}/g; s/&&OS2WEIGHT&&/\$OS2WEIGHT/g; s/&&WEIGHT&&/\$WEIGHT/g; s/&&PAGE&&/{#}/g; s/&&STYLE&&/\$STYLE/\" < specimens/eachfont.sil) > /tmp/silespecimens/eachfont{/}.sil &&
12+
sile /tmp/silespecimens/eachfont{/}.sil
1213
"
1314

14-
pdftk `find /tmp/ -iname "eachfont${FONTFAMILY}-*.pdf"|sort -V` cat output "specimens/${FONTFAMILY_H} specimen.pdf"
15+
pdftk `find /tmp/silespecimens/ -iname "eachfont${FONTFAMILY}-*.pdf"|sort -V` cat output "specimens/${FONTFAMILY_H} specimen.pdf"

specimens/eachfont.sil

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,48 +9,22 @@
99
\frame[id=specimen_overlay,left=5%pw,right=95%pw,top=5%ph,bottom=top(footnotes)]
1010
\frame[id=arrows,left=5%pw,right=95%pw,top=5.22%ph,bottom=top(footnotes)]
1111
\set[parameter=shaper.spaceenlargementfactor,value=1]
12-
\script{
13-
SILE.settings.set("document.spaceskip", SILE.length("1spc"))
14-
SILE.settings.set("shaper.spacestretchfactor", 0)
15-
SILE.settings.set("shaper.spaceshrinkfactor", 0)
16-
SILE.scratch.counters.folio.value = &&PAGE&&
17-
wrapper = "\\typeset-into[frame=%s]{%s\n%s}"
18-
font_dist = [[\font[filename=dist/]] .. ("&&FONT&&") .. ',%s]'
19-
font_arrows = [[\font[filename=dist/&&FONTFAMILY&&-&&OS2WEIGHT&&-JustArrows&&WEIGHT&&.otf]%]]
20-
content_inner = [[\neverindent
21-
\par \font[size=3em]{&&FONTFAMILY_H&&}
12+
\frame[id=fontname,left=5%pw,right=95%pw,top=1%ph,bottom=1% + height(folio)]
13+
\typeset-into[frame=fontname]{
14+
\noindent\font[family=TT2020Base,size=5pt]{&&FONT&&}
15+
\begin[filename=dist/&&FONT&&]{font}
16+
\par \font[features=+ss01,size=3em]{&&FONTFAMILY_H&&}
2217
\bigskip
23-
\par &&STYLE&&
18+
\par \font[features=+ss01]{&&STYLE&&}
2419
\bigskip
2520
\par Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz
2621
\par ÁáÀàẢảÃãẠạĂăẮắẰằẲẳẴẵẶặÂâẤấẦầẨẩẪẫẬậĐđÉéÈèẺẻẼẽẸẹÊêẾếỀềỂểỄễỆệÍíÌìỈỉĨĩỊịÓóÒòỎỏÕõỌọ
2722
\par ÔôỐốỒồỔổỖỗỘộƠơỚớỜờỞởỠỡỢợÚúÙùỦủŨũỤụƯưỨứỪừỬửỮữỰựÝýỲỳỶỷỸỹỴỵ
2823
\par abcdefghijklmnopqrstuvwxyz
29-
\par 1234567890 !@#$\%%&*() []{};':",./ \\ № ₿ ₱ ₹ †
24+
\par 1234567890 !@#$\%&*() []{};':",./ \\ № ₿ ₱ ₹ †
3025
\par The quick brown fox jumps over the lazy dog.
3126
\par Laŭ Ludoviko Zamenhof bongustas freŝa ĉeĥa manĝaĵo kun spicoj.
3227
\par В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!
33-
]]
34-
if string.find("&&FONT&&", "Arrows") then
35-
font_dist = string.format(font_dist, "features=+ss01")
36-
else
37-
font_dist = string.format(font_dist, "")
38-
end
39-
contents = wrapper:format("specimen", font_dist, content_inner)
40-
contents_overlay = wrapper:format("specimen_overlay", font_dist, content_inner)
41-
contents_arrows = wrapper:format("arrows", font_arrows, content_inner)
42-
SILE.doTexlike(contents)
43-
--[[SILE.shaper = SILE.shapers.harfbuzz()
44-
SILE.doTexlike(contents_overlay)
45-
if string.find("&&FONT&&", "Arrows") then
46-
SILE.outputter:pushColor({r = 1, g= 0, b = 0 })
47-
SILE.shaper = SILE.shapers.harfbuzz()
48-
SILE.doTexlike(contents_arrows)
49-
SILE.outputter:popColor()
50-
end--]]
51-
}
52-
\frame[id=fontname,left=5%pw,right=95%pw,top=1%ph,bottom=1% + height(folio)]
53-
\typeset-into[frame=fontname]{
54-
\noindent\font[family=TT2020Base,size=5pt]{&&FONT&&}
28+
\end{font}
5529
}
5630
\end{document}

0 commit comments

Comments
 (0)