I'm nearly finished on the character map generation feature for Brick. But we need a new default branch to publish updates to.
My implementation of the charmap generation relies on 3 Ruby (.rb) scripts.
generate-charmap.rb – This script generates a file containing the available characters of a font. It outputs a file with extension .charmap on that same directory as the font files (this is important later on.) Its formatted with one Unicode value every line. The script is hardcoded to run on every file that matches _fonts/*/*.woff.
Example:
20
21
22
...
ffff
cleanup-charmap.rb – This formats the .charmap files. It remove duplicates, deletes characters 00-1f, pads with zeroes (0), and sorts the resulting lines.
Example:
005a
005b
005c
...
0f2a
0f2b
generate-charmap-templates.rb – This generates an HTML table for each .charmap file. It outputs in the directory _includes/charmaps/_font_name_ where _font_name_ is the name of the font using the index.html file in the same directory as the .charmap file`. Table columns are hardcoded to 10 columns.
We can then use the new templates in the _layouts/font.html file.
I made a bash (.sh) script that runs these .rb scripts in order for convenience.
Because we're hosted on Github Pages, we need another branch – say, master – to do main development on. @alfredxing can run the tools everytime there's a new font and pull them in the gh-pages branch. This would also be future proof, on the event we also implement Font Subsetting.
I'm nearly finished on the character map generation feature for Brick. But we need a new default branch to publish updates to.
My implementation of the charmap generation relies on 3 Ruby (
.rb
) scripts.generate-charmap.rb
– This script generates a file containing the available characters of a font. It outputs a file with extension.charmap
on that same directory as the font files (this is important later on.) Its formatted with one Unicode value every line. The script is hardcoded to run on every file that matches_fonts/*/*.woff
.Example:
cleanup-charmap.rb
– This formats the.charmap
files. It remove duplicates, deletes characters 00-1f, pads with zeroes (0), and sorts the resulting lines.Example:
generate-charmap-templates.rb
– This generates an HTML table for each.charmap
file. It outputs in the directory_includes/charmaps/_font_name_
where_font_name_
is the name of the font using theindex.html
file in the same directory as the.charmap
file`. Table columns are hardcoded to 10 columns.We can then use the new templates in the
_layouts/font.html
file.Example:
I made a bash (
.sh
) script that runs these.rb
scripts in order for convenience.Because we're hosted on Github Pages, we need another branch – say,
master
– to do main development on. @alfredxing can run the tools everytime there's a new font and pull them in the gh-pages branch. This would also be future proof, on the event we also implement Font Subsetting.When you create the branch I'll make a PR.
Thanks!