Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Create new default branch + finished character map implementation #135

Open
phoenixenero opened this issue Dec 8, 2015 · 2 comments
Open

Comments

@phoenixenero
Copy link
Contributor

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.

Example:

<table>
    <tr>
        <td>&#x0020;</td>
        <td>&#x0021;</td>
        <td>&#x0022;</td>
        ...
        <td>&#x0029;</td>
    </tr>
    <tr>
        <td>&#x002a;</td>
        <td>&#x002b;</td>
        <td>&#x002c;</td>
        ...
        <td>&#x0032;</td>
    </tr>
    ...
</table>

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!

@alfredxing
Copy link
Owner

Sounds reasonable. I'll probably set up Travis to do automatic deploys for this as well as pushing to the origin server.

How's the performance of running these scripts?

@phoenixenero
Copy link
Contributor Author

30-35 seconds to run.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants