Generate icon font set asynchronously

@param  {Object} options
@param  {Function} callback
@return {void}
359390
async function generate(options = {}) {
  options = Object.assign(DEFAULT_OPTIONS, options)

  // Log start
  let msg = `Generating font kit from ${ options.paths.length } SVG icons`.yellow
  log(options, msg)

  // Run validation over options
  await validateOptions(options)

  if (options.codepoints) {
    options.codepointsMap = await getCodepointsMap(options.codepoints)
  }

  // Run font generation
  const config = getGeneratorConfig(options)
  const generatorResult = await fontGenerator(config)

  // Clean up after generator
  await deleteUnspecifiedTypes(options)

  // If specified, generate JSON map
  if (options.json) {
    await generateJson(options, generatorResult)
  }

  // Log generated files
  logReport(options)
}
1338349
function (options, dir, callback) {
  var iconFile = path.join(dir, getPixmapPath(options))
  options.logger('Creating icon file at ' + iconFile)

  fs.copy(options.icon, iconFile, function (err) {
    callback(err && new Error('Error creating icon file: ' + (err.message || err)))
  })
}
895840
public function generate_google_font( $args ) {

		// Process typography fields.
		if ( ( isset( $args['type'] ) && 'kirki-typography' === $args['type'] ) || ( isset( $args['choices'] ) && isset( $args['choices']['parent_type'] ) && 'kirki-typography' === $args['choices']['parent_type'] ) ) {

			// Get the value.
			$value = Values::get_sanitized_field_value( $args );

			// If we don't have a font-family then we can skip this.
			if ( ! isset( $value['font-family'] ) || in_array( $value['font-family'], $this->hosted_fonts, true ) ) {
				return;
			}

			// If not a google-font, then we can skip this.
			if ( ! isset( $value['font-family'] ) || ! Fonts::is_google_font( $value['font-family'] ) ) {
				return;
			}

			// Set a default value for variants.
			if ( ! isset( $value['variant'] ) ) {
				$value['variant'] = 'regular';
			}

			// Add the requested google-font.
			if ( ! is_array( $value ) || ! isset( $value['font-family'] ) || ! isset( $this->fonts[ $value['font-family'] ] ) ) {
				$this->fonts[ $value['font-family'] ] = [];
			}
			if ( ! in_array( $value['variant'], $this->fonts[ $value['font-family'] ], true ) ) {
				$this->fonts[ $value['font-family'] ][] = $value['variant'];
			}

			// Are we force-loading all variants?
			if ( true === self::$force_load_all_variants ) {
				$all_variants               = Fonts::get_all_variants();
				$args['choices']['variant'] = array_keys( $all_variants );
			}

			if ( ! empty( $args['choices']['variant'] ) && is_array( $args['choices']['variant'] ) ) {
				foreach ( $args['choices']['variant'] as $extra_variant ) {
					$this->fonts[ $value['font-family'] ][] = $extra_variant;
				}
			}
			return;
		}

		// Process non-typography fields.
		if ( isset( $args['output'] ) && is_array( $args['output'] ) ) {
			foreach ( $args['output'] as $output ) {

				// If we don't have a typography-related output argument we can skip this.
				if ( ! isset( $output['property'] ) || ! in_array( $output['property'], [ 'font-family', 'font-weight' ], true ) ) {
					continue;
				}

				// Get the value.
				$value = Values::get_sanitized_field_value( $args );

				if ( is_string( $value ) ) {
					if ( 'font-family' === $output['property'] ) {
						if ( ! array_key_exists( $value, $this->fonts ) ) {
							$this->fonts[ $value ] = [];
						}
					} elseif ( 'font-weight' === $output['property'] ) {
						foreach ( $this->fonts as $font => $variants ) {
							if ( ! in_array( $value, $variants, true ) ) {
								$this->fonts[ $font ][] = $value;
							}
						}
					}
				}
			}
		}
	}
