Skip to content

Avoid reserved Codepoints U+FE00...U+FE0F and U+FE20...U+FE2F #568

@stephenquan

Description

@stephenquan

The following codepoints are reserved and should be avoided:

In my project I have 3380 SVGs icons. I am not explicitly setting codepoints. Codepoints U+F101 (DEFAULT_START_CODEPOINT) ... U+FE3F are automatically allocated by fantasticon. However, these codepoints collide with the reserved codepoints and create rendering issues.

Here's a repro makeicons.sh script:

#!/bin/bash

# Generate 3380 SVG icons (solid triangle)
mkdir -p icons
((DEFAULT_START_CODEPOINT=16#f101))
for ((i=0;i<3380;i++))
do
  echo '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M16 8L24 24 L 8 24z"/></svg>' > $(printf 'icons/icon-%x.svg' $((DEFAULT_START_CODEPOINT+i)))
  if ((i % 100 == 0)); then echo "$((i+1)) icons created ..."; fi
done
echo "$i total icons created"

# Generate my-icons.js
cat > my-icons.js <<EOF
module.exports = {
  name: 'my-icons',
  fontHeight: 500,
  normalize: true,
  inputDir: './icons',
  outputDir: './dist',
  fontTypes: ['ttf'],
  assetTypes: ['css', 'json', 'html'],
  formatOptions: {
    json: {
      indent: 2
    }
  },
  getIconId: ({
    basename,
    relativeDirPath,
    absoluteFilePath,
    relativeFilePath,
    index
  }) => {
    return basename;
  }
};
EOF

# Generate my-icons.ttf
mkdir -p dist
fantasticon --config ./my-icons.js

dist/my-icons.html below shows that icons in U+FE00...U+FE0F are blank and icons in the U+FE20...U+FE2F` are not centered but left jusitifed.

image

If #527 was implemented, it could help dodge the problematic codepoints.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions