summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRasmus Andersson <rasmus@notion.se>2018-09-05 20:06:49 +0300
committerRasmus Andersson <rasmus@notion.se>2018-09-06 03:27:35 +0300
commitcc6505cae9d8f5086c0fc7043508597ee0d52f0b (patch)
tree199ee35285152f90caacba53d39afc0fb76aedb3 /docs
parentbe9e8a0bfa2494167909b5f6f60f59c5c7bd719b (diff)
downloadinter-cc6505cae9d8f5086c0fc7043508597ee0d52f0b.tar.xz
web: glyphinfo format compatibility
Diffstat (limited to 'docs')
-rw-r--r--docs/glyphs/glyphs.js21
-rw-r--r--docs/lab/index.html12
2 files changed, 26 insertions, 7 deletions
diff --git a/docs/glyphs/glyphs.js b/docs/glyphs/glyphs.js
index b6cd24740..e3e61e0e7 100644
--- a/docs/glyphs/glyphs.js
+++ b/docs/glyphs/glyphs.js
@@ -326,6 +326,9 @@ function render() {
// glyphInfo: {
// "glyphs": [
+ // // <=v2.5:
+ // [name :string, unicode? :int|null, unicodeName? :string, color? :string|null],
+ // // >=v2.6: (has mtime)
// [name :string, unicode? :int|null, unicodeName? :string, mtime? :string, color? :string|null],
// ["A", 65, "LATIN CAPITAL LETTER A", "#dbeaf7"],
// ...
@@ -387,10 +390,18 @@ function renderGlyphGraphic(glyphName) {
function renderGlyphGraphicG(g, lastGlyphName, lastGlyphEl, singleGlyph) {
- var name = g[0]
+ let name = g[0], uc = g[1], ucName = g[2], mtime = g[3], color = g[4]
var names, glyph
var svg = svgRepository[name]
+ // XXX compatibility with v2.5 (remove when moving to v2.6)
+ // glyphinfo for 2.5 doesn't contain mtime.
+ if (mtime && typeof mtime == 'string' &&
+ (mtime.indexOf('rgba') != -1 || mtime.indexOf('#') != -1)) {
+ color = mtime
+ mtime = null
+ }
+
if (!svg) {
// ignore
return null
@@ -403,10 +414,10 @@ function renderGlyphGraphicG(g, lastGlyphName, lastGlyphEl, singleGlyph) {
var info = {
name: name,
- unicode: g[1],
- unicodeName: g[2],
- // mtime: g[3],
- color: g[4],
+ unicode: uc,
+ unicodeName: ucName,
+ // mtime: mtime,
+ color: color,
// These are all in 1:1 UPM (not scaled)
advance: metrics.advance,
diff --git a/docs/lab/index.html b/docs/lab/index.html
index 7b3f785dc..924e1b7c6 100644
--- a/docs/lab/index.html
+++ b/docs/lab/index.html
@@ -478,9 +478,17 @@ samples.set('Repertoire', {
for (const g of glyphs) {
// let [name, uc, ucName, mtime, color] = g
- let name = g[0], uc = g[1], ucName = g[2], mtime = g[3] color = g[4]
+ let name = g[0], uc = g[1], ucName = g[2], mtime = g[3], color = g[4]
const ucHex = hexstr(uc, 4)
-
+
+ // XXX compatibility with v2.5 (remove when moving to v2.6)
+ // glyphinfo for 2.5 doesn't contain mtime.
+ if (mtime && typeof mtime == 'string' &&
+ (mtime.indexOf('rgba') != -1 || mtime.indexOf('#') != -1)) {
+ color = mtime
+ mtime = null
+ }
+
const style = color && color != '<derived>' ?
'style="background-color:' + color + '"' : ''