1301662
function pxValue(val, options) {
  if (!options) {
    options = {};
  }

  const baseFontSize = parseInt(prop(options, 'base-font-size', 16), 10);

  const value = parseFloat(val);
  const unit = val.replace(value, '');
  // eslint-disable-next-line default-case
  switch (unit) {
    case 'rem':
    case 'em':
      return value * baseFontSize;
    case 'pt':
      return value / (96 / 72);
    case 'px':
      return value;
  }

  throw new Error('The unit ' + unit + ' is not supported');
}
913452
function(rm, oRoadMap, oStep){
		var fCreateIcon = function(rm, oRoadMap, sId, sIcon, sAdditonalClass){
			rm.write("<div");
			rm.writeAttribute("id", sId + "-ico");
			rm.addClass("sapUiRoadMapStepIco");
			if (sAdditonalClass) {
				rm.addClass(sAdditonalClass);
			}
			rm.writeClasses();
			rm.write("></div>");
		};

		var bIsExpanded = oStep.getExpanded();

		//Render the start step with an additional icon
		renderStep(rm, oRoadMap, oStep, bIsExpanded ? ["sapUiRoadMapExpanded"] : null, function(rm, oRoadMap, oStep){
			fCreateIcon(rm, oRoadMap, oStep.getId(), bIsExpanded ? "roundtripstart.gif" : "roundtrip.gif");
		});

		//Render the sub steps
		var aSteps = oStep.getSubSteps();
		for (var i = 0; i < aSteps.length; i++) {
			var aClasses = ["sapUiRoadMapSubStep"];
			if (!bIsExpanded && aSteps[i].getVisible()) {
				aClasses.push("sapUiRoadMapHidden");
			}
			renderStep(rm, oRoadMap, aSteps[i], aClasses);
		}

		//Render the end step with an additional icon
		aClasses = ["sapUiRoadMapExpanded", "sapUiRoadMapStepEnd"];
		if (!bIsExpanded) {
			aClasses.push("sapUiRoadMapHidden");
		}
		renderStep(rm, oRoadMap, oStep, aClasses, function(rm, oRoadMap, oStep){
			fCreateIcon(rm, oRoadMap, oStep.getId() + "-expandend", "roundtripend.gif");
		}, oStep.getId() + "-expandend");
	}
6034
function OptimizeCssnanoPlugin(options) {
  this.options = Object.assign({
    sourceMap: false,
    cssnanoOptions: {
      preset: 'default',
    },
  }, options);

  if (this.options.sourceMap) {
    this.options.sourceMap = Object.assign(
      {inline: false},
      this.options.sourceMap || {});
  }
}
990229
function setFontFamily(fontFamily) {
        var editor = EditorManager.getCurrentFullEditor();

        if (currFontFamily === fontFamily) {
            return;
        }

        _removeDynamicFontFamily();
        if (fontFamily) {
            _addDynamicFontFamily(fontFamily);
        }

        exports.trigger("fontFamilyChange", fontFamily, currFontFamily);
        currFontFamily = fontFamily;
        prefs.set("fontFamily", fontFamily);

        if (editor) {
            editor.refreshAll();
        }
    }
235450
function font() {
  return src([`${svgDir}/*.svg`])
    .pipe(
      iconfontCss({
        fontName: config.name,
        path: template,
        targetPath: '../src/index.less',
        normalize: true,
        firstGlyph: 0xf000,
        cssClass: fontName // this is a trick to pass fontName to template
      })
    )
    .pipe(
      iconfont({
        fontName,
        formats
      })
    )
    .pipe(dest(srcDir));
}
877633
function maybeNoIconOption(options) {
  const packageOptions = JSON.parse(JSON.stringify(options));
  if (options.platform === 'win32' && !isWindows()) {
    if (!hasBinary.sync('wine')) {
      log.warn(
        'Wine is required to set the icon for a Windows app when packaging on non-windows platforms',
      );
      packageOptions.icon = null;
    }
  }
  return packageOptions;
}
1058434
def OnCellFont(self, event):
        """"""

        with undo.group(_("Font")):
            self.grid.actions.set_attr("textfont", event.font)

        self.grid.ForceRefresh()

        self.grid.update_attribute_toolbar()

        event.Skip()
