Skip to content

Chinese .ttf fonts failing with one of two errors #279

@dhowe

Description

@dhowe

Uncaught Error: Only format 4 and 12 cmap tables are supported.
or
Uncaught TypeError: Cannot read property 'glyphIndexMap' of null

I suppose the first is an expected error.

Code here:

<html>
<head>
  <meta charset="UTF-8">
  <script src="lib/opentype.js"></script>
  <script>
  window.onload = function() {
    opentype.load('fonts/font.ttf', function(err, font) {
      if (err) {
        alert('Font could not be loaded: ' + err);
      } else {
        var ctx = document.getElementById('canvas').getContext('2d');
        var path = font.getPath('Hello, World!', 0, 100, 22);
        path.draw(ctx);
      }
    });
  }
  </script>
</head>
<body>
<canvas id="canvas" style="width: 600px"></canvas>
</body>
</html>

fonts.zip

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions