Skip to content

Commit

Permalink
feat(ligatures): add ligature support
Browse files Browse the repository at this point in the history
  • Loading branch information
mpalpha committed Aug 12, 2019
1 parent 45d0d43 commit 61d7e22
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 16 deletions.
Binary file modified demo/webfont.eot
Binary file not shown.
35 changes: 28 additions & 7 deletions demo/webfont.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
display: inline-block;
line-height: 3em;
margin-left: 5px;
white-space: nowrap;
}

@font-face {
Expand Down Expand Up @@ -164,21 +165,41 @@
</head>
<body>
<h1>List Icons</h1>
<div class="icons" id="icons">
<h3>Class</h3>
<div class="icons" id="icon-classes">

<div class="icons__item">
<i class="webfont webfont-3x webfont-avatar"></i>
<span>webfont-avatar</span>
<i class="webfont webfont-3x webfont-avatar"></i><br />
<span>.webfont-avatar</span>
</div>

<div class="icons__item">
<i class="webfont webfont-3x webfont-envelope"></i>
<span>webfont-envelope</span>
<i class="webfont webfont-3x webfont-envelope"></i><br />
<span>.webfont-envelope</span>
</div>

<div class="icons__item">
<i class="webfont webfont-3x webfont-phone-call"></i>
<span>webfont-phone-call</span>
<i class="webfont webfont-3x webfont-phone-call"></i><br />
<span>.webfont-phone-call</span>
</div>

</div>
<h3>Ligature</h3>
<div class="icons" id="icon-ligatures">

<div class="icons__item">
<i class="webfont webfont-3x">avatar</i><br />
<span>avatar</span>
</div>

<div class="icons__item">
<i class="webfont webfont-3x">envelope</i><br />
<span>envelope</span>
</div>

<div class="icons__item">
<i class="webfont webfont-3x">phone_call</i><br />
<span>phone_call</span>
</div>

</div>
Expand Down
9 changes: 9 additions & 0 deletions demo/webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo/webfont.ttf
Binary file not shown.
Binary file modified demo/webfont.woff
Binary file not shown.
Binary file modified demo/webfont.woff2
Binary file not shown.
12 changes: 6 additions & 6 deletions src/__tests__/standalone.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ describe("standalone", () => {
.createHash("md5")
.update(result.woff2)
.digest("hex");

expect(svgHash).toBe("ead2b6f69fc603bf1cbd00bf9f8a8a33");
expect(ttfHash).toBe("8ffaa42f84b0835c7c250ec16e8f5d78");
expect(eotHash).toBe("cc86496a4fd871e31a79043a7ba96a07");
expect(woffHash).toBe("e90fb075e22ab56621e1caf13c52ef17");
expect(woff2Hash).toBe("c71b12c10bb6576528ef1a461c166e3a");
expect(svgHash).toBe("5babeea3094bba0b5e2001390b0811fd");
expect(ttfHash).toBe("dea1ee6d35ff9442f7586b60e045032f");
expect(eotHash).toBe("9ac8e63b19c5e58ef8ee6d95684cb9b6");
expect(woffHash).toBe("fbe22cb889122700687b51460222c3e3");
expect(woff2Hash).toBe("439ed126cdcd5b62361b30823f6ebaa3");
});

it("should generate only `svg`, `ttf` and `eot` fonts", async () => {
Expand Down
1 change: 1 addition & 0 deletions src/standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function getGlyphsData(files, options) {
return reject(error);
}

metadata.unicode.push(metadata.name.replace("-", "_"));
glyphData.metadata = metadata;

return resolve(glyphData);
Expand Down
17 changes: 14 additions & 3 deletions templates/template.html.njk
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
display: inline-block;
line-height: 3em;
margin-left: 5px;
white-space: nowrap;
}
@font-face {
Expand Down Expand Up @@ -185,11 +186,21 @@
</head>
<body>
<h1>List Icons</h1>
<div class="icons" id="icons">
<h3>Class</h3>
<div class="icons" id="icon-classes">
{% for glyph in glyphs %}
<div class="icons__item">
<i class="{{ className }} {{ className }}-3x {{ className }}-{{ glyph.name }}"></i>
<span>{{ className }}-{{ glyph.name }}</span>
<i class="{{ className }} {{ className }}-3x {{ className }}-{{ glyph.name }}"></i><br />
<span>.{{ className }}-{{ glyph.name }}</span>
</div>
{% endfor %}
</div>
<h3>Ligature</h3>
<div class="icons" id="icon-ligatures">
{% for glyph in glyphs %}
<div class="icons__item">
<i class="{{ className }} {{ className }}-3x">{{ glyph.unicode[1] }}</i><br />
<span>{{ glyph.unicode[1] }}</span>
</div>
{% endfor %}
</div>
Expand Down

0 comments on commit 61d7e22

Please sign in to comment.