309527
async function transpileIcons(icons) {
  await fs.mkdirp(buildDir);

  return Promise.all(
    icons.map(async icon => {
      const svg = await fs.readFile(icon, 'utf-8');
      const id = path
        .basename(icon, '.svg')
        .replace(/ /g, '-')
        .replace('.colored', '-colored');

      const $ = cheerio.load(svg, {
        xmlMode: true,
      });

      const fileName = path
        .basename(icon)
        .replace(/ /g, '-')
        .replace('.colored', '-colored')
        .replace('.svg', '.js');
      const location = path.join(buildDir, fileName);

      $('*').each((index, el) => {
        Object.keys(el.attribs).forEach(x => {
          if (x === 'stroke') {
            $(el).attr(x, 'currentColor');
          }

          if (x === 'fill') {
            $(el).attr(x, 'currentColor');
          }
        });

        if (el.name === 'svg') {
          $(el).attr('otherProps', '...');
        }

        // Remove artboard rectangle that sometimes pops up in exported SVGs
        if ($(el).attr('id') === 'Rectangle-6') {
          $(el).remove();
        }

        $(el).removeAttr('xmlns:xlink');

        if ($(el).attr('xlink:href')) {
          const xlinkHrefVal = $(el).attr('xlink:href');
          $(el).removeAttr('xlink:href');
          $(el).attr('xlinkHref', xlinkHrefVal);
        }

        if ($(el).attr('xlink:href')) {
          const xlinkHrefVal = $(el).attr('xlink:href');
          $(el).removeAttr('xlink:href');
          $(el).attr('xlinkHref', xlinkHrefVal);
        }
      });

      const result = await svgo.optimize(svg);
      const optimizedSVG = result.data;

      const element = `
  import { h } from '@bolt/core/renderers';

  export const ${uppercamelcase(
    id,
  )} = ({ bgColor, fgColor, size, ...otherProps }) => {
      return (
        ${
          fileName.includes('-color')
            ? $(optimizedSVG)
                .toString()
                .replace('viewBox', '{...otherProps} viewBox') // tack on extra props next to viewBox attribute
                .replace('d="M0 0h24v24H0z"', '')
                .replace(/width=".*?"/, 'width={size}')
                .replace(/height=".*?"/, 'height={size}')
                .replace('otherProps="..."', '{...otherProps}')
            : $(optimizedSVG)
                .toString()
                .replace('fill="#FFF"', 'fill={fgColor}')
                .replace('stroke="#FFF"', 'stroke={fgColor}')
                .replace(new RegExp(/ stroke=".*?"/, 'g'), ' stroke={bgColor}')
                .replace(
                  new RegExp(/ fill="(?!#fff|none).*?"/, 'g'),
                  ' fill={bgColor}',
                )
                .replace('viewBox', '{...otherProps} viewBox') // tack on extra props next to viewBox attribute
                .replace('d="M0 0h24v24H0z"', '')
                .replace(/width=".*?"/, 'width={size}')
                .replace(/height=".*?"/, 'height={size}')
                .replace('otherProps="..."', '{...otherProps}')
        }
      )
};
`;

      const component = prettier.format(element, {
        singleQuote: true,
        trailingComma: 'es5',
        bracketSpacing: true,
        jsxBracketSameLine: true,
        parser: 'flow',
      });

      await fs.outputFile(location, component, 'utf-8');
      // Later when we call `const icons = await transpileIcons(iconPaths);` - `icons` will be an array of these objects:
      return {
        location,
        id,
        icon,
        fileName,
      };
    }),
  );
}
588171
function (options, dir, callback) {
  if (_.isObject(options.icon)) {
    createHicolorIcon(options, dir, callback)
  } else if (options.icon) {
    createPixmapIcon(options, dir, callback)
  } else {
    callback()
  }
}
169307
function MapLabel(opt_options) {
  this.set('fontFamily', 'sans-serif');
  this.set('fontSize', 12);
  this.set('fontColor', '#000000');
  this.set('strokeWeight', 4);
  this.set('strokeColor', '#ffffff');
  this.set('align', 'center');

  this.set('zIndex', 1e3);

  this.setValues(opt_options);
}
1031252
function(type, title, iconType, iconTemplate, subtitle, callback) {
                var deferred = $q.defer();

                var quickAction = {
                    type: type,
                    title: title,
                    subtitle: subtitle
                };

                if (iconType) {
                    quickAction.iconType = iconType;
                }

                if (iconTemplate) {
                    quickAction.iconTemplate = iconTemplate;
                }

                this.isAvailable().then(function() {
                    quickActions.push(quickAction);
                    quickActionHandler[type] = callback;
                    window.ThreeDeeTouch.configureQuickActions(quickActions);
                    window.ThreeDeeTouch.onHomeIconPressed = createQuickActionHandler(quickActionHandler);
                    deferred.resolve(quickActions);
                },
                function(err) {
                    deferred.reject(err);
                });

                return deferred.promise;
            }
