[test/shape] Allow using hb-subset in record-test.sh

I think it is about time we use our own subsetter here. FontTools can
still be used.
This commit is contained in:
Khaled Hosny 2022-06-03 08:46:30 +02:00 committed by Behdad Esfahbod
parent 5bfb0b721c
commit ef5d7febc8
1 changed files with 8 additions and 2 deletions

View File

@ -19,6 +19,8 @@ if test "x$1" == 'x-o'; then
out=$1 out=$1
shift shift
fi fi
hb_subset=$1
shift
hb_shape=$1 hb_shape=$1
shift shift
fontfile=$1 fontfile=$1
@ -27,6 +29,10 @@ if test "x${fontfile:0:1}" == 'x-'; then
exit 1 exit 1
fi fi
shift shift
if ! echo "$hb_subset" | grep -q 'subset'; then
echo "Specify hb-subset (or \"fonttools subset\"): got "$hb_subset"." >&2
exit 1
fi
if ! echo "$hb_shape" | grep -q 'hb-shape'; then if ! echo "$hb_shape" | grep -q 'hb-shape'; then
echo "Specify hb-shape (not hb-view, etc): got "$hb_shape"." >&2 echo "Specify hb-shape (not hb-view, etc): got "$hb_shape"." >&2
exit 1 exit 1
@ -61,7 +67,7 @@ fi
glyph_ids=`echo "$text" | $hb_shape $options --no-glyph-names --no-clusters --no-positions "$fontfile" | sed 's/[][]//g; s/|/,/g'` glyph_ids=`echo "$text" | $hb_shape $options --no-glyph-names --no-clusters --no-positions "$fontfile" | sed 's/[][]//g; s/|/,/g'`
cp "$fontfile" "$dir/font.ttf" cp "$fontfile" "$dir/font.ttf"
echo fonttools subset \ echo $hb_subset \
--glyph-names \ --glyph-names \
--no-hinting \ --no-hinting \
--layout-features='*' \ --layout-features='*' \
@ -69,7 +75,7 @@ echo fonttools subset \
--text="$text" \ --text="$text" \
--output-file="$dir/font.subset.ttf" \ --output-file="$dir/font.subset.ttf" \
"$dir/font.ttf" "$dir/font.ttf"
fonttools subset \ $hb_subset \
--glyph-names \ --glyph-names \
--no-hinting \ --no-hinting \
--layout-features='*' \ --layout-features='*' \