function createFont(face) {
    var ptr = exports.hb_font_create(face.ptr);

    /**
    * Return a glyph as an SVG path string.
    * @param {number} glyphId ID of the requested glyph in the font.
    **/
    function glyphToPath(glyphId) {
      var svgLength = exports.hbjs_glyph_svg(ptr, glyphId, pathBuffer, pathBufferSize);
      return svgLength > 0 ? utf8Decoder.decode(heapu8.subarray(pathBuffer, pathBuffer + svgLength)) : "";
    }

    return {
      ptr: ptr,
      glyphToPath: glyphToPath,
      /**
      * Return a glyph as a JSON path string
      * based on format described on https://svgwg.org/specs/paths/#InterfaceSVGPathSegment
      * @param {number} glyphId ID of the requested glyph in the font.
      **/
      glyphToJson: function (glyphId) {
        var path = glyphToPath(glyphId);
        return path.replace(/([MLQCZ])/g, '|$1 ').split('|').filter(function (x) { return x.length; }).map(function (x) {
          var row = x.split(/[ ,]/g);
          return { type: row[0], values: row.slice(1).filter(function (x) { return x.length; }).map(function (x) { return +x; }) };
        });
      },
      /**
      * Set the font's scale factor, affecting the position values returned from
      * shaping.
      * @param {number} xScale Units to scale in the X dimension.
      * @param {number} yScale Units to scale in the Y dimension.
      **/
      setScale: function (xScale, yScale) {
        exports.hb_font_set_scale(ptr, xScale, yScale);
      },
      /**
       * Set the font's variations.
       * @param {object} variations Dictionary of variations to set
       **/
      setVariations: function (variations) {
        var entries = Object.entries(variations);
        var vars = exports.malloc(8 * entries.length);
        entries.forEach(function (entry, i) {
          heapu32[vars / 4 + i * 2 + 0] = hb_tag(entry[0]);
          heapf32[vars / 4 + i * 2 + 1] = entry[1];
        });
        exports.hb_font_set_variations(ptr, vars, entries.length);
        exports.free(vars);
      },
      /**
      * Free the object.
      */
      destroy: function () { exports.hb_font_destroy(ptr); }
    };
  }
/**
  * Create an object representing a Harfbuzz font.
  * @param {object} blob An object returned from `createFace`.
  **/
Create an object representing a Harfbuzz font.
@param {object} blob An object returned from `createFace`.
Create an object representing a Harfbuzz font . @param { object } blob An object returned from ` createFace ` .
function createFont(face) {
    var ptr = exports.hb_font_create(face.ptr);
    function glyphToPath(glyphId) {
      var svgLength = exports.hbjs_glyph_svg(ptr, glyphId, pathBuffer, pathBufferSize);
      return svgLength > 0 ? utf8Decoder.decode(heapu8.subarray(pathBuffer, pathBuffer + svgLength)) : "";
    }
    return {
      ptr: ptr,
      glyphToPath: glyphToPath,
      glyphToJson: function (glyphId) {
        var path = glyphToPath(glyphId);
        return path.replace(/([MLQCZ])/g, '|$1 ').split('|').filter(function (x) { return x.length; }).map(function (x) {
          var row = x.split(/[ ,]/g);
          return { type: row[0], values: row.slice(1).filter(function (x) { return x.length; }).map(function (x) { return +x; }) };
        });
      },
      setScale: function (xScale, yScale) {
        exports.hb_font_set_scale(ptr, xScale, yScale);
      },
      setVariations: function (variations) {
        var entries = Object.entries(variations);
        var vars = exports.malloc(8 * entries.length);
        entries.forEach(function (entry, i) {
          heapu32[vars / 4 + i * 2 + 0] = hb_tag(entry[0]);
          heapf32[vars / 4 + i * 2 + 1] = entry[1];
        });
        exports.hb_font_set_variations(ptr, vars, entries.length);
        exports.free(vars);
      },
      destroy: function () { exports.hb_font_destroy(ptr); }
    };
  }
function createFont ( face ) { var ptr = exports . hb_font_create ( face . ptr ) ; function glyphToPath ( glyphId ) { var svgLength = exports . hbjs_glyph_svg ( ptr , glyphId , pathBuffer , pathBufferSize ) ; return svgLength > 0 ? utf8Decoder . decode ( heapu8 . subarray ( pathBuffer , pathBuffer + svgLength ) ) : "" ; } return { ptr : ptr , glyphToPath : glyphToPath , glyphToJson : function ( glyphId ) { var path = glyphToPath ( glyphId ) ; return path . replace ( / ([MLQCZ]) / g , '|$1 ' ) . split ( '|' ) . filter ( function ( x ) { return x . length ; } ) . map ( function ( x ) { var row = x . split ( / [ ,] / g ) ; return { type : row [ 0 ] , values : row . slice ( 1 ) . filter ( function ( x ) { return x . length ; } ) . map ( function ( x ) { return + x ; } ) } ; } ) ; } , setScale : function ( xScale , yScale ) { exports . hb_font_set_scale ( ptr , xScale , yScale ) ; } , setVariations : function ( variations ) { var entries = Object . entries ( variations ) ; var vars = exports . malloc ( 8 * entries . length ) ; entries . forEach ( function ( entry , i ) { heapu32 [ vars / 4 + i * 2 + 0 ] = hb_tag ( entry [ 0 ] ) ; heapf32 [ vars / 4 + i * 2 + 1 ] = entry [ 1 ] ; } ) ; exports . hb_font_set_variations ( ptr , vars , entries . length ) ; exports . free ( vars ) ; } , destroy : function ( ) { exports . hb_font_destroy ( ptr ) ; } } ; }
Create an object representing a Harfbuzz font.
Create an object representing a Harfbuzz font .
/**
    * Return a glyph as an SVG path string.
    * @param {number} glyphId ID of the requested glyph in the font.
    **/ /**
      * Return a glyph as a JSON path string
      * based on format described on https://svgwg.org/specs/paths/#InterfaceSVGPathSegment
      * @param {number} glyphId ID of the requested glyph in the font.
      **/ /**
      * Set the font's scale factor, affecting the position values returned from
      * shaping.
      * @param {number} xScale Units to scale in the X dimension.
      * @param {number} yScale Units to scale in the Y dimension.
      **/ /**
       * Set the font's variations.
       * @param {object} variations Dictionary of variations to set
       **/ /**
      * Free the object.
      */