946337
function merge(target, source) {
  // Check if font name is changed
  if (source['font-name']) {
    target['font-name'] = source['font-name'];
  }

  // Check if root dir is changed
  if (source['root-dir']) {
    target['root-dir'] = source['root-dir'];
  }

  // Check for icon changes
  if (source.icons) {
    for (let icon of source['icons']) {
      let index = iconsIndex.indexOf(icon.name);

      // Icon is replaced
      if (index !== -1) {
        target.icons[index] = icon;
      }
      // New icon is added
      else {
        target.icons.push(icon);
        iconsIndex.push(icon.name);
      }
    }
  }

  return target;
}
670710
function fontConvert(content, to, from) {
  if (!content) {
    if (!globalOptions.isSilentMode()) console.warn('Content must be specified on knayi.fontConvert.');
    return '';
  }

  if (content === '' || !mmCharacterRange.test(content))
    return content;

  if (!to) {
    if (!globalOptions.isSilentMode()) console.error('Convert target font must be specified on knayi.fontConvert.');
    return content;
  }

  content = content.trim().replace(/\u200B/g, '');
  to = fontTypes[to];
  from = fontTypes[from];

  if (!to) {
    if (!globalOptions.isSilentMode()) console.error('Convert library dosen\'t have this fontType.')
    return content;
  } else if (!from) {
    from = fontDetect(content);
  }

  if (to === from) {
    return content;
  }

  var debug_logs = {
    to: to, from: from,
    matched_patterns: [],
    steps: []
  }

  content = spellingFix(content, from);
  var refLib = library.convert[from][to];

  for (var i = 0; i < refLib.oneTime.length; i++) {
    var rule1 = refLib.oneTime[i];
    // debugging
    if (this.debug && rule1[0].test(content)) {
      debug_logs.matched_patterns.push(rule1);
      debug_logs.steps.push(content);
    }
    content = content.replace(rule1[0], rule1[1]);
  }

  for (var j = 0; j < refLib.asLongAsMatch.length; j++) {
    var rule2 = refLib.asLongAsMatch[j];
    // debugging
    if (this.debug && rule2[0].test(content)) {
      debug_logs.matched_patterns.push(rule2);
      debug_logs.steps.push(content);
    }
    while (rule2[0].test(content)) {
      content = content.replace(rule2[0], rule2[1]);
    }
  }

  if (this.debug) {
    // final
    debug_logs.steps.push(content);
    return debug_logs;
  }

  return content;
}
79544
function (options, callback) {

            options = options || {};

            _.defaults(options, {
                size: "M",
                align: "justify",
                font: null,
                text: null,
                taskId: null
            });

            if (!(options.font && options.text)) {
                callback && callback("Font and text required");
                return;
            }
            options.text = (options.text || "").replace(/^\n+|\n+$/gi, "");
            options.fontId = options.font.$.id;

            delete options.font;

            var params = _.extend({}, options),
                cacheKeys = _.keys(params).sort(),
                cacheKey = [], key;

            for (var i = 0; i < cacheKeys.length; i++) {
                key = cacheKeys[i];
                if (key === "taskId" && !params[key]) {
                    cacheKey.push(key + "=" + new Date().getTime());
                } else {
                    cacheKey.push(key + "=" + (params[key]));
                }

            }

            cacheKey = cacheKey.join("&");

            this.synchronizeFunctionCall(requestImage, cacheKey, callback, this, true);

            function requestImage(callback) {

                var self = this;

                flow()
                    .seq("task", function (cb) {
                        rAppid.ajax(self.$.gateway + '/fonts/tasks' + (options.taskId ? '/' + options.taskId : ''), {
                            type: options.taskId ? 'PUT' : 'POST',
                            contentType: 'application/json',
                            data: JSON.stringify(options)
                        }, function (err, xhr) {
                            if (!err && (xhr.status == 200 || xhr.status == 201)) {
                                cb(null, JSON.parse(xhr.responses.text));
                            } else {
                                cb(err || true);
                            }
                        })
                    })
                    .seq("image", function (cb) {
                        var img = new Image(),
                            task = this.vars.task;

                        img.onload = function () {
                            cb && cb(null, {
                                width: img.width,
                                height: img.height,
                                src: img.src
                            });
                        };

                        img.onerror = function (e) {
                            cb && cb(e)
                        };

                        img.src = task.url;
                    })
                    .exec(callback);

            }
        }